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

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 199cdff7538a42aafd901257dae07a394a9e974a..d3517782b7994d96595c4b62402980d5cc61016a 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 {
@@ -78,7 +80,8 @@ bool WebRtcVideoCapturerAdapter::GetBestCaptureFormat(
void WebRtcVideoCapturerAdapter::OnFrameCaptured(
const scoped_refptr<media::VideoFrame>& frame) {
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();
@@ -98,8 +101,12 @@ void WebRtcVideoCapturerAdapter::OnFrameCaptured(
// 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) {
+ webrtc::RefCountImpl<NativeHandleImpl>* handle =
Ami GONE FROM CHROMIUM 2014/05/12 19:59:12 no need for the intermediate variable?
wuchengli 2014/05/13 07:28:53 Done.
+ new webrtc::RefCountImpl<NativeHandleImpl>(frame.get());
+ captured_frame.handle = handle;
+ } else if (frame->format() != media::VideoFrame::I420 ||
+ frame->coded_size() != frame->visible_rect().size()) {
// Cropping and or switching UV planes is needed.
UpdateI420Buffer(frame);
captured_frame.data = buffer_;
« 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