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

Side by Side Diff: content/renderer/media/webrtc/webrtc_video_sink_adapter.cc

Issue 213253005: Use texture-backed VideoFrane pipeline for Aura desktop capturing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 51d44e02 Initial. Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webrtc/webrtc_video_sink_adapter.h" 5 #include "content/renderer/media/webrtc/webrtc_video_sink_adapter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 void WebRtcVideoSinkAdapter::SetSize(int width, int height) { 44 void WebRtcVideoSinkAdapter::SetSize(int width, int height) {
45 } 45 }
46 46
47 void WebRtcVideoSinkAdapter::RenderFrame(const cricket::VideoFrame* frame) { 47 void WebRtcVideoSinkAdapter::RenderFrame(const cricket::VideoFrame* frame) {
48 base::TimeDelta timestamp = base::TimeDelta::FromMilliseconds( 48 base::TimeDelta timestamp = base::TimeDelta::FromMilliseconds(
49 frame->GetTimeStamp() / talk_base::kNumNanosecsPerMillisec); 49 frame->GetTimeStamp() / talk_base::kNumNanosecsPerMillisec);
50 50
51 scoped_refptr<media::VideoFrame> video_frame; 51 scoped_refptr<media::VideoFrame> video_frame;
52 if (frame->GetNativeHandle() != NULL) { 52 if (frame->GetNativeHandle() != NULL) {
53 NativeHandleImpl* handle = 53 video_frame = static_cast<media::VideoFrame*>(frame->GetNativeHandle());
54 static_cast<NativeHandleImpl*>(frame->GetNativeHandle());
55 video_frame = static_cast<media::VideoFrame*>(handle->GetHandle());
56 video_frame->SetTimestamp(timestamp); 54 video_frame->SetTimestamp(timestamp);
57 } else { 55 } else {
58 gfx::Size size(frame->GetWidth(), frame->GetHeight()); 56 gfx::Size size(frame->GetWidth(), frame->GetHeight());
59 video_frame = media::VideoFrame::CreateFrame( 57 video_frame = media::VideoFrame::CreateFrame(
60 media::VideoFrame::YV12, size, gfx::Rect(size), size, timestamp); 58 media::VideoFrame::YV12, size, gfx::Rect(size), size, timestamp);
61 59
62 // Aspect ratio unsupported; DCHECK when there are non-square pixels. 60 // Aspect ratio unsupported; DCHECK when there are non-square pixels.
63 DCHECK_EQ(frame->GetPixelWidth(), 1u); 61 DCHECK_EQ(frame->GetPixelWidth(), 1u);
64 DCHECK_EQ(frame->GetPixelHeight(), 1u); 62 DCHECK_EQ(frame->GetPixelHeight(), 1u);
65 63
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 107 }
110 } 108 }
111 109
112 void WebRtcVideoSinkAdapter::DoRenderFrameOnMainThread( 110 void WebRtcVideoSinkAdapter::DoRenderFrameOnMainThread(
113 scoped_refptr<media::VideoFrame> video_frame) { 111 scoped_refptr<media::VideoFrame> video_frame) {
114 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); 112 DCHECK(message_loop_proxy_->BelongsToCurrentThread());
115 sink_->OnVideoFrame(video_frame); 113 sink_->OnVideoFrame(video_frame);
116 } 114 }
117 115
118 } // namespace content 116 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698