OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 void AndroidVideoCapturer::Stop() { | 146 void AndroidVideoCapturer::Stop() { |
147 LOG(LS_INFO) << " AndroidVideoCapturer::Stop "; | 147 LOG(LS_INFO) << " AndroidVideoCapturer::Stop "; |
148 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 148 RTC_CHECK(thread_checker_.CalledOnValidThread()); |
149 RTC_CHECK(running_); | 149 RTC_CHECK(running_); |
150 running_ = false; | 150 running_ = false; |
151 SetCaptureFormat(NULL); | 151 SetCaptureFormat(NULL); |
152 | 152 |
153 delegate_->Stop(); | 153 delegate_->Stop(); |
154 current_state_ = cricket::CS_STOPPED; | 154 current_state_ = cricket::CS_STOPPED; |
155 SetCaptureState(current_state_); | 155 SignalStateChange(this, current_state_); |
156 } | 156 } |
157 | 157 |
158 bool AndroidVideoCapturer::IsRunning() { | 158 bool AndroidVideoCapturer::IsRunning() { |
159 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 159 RTC_CHECK(thread_checker_.CalledOnValidThread()); |
160 return running_; | 160 return running_; |
161 } | 161 } |
162 | 162 |
163 bool AndroidVideoCapturer::GetPreferredFourccs(std::vector<uint32_t>* fourccs) { | 163 bool AndroidVideoCapturer::GetPreferredFourccs(std::vector<uint32_t>* fourccs) { |
164 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 164 RTC_CHECK(thread_checker_.CalledOnValidThread()); |
165 fourccs->push_back(cricket::FOURCC_YV12); | 165 fourccs->push_back(cricket::FOURCC_YV12); |
166 return true; | 166 return true; |
167 } | 167 } |
168 | 168 |
169 void AndroidVideoCapturer::OnCapturerStarted(bool success) { | 169 void AndroidVideoCapturer::OnCapturerStarted(bool success) { |
170 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 170 RTC_CHECK(thread_checker_.CalledOnValidThread()); |
171 cricket::CaptureState new_state = | 171 cricket::CaptureState new_state = |
172 success ? cricket::CS_RUNNING : cricket::CS_FAILED; | 172 success ? cricket::CS_RUNNING : cricket::CS_FAILED; |
173 if (new_state == current_state_) | 173 if (new_state == current_state_) |
174 return; | 174 return; |
175 current_state_ = new_state; | 175 current_state_ = new_state; |
176 SetCaptureState(new_state); | 176 |
| 177 // TODO(perkj): SetCaptureState can not be used since it posts to |thread_|. |
| 178 // But |thread_ | is currently just the thread that happened to create the |
| 179 // cricket::VideoCapturer. |
| 180 SignalStateChange(this, new_state); |
177 } | 181 } |
178 | 182 |
179 void AndroidVideoCapturer::OnIncomingFrame( | 183 void AndroidVideoCapturer::OnIncomingFrame( |
180 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, | 184 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, |
181 int rotation, | 185 int rotation, |
182 int64_t time_stamp) { | 186 int64_t time_stamp) { |
183 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 187 RTC_CHECK(thread_checker_.CalledOnValidThread()); |
184 frame_factory_->UpdateCapturedFrame(buffer, rotation, time_stamp); | 188 frame_factory_->UpdateCapturedFrame(buffer, rotation, time_stamp); |
185 SignalFrameCaptured(this, frame_factory_->GetCapturedFrame()); | 189 SignalFrameCaptured(this, frame_factory_->GetCapturedFrame()); |
186 frame_factory_->ClearCapturedFrame(); | 190 frame_factory_->ClearCapturedFrame(); |
(...skipping 10 matching lines...) Expand all Loading... |
197 | 201 |
198 bool AndroidVideoCapturer::GetBestCaptureFormat( | 202 bool AndroidVideoCapturer::GetBestCaptureFormat( |
199 const cricket::VideoFormat& desired, | 203 const cricket::VideoFormat& desired, |
200 cricket::VideoFormat* best_format) { | 204 cricket::VideoFormat* best_format) { |
201 // Delegate this choice to VideoCapturer.startCapture(). | 205 // Delegate this choice to VideoCapturer.startCapture(). |
202 *best_format = desired; | 206 *best_format = desired; |
203 return true; | 207 return true; |
204 } | 208 } |
205 | 209 |
206 } // namespace webrtc | 210 } // namespace webrtc |
OLD | NEW |