| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
| 11 #include "webrtc/test/frame_generator_capturer.h" | 11 #include "webrtc/test/frame_generator_capturer.h" |
| 12 | 12 |
| 13 #include "webrtc/base/criticalsection.h" | 13 #include "webrtc/base/criticalsection.h" |
| 14 #include "webrtc/test/frame_generator.h" | 14 #include "webrtc/base/platform_thread.h" |
| 15 #include "webrtc/system_wrappers/include/clock.h" | 15 #include "webrtc/system_wrappers/include/clock.h" |
| 16 #include "webrtc/system_wrappers/include/event_wrapper.h" | 16 #include "webrtc/system_wrappers/include/event_wrapper.h" |
| 17 #include "webrtc/system_wrappers/include/sleep.h" | 17 #include "webrtc/system_wrappers/include/sleep.h" |
| 18 #include "webrtc/system_wrappers/include/thread_wrapper.h" | 18 #include "webrtc/test/frame_generator.h" |
| 19 #include "webrtc/video_send_stream.h" | 19 #include "webrtc/video_send_stream.h" |
| 20 | 20 |
| 21 namespace webrtc { | 21 namespace webrtc { |
| 22 namespace test { | 22 namespace test { |
| 23 | 23 |
| 24 FrameGeneratorCapturer* FrameGeneratorCapturer::Create(VideoCaptureInput* input, | 24 FrameGeneratorCapturer* FrameGeneratorCapturer::Create(VideoCaptureInput* input, |
| 25 size_t width, | 25 size_t width, |
| 26 size_t height, | 26 size_t height, |
| 27 int target_fps, | 27 int target_fps, |
| 28 Clock* clock) { | 28 Clock* clock) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool FrameGeneratorCapturer::Init() { | 83 bool FrameGeneratorCapturer::Init() { |
| 84 // This check is added because frame_generator_ might be file based and should | 84 // This check is added because frame_generator_ might be file based and should |
| 85 // not crash because a file moved. | 85 // not crash because a file moved. |
| 86 if (frame_generator_.get() == NULL) | 86 if (frame_generator_.get() == NULL) |
| 87 return false; | 87 return false; |
| 88 | 88 |
| 89 if (!tick_->StartTimer(true, 1000 / target_fps_)) | 89 if (!tick_->StartTimer(true, 1000 / target_fps_)) |
| 90 return false; | 90 return false; |
| 91 thread_ = ThreadWrapper::CreateThread(FrameGeneratorCapturer::Run, this, | 91 thread_ = PlatformThread::CreateThread(FrameGeneratorCapturer::Run, this, |
| 92 "FrameGeneratorCapturer"); | 92 "FrameGeneratorCapturer"); |
| 93 if (thread_.get() == NULL) | 93 if (thread_.get() == NULL) |
| 94 return false; | 94 return false; |
| 95 if (!thread_->Start()) { | 95 if (!thread_->Start()) { |
| 96 thread_.reset(); | 96 thread_.reset(); |
| 97 return false; | 97 return false; |
| 98 } | 98 } |
| 99 thread_->SetPriority(webrtc::kHighPriority); | 99 thread_->SetPriority(webrtc::kHighPriority); |
| 100 return true; | 100 return true; |
| 101 } | 101 } |
| 102 | 102 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 128 void FrameGeneratorCapturer::Stop() { | 128 void FrameGeneratorCapturer::Stop() { |
| 129 rtc::CritScope cs(&lock_); | 129 rtc::CritScope cs(&lock_); |
| 130 sending_ = false; | 130 sending_ = false; |
| 131 } | 131 } |
| 132 | 132 |
| 133 void FrameGeneratorCapturer::ForceFrame() { | 133 void FrameGeneratorCapturer::ForceFrame() { |
| 134 tick_->Set(); | 134 tick_->Set(); |
| 135 } | 135 } |
| 136 } // test | 136 } // test |
| 137 } // webrtc | 137 } // webrtc |
| OLD | NEW |