Title: [216947] trunk/Source
- Revision
- 216947
- Author
- commit-qu...@webkit.org
- Date
- 2017-05-16 14:18:19 -0700 (Tue, 16 May 2017)
Log Message
RealtimeOutgoingVideoSource should support sinkWants for rotation
https://bugs.webkit.org/show_bug.cgi?id=172123
<rdar://problem/32200017>
Patch by Youenn Fablet <you...@apple.com> on 2017-05-16
Reviewed by Eric Carlson.
Source/ThirdParty/libwebrtc:
* Source/webrtc/api/video/i420_buffer.h: Exporting rotate routine.
Source/WebCore:
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:
Modified Paths
Diff
Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (216946 => 216947)
--- trunk/Source/ThirdParty/libwebrtc/ChangeLog 2017-05-16 21:16:51 UTC (rev 216946)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog 2017-05-16 21:18:19 UTC (rev 216947)
@@ -1,3 +1,13 @@
+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-08 Youenn Fablet <you...@apple.com>
TURNS gathering is not working properly
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/api/video/i420_buffer.h (216946 => 216947)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/api/video/i420_buffer.h 2017-05-16 21:16:51 UTC (rev 216946)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/api/video/i420_buffer.h 2017-05-16 21:18:19 UTC (rev 216947)
@@ -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: trunk/Source/WebCore/ChangeLog (216946 => 216947)
--- trunk/Source/WebCore/ChangeLog 2017-05-16 21:16:51 UTC (rev 216946)
+++ trunk/Source/WebCore/ChangeLog 2017-05-16 21:18:19 UTC (rev 216947)
@@ -1,3 +1,18 @@
+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 Myles C. Maxfield <mmaxfi...@apple.com>
REGRESSION(r212513): LastResort is platform-dependent, so its semantics should not be required to perform font loading correctly.
Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp (216946 => 216947)
--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp 2017-05-16 21:16:51 UTC (rev 216946)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp 2017-05-16 21:18:19 UTC (rev 216947)
@@ -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: trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h (216946 => 216947)
--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h 2017-05-16 21:16:51 UTC (rev 216946)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h 2017-05-16 21:18:19 UTC (rev 216947)
@@ -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