Chromium Code Reviews| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 SetCaptureState(new_state); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void AndroidVideoCapturer::OnIncomingFrame( | 179 void AndroidVideoCapturer::OnIncomingFrame( |
| 180 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, | 180 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, |
| 181 int rotation, | 181 int rotation, |
| 182 int64_t time_stamp) { | 182 int64_t time_stamp) { |
| 183 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 183 // NOTE: The frame_factory hack isn't thread safe. It works because |
|
pbos-webrtc
2016/05/20 13:22:47
Should there be a TODO here?
nisse-webrtc
2016/05/20 13:32:26
I have a different cl which deletes that frame fac
| |
| 184 // all calls to this method are from the same Java thread. In | |
| 185 // addition, calls are currently syncronized on the caller's | |
| 186 // AndroidVideoCapturerJni:capturer_lock_. | |
| 184 frame_factory_->UpdateCapturedFrame(buffer, rotation, time_stamp); | 187 frame_factory_->UpdateCapturedFrame(buffer, rotation, time_stamp); |
| 185 SignalFrameCaptured(this, frame_factory_->GetCapturedFrame()); | 188 SignalFrameCaptured(this, frame_factory_->GetCapturedFrame()); |
| 186 frame_factory_->ClearCapturedFrame(); | 189 frame_factory_->ClearCapturedFrame(); |
| 187 } | 190 } |
| 188 | 191 |
| 189 void AndroidVideoCapturer::OnOutputFormatRequest( | 192 void AndroidVideoCapturer::OnOutputFormatRequest( |
| 190 int width, int height, int fps) { | 193 int width, int height, int fps) { |
| 191 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 194 RTC_CHECK(thread_checker_.CalledOnValidThread()); |
| 192 cricket::VideoFormat format(width, height, | 195 cricket::VideoFormat format(width, height, |
| 193 cricket::VideoFormat::FpsToInterval(fps), 0); | 196 cricket::VideoFormat::FpsToInterval(fps), 0); |
| 194 video_adapter()->OnOutputFormatRequest(format); | 197 video_adapter()->OnOutputFormatRequest(format); |
| 195 } | 198 } |
| 196 | 199 |
| 197 bool AndroidVideoCapturer::GetBestCaptureFormat( | 200 bool AndroidVideoCapturer::GetBestCaptureFormat( |
| 198 const cricket::VideoFormat& desired, | 201 const cricket::VideoFormat& desired, |
| 199 cricket::VideoFormat* best_format) { | 202 cricket::VideoFormat* best_format) { |
| 200 // Delegate this choice to VideoCapturer.startCapture(). | 203 // Delegate this choice to VideoCapturer.startCapture(). |
| 201 *best_format = desired; | 204 *best_format = desired; |
| 202 return true; | 205 return true; |
| 203 } | 206 } |
| 204 | 207 |
| 205 } // namespace webrtc | 208 } // namespace webrtc |
| OLD | NEW |