Title: [238053] trunk/Source/WebCore
Revision
238053
Author
[email protected]
Date
2018-11-09 13:26:16 -0800 (Fri, 09 Nov 2018)

Log Message

[MediaStream] AVVideoCaptureSource reports incorrect size when frames are scaled
https://bugs.webkit.org/show_bug.cgi?id=191479
<rdar://problem/45952201>

Reviewed by Jer Noble.

No new tests, tested manually.

* platform/mediastream/RealtimeVideoSource.cpp:
(WebCore::RealtimeVideoSource::standardVideoSizes): Drive-by fix: add a few more standard
video frame sizes, correct a typo.
(WebCore::RealtimeVideoSource::bestSupportedSizeAndFrameRate): Drive-by fix: don't consider
rescaled sized when we already have an exact or aspect ratio match because it won't be used.

* platform/mediastream/mac/AVVideoCaptureSource.h:
(WebCore::AVVideoCaptureSource::width const): Deleted.
(WebCore::AVVideoCaptureSource::height const): Deleted.
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset): Delete m_requestedSize.
(WebCore::AVVideoCaptureSource::shutdownCaptureSession): Delete m_width and m_height.
(WebCore::AVVideoCaptureSource::processNewFrame): Don't call setSize with captured size,
the frame may be resized before deliver.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (238052 => 238053)


--- trunk/Source/WebCore/ChangeLog	2018-11-09 21:10:26 UTC (rev 238052)
+++ trunk/Source/WebCore/ChangeLog	2018-11-09 21:26:16 UTC (rev 238053)
@@ -1,3 +1,28 @@
+2018-11-09  Eric Carlson  <[email protected]>
+
+        [MediaStream] AVVideoCaptureSource reports incorrect size when frames are scaled
+        https://bugs.webkit.org/show_bug.cgi?id=191479
+        <rdar://problem/45952201>
+
+        Reviewed by Jer Noble.
+
+        No new tests, tested manually.
+
+        * platform/mediastream/RealtimeVideoSource.cpp:
+        (WebCore::RealtimeVideoSource::standardVideoSizes): Drive-by fix: add a few more standard
+        video frame sizes, correct a typo.
+        (WebCore::RealtimeVideoSource::bestSupportedSizeAndFrameRate): Drive-by fix: don't consider
+        rescaled sized when we already have an exact or aspect ratio match because it won't be used.
+
+        * platform/mediastream/mac/AVVideoCaptureSource.h:
+        (WebCore::AVVideoCaptureSource::width const): Deleted.
+        (WebCore::AVVideoCaptureSource::height const): Deleted.
+        * platform/mediastream/mac/AVVideoCaptureSource.mm:
+        (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset): Delete m_requestedSize.
+        (WebCore::AVVideoCaptureSource::shutdownCaptureSession): Delete m_width and m_height.
+        (WebCore::AVVideoCaptureSource::processNewFrame): Don't call setSize with captured size,
+        the frame may be resized before deliver.
+
 2018-11-09  Ross Kirsling  <[email protected]>
 
         Unreviewed MSVC build fix after r238039 (and r238046).

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp (238052 => 238053)


--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp	2018-11-09 21:10:26 UTC (rev 238052)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp	2018-11-09 21:26:16 UTC (rev 238053)
@@ -103,6 +103,7 @@
             { 112, 112 },
             { 160, 160 },
             { 160, 120 }, // 4:3, QQVGA
+            { 176, 144 }, // 4:3, QCIF
             { 192, 192 },
             { 192, 112 }, // 16:9
             { 192, 144 }, // 3:4
@@ -109,7 +110,7 @@
             { 240, 240 },
             { 240, 160 }, // 3:2, HQVGA
             { 320, 320 },
-            { 320, 176 }, // 16:9
+            { 320, 180 }, // 16:9
             { 320, 240 }, // 4:3, QVGA
             { 352, 288 }, // CIF
             { 480, 272 }, // 16:9
@@ -116,7 +117,7 @@
             { 480, 360 }, // 4:3
             { 480, 480 },
             { 640, 640 },
-            { 640, 368 }, // 16:9
+            { 640, 360 }, // 16:9, 360p nHD
             { 640, 480 }, // 4:3
             { 720, 720 },
             { 800, 600 }, // 4:3, SVGA
@@ -127,7 +128,8 @@
             { 1280, 1024 }, // 5:4, SXGA
             { 1280, 720 }, // 16:9, WXGA
             { 1366, 768 }, // 16:9, HD
-            { 1920, 1080 }, // 16:9, FHD
+            { 1600, 1200}, // 4:3, UXGA
+            { 1920, 1080 }, // 16:9, 1080p FHD
             { 2560, 1440 }, // 16:9, QHD
             { 2592, 1936 },
             { 3264, 2448 }, // 3:4
@@ -301,6 +303,9 @@
             }
         }
 
+        if (exactSizePreset || aspectRatioPreset)
+            continue;
+
         if (requestedWidth && requestedHeight) {
             const auto& minStandardSize = standardVideoSizes()[0];
             if (requestedWidth.value() >= minStandardSize.width() && requestedHeight.value() >= minStandardSize.height()) {

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h (238052 => 238053)


--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h	2018-11-09 21:10:26 UTC (rev 238052)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h	2018-11-09 21:26:16 UTC (rev 238053)
@@ -57,9 +57,6 @@
 
     WEBCORE_EXPORT static VideoCaptureFactory& factory();
 
-    int32_t width() const { return m_width; }
-    int32_t height() const { return m_height; }
-
     enum class InterruptionReason { None, VideoNotAllowedInBackground, AudioInUse, VideoInUse, VideoNotAllowedInSideBySide };
     void captureSessionBeginInterruption(RetainPtr<NSNotification>);
     void captureSessionEndInterruption(RetainPtr<NSNotification>);
@@ -112,9 +109,6 @@
     RetainPtr<AVCaptureVideoDataOutput> m_videoOutput;
     std::unique_ptr<ImageTransferSessionVT> m_imageTransferSession;
 
-    IntSize m_requestedSize;
-    int32_t m_width { 0 };
-    int32_t m_height { 0 };
     int m_sensorOrientation { 0 };
     int m_deviceOrientation { 0 };
     MediaSample::VideoRotation m_sampleRotation { MediaSample::VideoRotation::None };

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (238052 => 238053)


--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm	2018-11-09 21:10:26 UTC (rev 238052)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm	2018-11-09 21:26:16 UTC (rev 238053)
@@ -331,8 +331,6 @@
 
     ASSERT(avPreset->format);
 
-    m_requestedSize = requestedSize;
-
     NSError *error = nil;
     [m_session beginConfiguration];
     @try {
@@ -474,8 +472,6 @@
 void AVVideoCaptureSource::shutdownCaptureSession()
 {
     m_buffer = nullptr;
-    m_width = 0;
-    m_height = 0;
 }
 
 void AVVideoCaptureSource::monitorOrientation(OrientationNotifier& notifier)
@@ -525,16 +521,6 @@
         return;
 
     m_buffer = &sample.get();
-    auto dimensions = roundedIntSize(sample->presentationSize());
-    if (m_sampleRotation == MediaSample::VideoRotation::Left || m_sampleRotation == MediaSample::VideoRotation::Right)
-        dimensions = { dimensions.height(), dimensions.width() };
-
-    if (dimensions.width() != m_width || dimensions.height() != m_height) {
-        m_width = dimensions.width();
-        m_height = dimensions.height();
-        setSize(dimensions);
-    }
-
     dispatchMediaSampleToObservers(WTFMove(sample));
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to