Title: [216958] branches/safari-604.1.21-branch/Source

Diff

Modified: branches/safari-604.1.21-branch/Source/ThirdParty/libwebrtc/ChangeLog (216957 => 216958)


--- branches/safari-604.1.21-branch/Source/ThirdParty/libwebrtc/ChangeLog	2017-05-16 23:44:45 UTC (rev 216957)
+++ branches/safari-604.1.21-branch/Source/ThirdParty/libwebrtc/ChangeLog	2017-05-16 23:44:48 UTC (rev 216958)
@@ -1,3 +1,17 @@
+2017-05-16  Jason Marcell  <jmarc...@apple.com>
+
+        Cherry-pick r216947. rdar://problem/32200017
+
+    2017-05-16  Youenn Fablet  <you...@apple.com>
+
+            RealtimeOutgoingVideoSource should support sinkWants for rotation
+            https://bugs.webkit.org/show_bug.cgi?id=172123
+            <rdar://problem/32200017>
+
+            Reviewed by Eric Carlson.
+
+            * Source/webrtc/api/video/i420_buffer.h: Exporting rotate routine.
+
 2017-05-10  Jason Marcell  <jmarc...@apple.com>
 
         Cherry-pick r216436. rdar://problem/32041544

Modified: branches/safari-604.1.21-branch/Source/ThirdParty/libwebrtc/Source/webrtc/api/video/i420_buffer.h (216957 => 216958)


--- branches/safari-604.1.21-branch/Source/ThirdParty/libwebrtc/Source/webrtc/api/video/i420_buffer.h	2017-05-16 23:44:45 UTC (rev 216957)
+++ branches/safari-604.1.21-branch/Source/ThirdParty/libwebrtc/Source/webrtc/api/video/i420_buffer.h	2017-05-16 23:44:48 UTC (rev 216958)
@@ -40,7 +40,7 @@
       const uint8_t* data_v, int stride_v);
 
   // Returns a rotated copy of |src|.
-  static rtc::scoped_refptr<I420Buffer> Rotate(const VideoFrameBuffer& src,
+  WEBRTC_DYLIB_EXPORT static rtc::scoped_refptr<I420Buffer> Rotate(const VideoFrameBuffer& src,
                                                VideoRotation rotation);
 
   // Sets the buffer to all black.

Modified: branches/safari-604.1.21-branch/Source/WebCore/ChangeLog (216957 => 216958)


--- branches/safari-604.1.21-branch/Source/WebCore/ChangeLog	2017-05-16 23:44:45 UTC (rev 216957)
+++ branches/safari-604.1.21-branch/Source/WebCore/ChangeLog	2017-05-16 23:44:48 UTC (rev 216958)
@@ -1,5 +1,24 @@
 2017-05-16  Jason Marcell  <jmarc...@apple.com>
 
+        Cherry-pick r216947. rdar://problem/32200017
+
+    2017-05-16  Youenn Fablet  <you...@apple.com>
+
+            RealtimeOutgoingVideoSource should support sinkWants for rotation
+            https://bugs.webkit.org/show_bug.cgi?id=172123
+            <rdar://problem/32200017>
+
+            Reviewed by Eric Carlson.
+
+            Covered by manual testing.
+
+            * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
+            (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): Triggering pixel rotation based on sink.
+            (WebCore::RealtimeOutgoingVideoSource::sendFrame): Doing the rotation using libwebrtc API.
+            * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
+
+2017-05-16  Jason Marcell  <jmarc...@apple.com>
+
         Cherry-pick r216892. rdar://problem/31513869
 
     2017-05-15  Youenn Fablet  <you...@apple.com>

Modified: branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp (216957 => 216958)


--- branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp	2017-05-16 23:44:45 UTC (rev 216957)
+++ branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp	2017-05-16 23:44:48 UTC (rev 216958)
@@ -31,6 +31,7 @@
 
 #if USE(LIBWEBRTC)
 
+#include <webrtc/api/video/i420_buffer.h>
 #include <webrtc/common_video/include/corevideo_frame_buffer.h>
 #include <webrtc/common_video/libyuv/include/webrtc_libyuv.h>
 #include <webrtc/media/base/videoframe.h>
@@ -117,9 +118,13 @@
     return false;
 }
 
-void RealtimeOutgoingVideoSource::AddOrUpdateSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink, const rtc::VideoSinkWants&)
+void RealtimeOutgoingVideoSource::AddOrUpdateSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink, const rtc::VideoSinkWants& sinkWants)
 {
-    // FIXME: support sinkWants
+    ASSERT(!sinkWants.black_frames);
+
+    if (sinkWants.rotation_applied)
+        m_shouldApplyRotation = true;
+
     if (!m_sinks.contains(sink))
         m_sinks.append(sink);
 }
@@ -147,6 +152,12 @@
 
 void RealtimeOutgoingVideoSource::sendFrame(rtc::scoped_refptr<webrtc::VideoFrameBuffer>&& buffer)
 {
+    // FIXME: We should make AVVideoCaptureSource handle the rotation whenever possible.
+    if (m_shouldApplyRotation && m_currentRotation != webrtc::kVideoRotation_0) {
+        // This implementation is inefficient, we should rotate on the CMSampleBuffer directly instead of doing this double allocation.
+        buffer = buffer->NativeToI420Buffer();
+        buffer = webrtc::I420Buffer::Rotate(*buffer, m_currentRotation);
+    }
     webrtc::VideoFrame frame(buffer, 0, 0, m_currentRotation);
     for (auto* sink : m_sinks)
         sink->OnFrame(frame);

Modified: branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h (216957 => 216958)


--- branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h	2017-05-16 23:44:45 UTC (rev 216957)
+++ branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h	2017-05-16 23:44:48 UTC (rev 216958)
@@ -97,6 +97,7 @@
     bool m_isStopped { false };
     Timer m_blackFrameTimer;
     rtc::scoped_refptr<webrtc::VideoFrameBuffer> m_blackFrame;
+    bool m_shouldApplyRotation { false };
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to