Commit 587bef69 authored by mcasas's avatar mcasas Committed by Commit bot

WebRtcVideoCapturerAdapter mods for Texture-backed VideoFrames

Interestingly, it is very similar to
https://codereview.chromium.org/277943002 !

BUG=440843, 362521

Review URL: https://codereview.chromium.org/1093223006

Cr-Commit-Position: refs/heads/master@{#326872}
parent 930d5e7d
......@@ -119,6 +119,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 +141,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 +263,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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment