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

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

Issue 1093223006: WebRtcVideoCapturerAdapter mods for Texture-backed VideoFrames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 370de9ac29de9129055574a36d9129138e1f2b06..5cc44c8f31b828f906eb20859d4e94a104791eee 100644
--- a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc
+++ b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/memory/aligned_memory.h"
#include "base/trace_event/trace_event.h"
+#include "gpu/command_buffer/common/mailbox_holder.h"
magjed_chromium 2015/04/24 07:35:34 Why is this include needed?
mcasas 2015/04/24 18:34:29 Removed. (It was a remnant of intermediate PSs).
#include "media/base/video_frame.h"
#include "media/base/video_frame_pool.h"
#include "third_party/libjingle/source/talk/media/base/videoframefactory.h"
@@ -119,6 +120,15 @@ class WebRtcVideoCapturerAdapter::MediaVideoFrameFactory
DCHECK(input_frame == &captured_frame_);
DCHECK(frame_.get());
+ const int64_t timestamp_ns = frame_->timestamp().InMicroseconds() *
+ base::Time::kNanosecondsPerMicrosecond;
+
+ if (frame_->format() == media::VideoFrame::NATIVE_TEXTURE) {
+ return new cricket::WebRtcVideoFrame(
+ new rtc::RefCountedObject<VideoFrameWrapper>(frame_),
+ captured_frame_.elapsed_time, timestamp_ns);
+ }
+
// Create a centered cropped visible rect that preservers aspect ratio for
// cropped natural size.
gfx::Rect visible_rect = frame_->visible_rect();
@@ -132,9 +142,6 @@ class WebRtcVideoCapturerAdapter::MediaVideoFrameFactory
frame_, visible_rect, output_size,
base::Bind(&ReleaseOriginalFrame, frame_));
- const int64_t timestamp_ns = frame_->timestamp().InMicroseconds() *
- base::Time::kNanosecondsPerMicrosecond;
-
// If no scaling is needed, return a wrapped version of |frame_| directly.
if (video_frame->natural_size() == video_frame->visible_rect().size()) {
return new cricket::WebRtcVideoFrame(
@@ -257,10 +264,8 @@ void WebRtcVideoCapturerAdapter::OnFrameCaptured(
DCHECK(thread_checker_.CalledOnValidThread());
TRACE_EVENT0("video", "WebRtcVideoCapturerAdapter::OnFrameCaptured");
if (!(media::VideoFrame::I420 == frame->format() ||
- media::VideoFrame::YV12 == frame->format())) {
- // Some types of sources support textures as output. Since connecting
- // sources and sinks do not check the format, we need to just ignore
- // formats that we can not handle.
+ media::VideoFrame::YV12 == frame->format() ||
+ media::VideoFrame::NATIVE_TEXTURE == frame->format())) {
NOTREACHED();
return;
}
« 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