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

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

Issue 212973002: Refactor VideoDestinationHandler to implement MediaStreamVideoSource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_capturer_adapter.h" 5 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/memory/aligned_memory.h" 9 #include "base/memory/aligned_memory.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
11 #include "third_party/libyuv/include/libyuv/convert.h" 11 #include "third_party/libyuv/include/libyuv/convert.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 WebRtcVideoCapturerAdapter::WebRtcVideoCapturerAdapter(bool is_screencast) 15 WebRtcVideoCapturerAdapter::WebRtcVideoCapturerAdapter(bool is_screencast)
16 : is_screencast_(is_screencast), 16 : is_screencast_(is_screencast),
17 running_(false), 17 running_(false),
18 buffer_(NULL), 18 buffer_(NULL),
19 buffer_size_(0) { 19 buffer_size_(0) {
20 } 20 }
21 21
22 WebRtcVideoCapturerAdapter::~WebRtcVideoCapturerAdapter() { 22 WebRtcVideoCapturerAdapter::~WebRtcVideoCapturerAdapter() {
23 DVLOG(3) << " WebRtcVideoCapturerAdapter::dtor"; 23 DVLOG(3) << " WebRtcVideoCapturerAdapter::dtor";
24 base::AlignedFree(buffer_); 24 base::AlignedFree(buffer_);
25 } 25 }
26 26
27 void WebRtcVideoCapturerAdapter::SetRequestedFormat(
28 const media::VideoCaptureFormat& format) {
29 DCHECK_EQ(media::PIXEL_FORMAT_I420, format.pixel_format);
30 DVLOG(3) << "WebRtcVideoCapturerAdapter::SetRequestedFormat"
31 << " w = " << format.frame_size.width()
32 << " h = " << format.frame_size.height();
33 cricket::VideoFormat supported_format(format.frame_size.width(),
34 format.frame_size.height(),
35 cricket::VideoFormat::FpsToInterval(
36 format.frame_rate),
37 cricket::FOURCC_I420);
38 SetCaptureFormat(&supported_format);
39
40 // Update the desired aspect ratio so that later the video frame can be
41 // cropped to meet the requirement if the camera returns a different
42 // resolution than the |request|.
43 UpdateAspectRatio(format.frame_size.width(), format.frame_size.height());
44 }
45
46 cricket::CaptureState WebRtcVideoCapturerAdapter::Start( 27 cricket::CaptureState WebRtcVideoCapturerAdapter::Start(
47 const cricket::VideoFormat& capture_format) { 28 const cricket::VideoFormat& capture_format) {
48 DCHECK(!running_); 29 DCHECK(!running_);
49 DVLOG(3) << " WebRtcVideoCapturerAdapter::Start w = " << capture_format.width 30 DVLOG(3) << " WebRtcVideoCapturerAdapter::Start w = " << capture_format.width
50 << " h = " << capture_format.height; 31 << " h = " << capture_format.height;
51 32
52 running_ = true; 33 running_ = true;
53 return cricket::CS_RUNNING; 34 return cricket::CS_RUNNING;
54 } 35 }
55 36
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 dst_stride_y, 166 dst_stride_y,
186 dst_u, 167 dst_u,
187 dst_halfwidth, 168 dst_halfwidth,
188 dst_v, 169 dst_v,
189 dst_halfwidth, 170 dst_halfwidth,
190 dst_width, 171 dst_width,
191 dst_height); 172 dst_height);
192 } 173 }
193 174
194 } // namespace content 175 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc/webrtc_video_capturer_adapter.h ('k') | content/renderer/pepper/pepper_video_destination_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698