| 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 6689ddf81f9f025e3d2fd4a151ab804534b4b734..645fd10e7d01997ef03741b2518bd3aecaf41f53 100644
|
| --- a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc
|
| +++ b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc
|
| @@ -65,7 +65,10 @@ class VideoFrameWrapper : public webrtc::VideoFrameBuffer {
|
| return frame_->stride(WebRtcToMediaPlaneType(type));
|
| }
|
|
|
| - void* native_handle() const override { return nullptr; }
|
| + void* native_handle() const override {
|
| + return media::VideoFrame::IsMappable(frame_->storage_type()) ? nullptr
|
| + : frame_.get();
|
| + }
|
|
|
| ~VideoFrameWrapper() override {}
|
| friend class rtc::RefCountedObject<VideoFrameWrapper>;
|
| @@ -119,6 +122,17 @@ class WebRtcVideoCapturerAdapter::MediaVideoFrameFactory
|
| DCHECK(input_frame == &captured_frame_);
|
| DCHECK(frame_.get());
|
|
|
| + const int64_t timestamp_ns = frame_->timestamp().InMicroseconds() *
|
| + base::Time::kNanosecondsPerMicrosecond;
|
| +
|
| + // Return |frame_| directly if it is texture backed, because there is no
|
| + // cropping support for textures yet. See http://crbug/362521.
|
| + if (frame_->storage_type() == media::VideoFrame::STORAGE_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 +146,6 @@ class WebRtcVideoCapturerAdapter::MediaVideoFrameFactory
|
| video_frame->AddDestructionObserver(
|
| 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 +268,10 @@ 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::STORAGE_TEXTURE == frame->storage_type())) {
|
| + // Since connecting sources and sinks do not check the format, we need to
|
| + // just ignore formats that we can not handle.
|
| NOTREACHED();
|
| return;
|
| }
|
|
|