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

Side by Side Diff: content/renderer/media/media_stream_video_capturer_source.cc

Issue 197213004: Fix DCHECK error when invalid video constraints are set on gUM. If a video constraint can not be me… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 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/media_stream_video_capturer_source.h" 5 #include "content/renderer/media/media_stream_video_capturer_source.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 "content/renderer/media/video_capture_impl_manager.h" 9 #include "content/renderer/media/video_capture_impl_manager.h"
10 #include "content/renderer/render_thread_impl.h" 10 #include "content/renderer/render_thread_impl.h"
(...skipping 26 matching lines...) Expand all
37 const StreamDeviceInfo& device_info) 37 const StreamDeviceInfo& device_info)
38 : session_id_(device_info.session_id), 38 : session_id_(device_info.session_id),
39 capture_engine_( 39 capture_engine_(
40 RenderThreadImpl::current()->video_capture_impl_manager() 40 RenderThreadImpl::current()->video_capture_impl_manager()
41 ->UseDevice(device_info.session_id)), 41 ->UseDevice(device_info.session_id)),
42 is_screen_cast_(device_info.device.type == MEDIA_TAB_VIDEO_CAPTURE || 42 is_screen_cast_(device_info.device.type == MEDIA_TAB_VIDEO_CAPTURE ||
43 device_info.device.type == MEDIA_DESKTOP_VIDEO_CAPTURE), 43 device_info.device.type == MEDIA_DESKTOP_VIDEO_CAPTURE),
44 got_first_frame_(false) { 44 got_first_frame_(false) {
45 DVLOG(3) << "VideoCapturerDelegate::ctor"; 45 DVLOG(3) << "VideoCapturerDelegate::ctor";
46 DCHECK(capture_engine_); 46 DCHECK(capture_engine_);
47 message_loop_proxy_ = base::MessageLoopProxy::current();
no longer working on chromium 2014/03/13 09:29:12 move it up to the initializer.
47 } 48 }
48 49
49 VideoCapturerDelegate::~VideoCapturerDelegate() { 50 VideoCapturerDelegate::~VideoCapturerDelegate() {
50 DVLOG(3) << "VideoCapturerDelegate::dtor"; 51 DVLOG(3) << "VideoCapturerDelegate::dtor";
51 DCHECK(new_frame_callback_.is_null()); 52 DCHECK(new_frame_callback_.is_null());
52 } 53 }
53 54
54 void VideoCapturerDelegate::GetCurrentSupportedFormats( 55 void VideoCapturerDelegate::GetCurrentSupportedFormats(
55 int max_requested_width, 56 int max_requested_width,
56 int max_requested_height, 57 int max_requested_height,
(...skipping 29 matching lines...) Expand all
86 media::PIXEL_FORMAT_I420)); 87 media::PIXEL_FORMAT_I420));
87 } 88 }
88 callback.Run(formats); 89 callback.Run(formats);
89 } 90 }
90 91
91 void VideoCapturerDelegate::StartDeliver( 92 void VideoCapturerDelegate::StartDeliver(
92 const media::VideoCaptureParams& params, 93 const media::VideoCaptureParams& params,
93 const NewFrameCallback& new_frame_callback, 94 const NewFrameCallback& new_frame_callback,
94 const StartedCallback& started_callback) { 95 const StartedCallback& started_callback) {
95 DCHECK(params.requested_format.IsValid()); 96 DCHECK(params.requested_format.IsValid());
96 message_loop_proxy_ = base::MessageLoopProxy::current(); 97 DCHECK(message_loop_proxy_ == base::MessageLoopProxy::current());
97 new_frame_callback_ = new_frame_callback; 98 new_frame_callback_ = new_frame_callback;
98 started_callback_ = started_callback; 99 started_callback_ = started_callback;
99 got_first_frame_ = false; 100 got_first_frame_ = false;
100 101
101 // Increase the reference count to ensure the object is not deleted until 102 // Increase the reference count to ensure the object is not deleted until
102 // it is unregistered in VideoCapturerDelegate::OnRemoved. 103 // it is unregistered in VideoCapturerDelegate::OnRemoved.
103 AddRef(); 104 AddRef();
104 capture_engine_->StartCapture(this, params); 105 capture_engine_->StartCapture(this, params);
105 } 106 }
106 107
(...skipping 10 matching lines...) Expand all
117 DVLOG(3) << "VideoCapturerDelegate::OnStarted"; 118 DVLOG(3) << "VideoCapturerDelegate::OnStarted";
118 } 119 }
119 120
120 void VideoCapturerDelegate::OnStopped(media::VideoCapture* capture) { 121 void VideoCapturerDelegate::OnStopped(media::VideoCapture* capture) {
121 } 122 }
122 123
123 void VideoCapturerDelegate::OnPaused(media::VideoCapture* capture) { 124 void VideoCapturerDelegate::OnPaused(media::VideoCapture* capture) {
124 } 125 }
125 126
126 void VideoCapturerDelegate::OnError(media::VideoCapture* capture, 127 void VideoCapturerDelegate::OnError(media::VideoCapture* capture,
127 int error_code) { 128 int error_code) {
128 DVLOG(3) << "VideoCapturerDelegate::OnError"; 129 DVLOG(3) << "VideoCapturerDelegate::OnError";
129 message_loop_proxy_->PostTask( 130 message_loop_proxy_->PostTask(
130 FROM_HERE, 131 FROM_HERE,
131 base::Bind(&VideoCapturerDelegate::OnErrorOnCaptureThread, 132 base::Bind(&VideoCapturerDelegate::OnErrorOnCaptureThread,
132 this, capture)); 133 this, capture));
133 } 134 }
134 135
135 void VideoCapturerDelegate::OnRemoved(media::VideoCapture* capture) { 136 void VideoCapturerDelegate::OnRemoved(media::VideoCapture* capture) {
136 DVLOG(3) << " MediaStreamVideoCapturerSource::OnRemoved"; 137 DVLOG(3) << " MediaStreamVideoCapturerSource::OnRemoved";
137 138
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 base::Unretained(this)), 205 base::Unretained(this)),
205 base::Bind(&MediaStreamVideoCapturerSource::OnStartDone, 206 base::Bind(&MediaStreamVideoCapturerSource::OnStartDone,
206 base::Unretained(this))); 207 base::Unretained(this)));
207 } 208 }
208 209
209 void MediaStreamVideoCapturerSource::StopSourceImpl() { 210 void MediaStreamVideoCapturerSource::StopSourceImpl() {
210 delegate_->StopDeliver(); 211 delegate_->StopDeliver();
211 } 212 }
212 213
213 } // namespace content 214 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698