Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Unified Diff: content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc

Issue 277943002: Add texture support in WebrtcVideoCapturerAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698