Title: [246489] trunk/Source
- Revision
- 246489
- Author
- [email protected]
- Date
- 2019-06-16 18:38:51 -0700 (Sun, 16 Jun 2019)
Log Message
[MediaStream] Avoid roundoff error when setting AVCapture min/max frame rate
https://bugs.webkit.org/show_bug.cgi?id=198875
<rdar://problem/51768374>
Reviewed by Youenn Fablet.
Source/WebCore:
* platform/graphics/MediaPlayer.h:
(WTF::LogArgument<MediaTime>::toString): Deleted, moved to MediaTime.h.
(WTF::LogArgument<MediaTimeRange>::toString): Deleted, moved to MediaTime.h.
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate): Avoid roundoff error.
Source/WTF:
* wtf/MediaTime.h:
(WTF::LogArgument<MediaTime>::toString):
(WTF::LogArgument<MediaTimeRange>::toString):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (246488 => 246489)
--- trunk/Source/WTF/ChangeLog 2019-06-17 00:33:32 UTC (rev 246488)
+++ trunk/Source/WTF/ChangeLog 2019-06-17 01:38:51 UTC (rev 246489)
@@ -1,3 +1,15 @@
+2019-06-16 Eric Carlson <[email protected]>
+
+ [MediaStream] Avoid roundoff error when setting AVCapture min/max frame rate
+ https://bugs.webkit.org/show_bug.cgi?id=198875
+ <rdar://problem/51768374>
+
+ Reviewed by Youenn Fablet.
+
+ * wtf/MediaTime.h:
+ (WTF::LogArgument<MediaTime>::toString):
+ (WTF::LogArgument<MediaTimeRange>::toString):
+
2019-06-12 Antoine Quint <[email protected]>
Show the web page URL when sharing an AR model
Modified: trunk/Source/WTF/wtf/MediaTime.h (246488 => 246489)
--- trunk/Source/WTF/wtf/MediaTime.h 2019-06-17 00:33:32 UTC (rev 246488)
+++ trunk/Source/WTF/wtf/MediaTime.h 2019-06-17 01:38:51 UTC (rev 246489)
@@ -174,6 +174,25 @@
&& decoder.decode(time.m_timeFlags);
}
+template<typename Type>
+struct LogArgument;
+
+template <>
+struct LogArgument<MediaTime> {
+ static String toString(const MediaTime& time)
+ {
+ return time.toJSONString();
+ }
+};
+
+template <>
+struct LogArgument<MediaTimeRange> {
+ static String toString(const MediaTimeRange& range)
+ {
+ return range.toJSONString();
+ }
+};
+
}
using WTF::MediaTime;
Modified: trunk/Source/WebCore/ChangeLog (246488 => 246489)
--- trunk/Source/WebCore/ChangeLog 2019-06-17 00:33:32 UTC (rev 246488)
+++ trunk/Source/WebCore/ChangeLog 2019-06-17 01:38:51 UTC (rev 246489)
@@ -1,3 +1,18 @@
+2019-06-16 Eric Carlson <[email protected]>
+
+ [MediaStream] Avoid roundoff error when setting AVCapture min/max frame rate
+ https://bugs.webkit.org/show_bug.cgi?id=198875
+ <rdar://problem/51768374>
+
+ Reviewed by Youenn Fablet.
+
+ * platform/graphics/MediaPlayer.h:
+ (WTF::LogArgument<MediaTime>::toString): Deleted, moved to MediaTime.h.
+ (WTF::LogArgument<MediaTimeRange>::toString): Deleted, moved to MediaTime.h.
+
+ * platform/mediastream/mac/AVVideoCaptureSource.mm:
+ (WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate): Avoid roundoff error.
+
2019-06-16 Simon Fraser <[email protected]>
Implement ScrollableArea::scrollOffset()
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (246488 => 246489)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2019-06-17 00:33:32 UTC (rev 246488)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2019-06-17 01:38:51 UTC (rev 246489)
@@ -632,27 +632,4 @@
} // namespace WebCore
-namespace WTF {
-
-template<typename Type>
-struct LogArgument;
-
-template <>
-struct LogArgument<MediaTime> {
- static String toString(const MediaTime& time)
- {
- return time.toJSONString();
- }
-};
-
-template <>
-struct LogArgument<MediaTimeRange> {
- static String toString(const MediaTimeRange& range)
- {
- return range.toJSONString();
- }
-};
-
-}
-
#endif // ENABLE(VIDEO)
Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (246488 => 246489)
--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm 2019-06-17 00:33:32 UTC (rev 246488)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm 2019-06-17 01:38:51 UTC (rev 246489)
@@ -327,9 +327,16 @@
if (frameRateRange) {
m_currentFrameRate = clampTo(m_currentFrameRate, frameRateRange.minFrameRate, frameRateRange.maxFrameRate);
- ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate to ", m_currentFrameRate);
- [device() setActiveVideoMinFrameDuration: CMTimeMake(1, m_currentFrameRate)];
- [device() setActiveVideoMaxFrameDuration: CMTimeMake(1, m_currentFrameRate)];
+ auto frameDuration = CMTimeMake(1, m_currentFrameRate);
+ if (CMTimeCompare(frameDuration, frameRateRange.minFrameDuration) < 0)
+ frameDuration = frameRateRange.minFrameDuration;
+ else if (CMTimeCompare(frameDuration, frameRateRange.maxFrameDuration) > 0)
+ frameDuration = frameRateRange.maxFrameDuration;
+
+ ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate to ", m_currentFrameRate, ", duration ", PAL::toMediaTime(frameDuration));
+
+ [device() setActiveVideoMinFrameDuration: frameDuration];
+ [device() setActiveVideoMaxFrameDuration: frameDuration];
} else
ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "cannot find proper frame rate range for the selected preset\n");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes