| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 26 matching lines...) Expand all Loading... |
| 37 : capture_cs_(CriticalSectionWrapper::CreateCriticalSection()), | 37 : capture_cs_(CriticalSectionWrapper::CreateCriticalSection()), |
| 38 module_process_thread_(module_process_thread), | 38 module_process_thread_(module_process_thread), |
| 39 frame_callback_(frame_callback), | 39 frame_callback_(frame_callback), |
| 40 local_renderer_(local_renderer), | 40 local_renderer_(local_renderer), |
| 41 stats_proxy_(stats_proxy), | 41 stats_proxy_(stats_proxy), |
| 42 incoming_frame_cs_(CriticalSectionWrapper::CreateCriticalSection()), | 42 incoming_frame_cs_(CriticalSectionWrapper::CreateCriticalSection()), |
| 43 capture_thread_(ThreadWrapper::CreateThread(CaptureThreadFunction, | 43 capture_thread_(ThreadWrapper::CreateThread(CaptureThreadFunction, |
| 44 this, | 44 this, |
| 45 "CaptureThread")), | 45 "CaptureThread")), |
| 46 capture_event_(*EventWrapper::Create()), | 46 capture_event_(*EventWrapper::Create()), |
| 47 deliver_event_(*EventWrapper::Create()), | |
| 48 stop_(0), | 47 stop_(0), |
| 49 last_captured_timestamp_(0), | 48 last_captured_timestamp_(0), |
| 50 delta_ntp_internal_ms_( | 49 delta_ntp_internal_ms_( |
| 51 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() - | 50 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() - |
| 52 TickTime::MillisecondTimestamp()), | 51 TickTime::MillisecondTimestamp()), |
| 53 overuse_detector_(new OveruseFrameDetector(Clock::GetRealTimeClock(), | 52 overuse_detector_(new OveruseFrameDetector(Clock::GetRealTimeClock(), |
| 54 CpuOveruseOptions(), | 53 CpuOveruseOptions(), |
| 55 overuse_observer, | 54 overuse_observer, |
| 56 stats_proxy)) { | 55 stats_proxy)) { |
| 57 capture_thread_->Start(); | 56 capture_thread_->Start(); |
| 58 capture_thread_->SetPriority(kHighPriority); | 57 capture_thread_->SetPriority(kHighPriority); |
| 59 module_process_thread_->RegisterModule(overuse_detector_.get()); | 58 module_process_thread_->RegisterModule(overuse_detector_.get()); |
| 60 } | 59 } |
| 61 | 60 |
| 62 VideoCaptureInput::~VideoCaptureInput() { | 61 VideoCaptureInput::~VideoCaptureInput() { |
| 63 module_process_thread_->DeRegisterModule(overuse_detector_.get()); | 62 module_process_thread_->DeRegisterModule(overuse_detector_.get()); |
| 64 | 63 |
| 65 // Stop the thread. | 64 // Stop the thread. |
| 66 rtc::AtomicOps::ReleaseStore(&stop_, 1); | 65 rtc::AtomicOps::ReleaseStore(&stop_, 1); |
| 67 capture_event_.Set(); | 66 capture_event_.Set(); |
| 68 | 67 |
| 69 // Stop the camera input. | 68 // Stop the camera input. |
| 70 capture_thread_->Stop(); | 69 capture_thread_->Stop(); |
| 71 delete &capture_event_; | 70 delete &capture_event_; |
| 72 delete &deliver_event_; | |
| 73 } | 71 } |
| 74 | 72 |
| 75 void VideoCaptureInput::IncomingCapturedFrame(const VideoFrame& video_frame) { | 73 void VideoCaptureInput::IncomingCapturedFrame(const VideoFrame& video_frame) { |
| 76 // TODO(pbos): Remove local rendering, it should be handled by the client code | 74 // TODO(pbos): Remove local rendering, it should be handled by the client code |
| 77 // if required. | 75 // if required. |
| 78 if (local_renderer_) | 76 if (local_renderer_) |
| 79 local_renderer_->RenderFrame(video_frame, 0); | 77 local_renderer_->RenderFrame(video_frame, 0); |
| 80 | 78 |
| 81 stats_proxy_->OnIncomingFrame(video_frame.width(), video_frame.height()); | 79 stats_proxy_->OnIncomingFrame(video_frame.width(), video_frame.height()); |
| 82 | 80 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 153 } |
| 156 // We're done! | 154 // We're done! |
| 157 if (capture_time != -1) { | 155 if (capture_time != -1) { |
| 158 overuse_detector_->FrameSent(capture_time); | 156 overuse_detector_->FrameSent(capture_time); |
| 159 } | 157 } |
| 160 return true; | 158 return true; |
| 161 } | 159 } |
| 162 | 160 |
| 163 } // namespace internal | 161 } // namespace internal |
| 164 } // namespace webrtc | 162 } // namespace webrtc |
| OLD | NEW |