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 #include "webrtc/test/frame_generator.h" | 10 #include "webrtc/test/frame_generator.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 const int64_t pause_time_; | 232 const int64_t pause_time_; |
233 const size_t num_frames_; | 233 const size_t num_frames_; |
234 size_t current_frame_num_; | 234 size_t current_frame_num_; |
235 VideoFrame* current_source_frame_; | 235 VideoFrame* current_source_frame_; |
236 VideoFrame current_frame_; | 236 VideoFrame current_frame_; |
237 YuvFileGenerator file_generator_; | 237 YuvFileGenerator file_generator_; |
238 }; | 238 }; |
239 | 239 |
240 } // namespace | 240 } // namespace |
241 | 241 |
| 242 FrameForwarder::FrameForwarder() : sink_(nullptr) {} |
| 243 |
| 244 void FrameForwarder::IncomingCapturedFrame(const VideoFrame& video_frame) { |
| 245 rtc::CritScope lock(&crit_); |
| 246 if (sink_) |
| 247 sink_->OnFrame(video_frame); |
| 248 } |
| 249 |
| 250 void FrameForwarder::AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 251 const rtc::VideoSinkWants& wants) { |
| 252 rtc::CritScope lock(&crit_); |
| 253 RTC_DCHECK(!sink_ || sink_ == sink); |
| 254 sink_ = sink; |
| 255 } |
| 256 |
| 257 void FrameForwarder::RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) { |
| 258 rtc::CritScope lock(&crit_); |
| 259 RTC_DCHECK_EQ(sink, sink_); |
| 260 sink_ = nullptr; |
| 261 } |
| 262 |
242 FrameGenerator* FrameGenerator::CreateChromaGenerator(size_t width, | 263 FrameGenerator* FrameGenerator::CreateChromaGenerator(size_t width, |
243 size_t height) { | 264 size_t height) { |
244 return new ChromaGenerator(width, height); | 265 return new ChromaGenerator(width, height); |
245 } | 266 } |
246 | 267 |
247 FrameGenerator* FrameGenerator::CreateFromYuvFile( | 268 FrameGenerator* FrameGenerator::CreateFromYuvFile( |
248 std::vector<std::string> filenames, | 269 std::vector<std::string> filenames, |
249 size_t width, | 270 size_t width, |
250 size_t height, | 271 size_t height, |
251 int frame_repeat_count) { | 272 int frame_repeat_count) { |
(...skipping 25 matching lines...) Expand all Loading... |
277 files.push_back(file); | 298 files.push_back(file); |
278 } | 299 } |
279 | 300 |
280 return new ScrollingImageFrameGenerator( | 301 return new ScrollingImageFrameGenerator( |
281 clock, files, source_width, source_height, target_width, target_height, | 302 clock, files, source_width, source_height, target_width, target_height, |
282 scroll_time_ms, pause_time_ms); | 303 scroll_time_ms, pause_time_ms); |
283 } | 304 } |
284 | 305 |
285 } // namespace test | 306 } // namespace test |
286 } // namespace webrtc | 307 } // namespace webrtc |
OLD | NEW |