Index: content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
diff --git a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
index eb56669612e19bb62aa1f7fa7885c98298d44234..1582cd60ab19f6e56c23716c9e7fafdfb2aa1596 100644 |
--- a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
+++ b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
@@ -7,8 +7,10 @@ |
#include "base/bind.h" |
#include "base/debug/trace_event.h" |
#include "base/memory/aligned_memory.h" |
+#include "content/renderer/media/native_handle_impl.h" |
#include "media/base/video_frame.h" |
#include "third_party/libyuv/include/libyuv/convert.h" |
+#include "third_party/webrtc/system_wrappers/interface/ref_count.h" |
namespace content { |
@@ -85,7 +87,8 @@ void WebRtcVideoCapturerAdapter::OnFrameCaptured( |
const scoped_refptr<media::VideoFrame>& frame) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
DCHECK(media::VideoFrame::I420 == frame->format() || |
- media::VideoFrame::YV12 == frame->format()); |
+ media::VideoFrame::YV12 == frame->format() || |
+ media::VideoFrame::NATIVE_TEXTURE == frame->format()); |
if (first_frame_timestamp_ == media::kNoTimestamp()) |
first_frame_timestamp_ = frame->timestamp(); |
@@ -101,13 +104,16 @@ void WebRtcVideoCapturerAdapter::OnFrameCaptured( |
captured_frame.pixel_height = 1; |
captured_frame.pixel_width = 1; |
- // TODO(perkj): |
- // Libjingle expects contiguous layout of image planes as input. |
- // The only format where that is true in Chrome is I420 where the |
- // coded_size == visible_rect().size(). |
- if (frame->format() != media::VideoFrame::I420 || |
- frame->coded_size() != frame->visible_rect().size()) { |
+ if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) { |
+ captured_frame.handle = |
+ new webrtc::RefCountImpl<NativeHandleImpl>(frame.get()); |
+ } else if (frame->format() != media::VideoFrame::I420 || |
+ frame->coded_size() != frame->visible_rect().size()) { |
// Cropping and or switching UV planes is needed. |
+ // TODO(perkj): |
+ // Libjingle expects contiguous layout of image planes as input. |
+ // The only format where that is true in Chrome is I420 where the |
+ // coded_size == visible_rect().size(). |
UpdateI420Buffer(frame); |
captured_frame.data = buffer_; |
captured_frame.data_size = buffer_size_; |