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 SignalStateChange(this, current_state_); | 155 SetCaptureState(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 | 176 SetCaptureState(new_state); |
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); | |
181 } | 177 } |
182 | 178 |
183 void AndroidVideoCapturer::OnIncomingFrame( | 179 void AndroidVideoCapturer::OnIncomingFrame( |
184 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, | 180 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, |
185 int rotation, | 181 int rotation, |
186 int64_t time_stamp) { | 182 int64_t time_stamp) { |
187 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 183 RTC_CHECK(thread_checker_.CalledOnValidThread()); |
188 frame_factory_->UpdateCapturedFrame(buffer, rotation, time_stamp); | 184 frame_factory_->UpdateCapturedFrame(buffer, rotation, time_stamp); |
189 SignalFrameCaptured(this, frame_factory_->GetCapturedFrame()); | 185 SignalFrameCaptured(this, frame_factory_->GetCapturedFrame()); |
190 frame_factory_->ClearCapturedFrame(); | 186 frame_factory_->ClearCapturedFrame(); |
(...skipping 10 matching lines...) Expand all Loading... |
201 | 197 |
202 bool AndroidVideoCapturer::GetBestCaptureFormat( | 198 bool AndroidVideoCapturer::GetBestCaptureFormat( |
203 const cricket::VideoFormat& desired, | 199 const cricket::VideoFormat& desired, |
204 cricket::VideoFormat* best_format) { | 200 cricket::VideoFormat* best_format) { |
205 // Delegate this choice to VideoCapturer.startCapture(). | 201 // Delegate this choice to VideoCapturer.startCapture(). |
206 *best_format = desired; | 202 *best_format = desired; |
207 return true; | 203 return true; |
208 } | 204 } |
209 | 205 |
210 } // namespace webrtc | 206 } // namespace webrtc |
OLD | NEW |