OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/rtc_video_capture_delegate.h" | 5 #include "content/renderer/media/rtc_video_capture_delegate.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | |
9 #include "content/renderer/media/video_capture_impl_manager.h" | |
10 #include "content/renderer/render_thread_impl.h" | |
8 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
9 | 12 |
10 namespace content { | 13 namespace content { |
11 | 14 |
12 RtcVideoCaptureDelegate::RtcVideoCaptureDelegate( | 15 RtcVideoCaptureDelegate::RtcVideoCaptureDelegate( |
13 const media::VideoCaptureSessionId id, | 16 const media::VideoCaptureSessionId id) |
14 VideoCaptureImplManager* vc_manager) | |
15 : session_id_(id), | 17 : session_id_(id), |
16 vc_manager_(vc_manager), | |
17 capture_engine_(NULL), | |
18 got_first_frame_(false), | 18 got_first_frame_(false), |
19 error_occured_(false) { | 19 error_occured_(false) { |
20 DVLOG(3) << " RtcVideoCaptureDelegate::ctor"; | 20 DVLOG(3) << " RtcVideoCaptureDelegate::ctor"; |
21 capture_engine_ = vc_manager_->AddDevice(session_id_, this); | 21 capture_engine_ = |
22 RenderThreadImpl::current()->video_capture_impl_manager() | |
wjia(left Chromium)
2013/12/28 02:42:32
Using RenderThreadImpl::current() will complicate
Alpha Left Google
2014/01/02 23:35:16
I think this object is created on the render threa
wjia(left Chromium)
2014/01/06 19:17:23
That's not my understanding. There is no restricti
Ami GONE FROM CHROMIUM
2014/01/06 23:37:14
My opinion: using RTI this way (instead of injecti
perkj_chrome
2014/01/07 06:21:44
Good to know when RTI is ok to use and when not. I
| |
23 ->UseDevice(session_id_); | |
22 } | 24 } |
23 | 25 |
24 RtcVideoCaptureDelegate::~RtcVideoCaptureDelegate() { | 26 RtcVideoCaptureDelegate::~RtcVideoCaptureDelegate() { |
Ami GONE FROM CHROMIUM
2014/01/06 23:37:14
This silently relies on class-member-destruction o
Alpha Left Google
2014/01/08 00:23:36
I'm calling StopCapture() here such that it explic
| |
25 DVLOG(3) << " RtcVideoCaptureDelegate::dtor"; | 27 DVLOG(3) << " RtcVideoCaptureDelegate::dtor"; |
26 vc_manager_->RemoveDevice(session_id_, this); | |
27 } | 28 } |
28 | 29 |
29 void RtcVideoCaptureDelegate::StartCapture( | 30 void RtcVideoCaptureDelegate::StartCapture( |
30 const media::VideoCaptureParams& params, | 31 const media::VideoCaptureParams& params, |
31 const FrameCapturedCallback& captured_callback, | 32 const FrameCapturedCallback& captured_callback, |
32 const StateChangeCallback& state_callback) { | 33 const StateChangeCallback& state_callback) { |
33 DVLOG(3) << " RtcVideoCaptureDelegate::StartCapture "; | 34 DVLOG(3) << " RtcVideoCaptureDelegate::StartCapture "; |
34 message_loop_proxy_ = base::MessageLoopProxy::current(); | 35 message_loop_proxy_ = base::MessageLoopProxy::current(); |
35 captured_callback_ = captured_callback; | 36 captured_callback_ = captured_callback; |
36 state_callback_ = state_callback; | 37 state_callback_ = state_callback; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 } | 116 } |
116 | 117 |
117 | 118 |
118 void RtcVideoCaptureDelegate::OnRemovedOnCaptureThread( | 119 void RtcVideoCaptureDelegate::OnRemovedOnCaptureThread( |
119 media::VideoCapture* capture) { | 120 media::VideoCapture* capture) { |
120 if (!error_occured_ && !state_callback_.is_null()) | 121 if (!error_occured_ && !state_callback_.is_null()) |
121 state_callback_.Run(CAPTURE_STOPPED); | 122 state_callback_.Run(CAPTURE_STOPPED); |
122 } | 123 } |
123 | 124 |
124 } // namespace content | 125 } // namespace content |
OLD | NEW |