| 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 #ifndef WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ | 10 #ifndef WEBRTC_TEST_FRAME_GENERATOR_H_ |
| 11 #define WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ | 11 #define WEBRTC_TEST_FRAME_GENERATOR_H_ |
| 12 | 12 |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "webrtc/base/criticalsection.h" |
| 17 #include "webrtc/media/base/videosourceinterface.h" |
| 16 #include "webrtc/typedefs.h" | 18 #include "webrtc/typedefs.h" |
| 17 #include "webrtc/video_frame.h" | 19 #include "webrtc/video_frame.h" |
| 18 | 20 |
| 19 namespace webrtc { | 21 namespace webrtc { |
| 20 class Clock; | 22 class Clock; |
| 21 namespace test { | 23 namespace test { |
| 22 | 24 |
| 25 // FrameForwarder can be used as an implementation |
| 26 // of rtc::VideoSourceInterface<VideoFrame> where the caller controls when |
| 27 // a frame should be forwarded to its sink. |
| 28 // Currently this implementation only support one sink. |
| 29 class FrameForwarder : public rtc::VideoSourceInterface<VideoFrame> { |
| 30 public: |
| 31 FrameForwarder(); |
| 32 // Forwards |video_frame| to the registered |sink_|. |
| 33 void IncomingCapturedFrame(const VideoFrame& video_frame); |
| 34 |
| 35 private: |
| 36 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 37 const rtc::VideoSinkWants& wants) override; |
| 38 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override; |
| 39 |
| 40 rtc::CriticalSection crit_; |
| 41 rtc::VideoSinkInterface<VideoFrame>* sink_ GUARDED_BY(crit_); |
| 42 }; |
| 43 |
| 23 class FrameGenerator { | 44 class FrameGenerator { |
| 24 public: | 45 public: |
| 25 FrameGenerator() {} | 46 FrameGenerator() {} |
| 26 virtual ~FrameGenerator() {} | 47 virtual ~FrameGenerator() {} |
| 27 | 48 |
| 28 // Returns video frame that remains valid until next call. | 49 // Returns video frame that remains valid until next call. |
| 29 virtual VideoFrame* NextFrame() = 0; | 50 virtual VideoFrame* NextFrame() = 0; |
| 30 | 51 |
| 31 // Creates a test frame generator that creates fully saturated frames with | 52 // Creates a test frame generator that creates fully saturated frames with |
| 32 // varying U, V values over time. | 53 // varying U, V values over time. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 54 size_t source_width, | 75 size_t source_width, |
| 55 size_t source_height, | 76 size_t source_height, |
| 56 size_t target_width, | 77 size_t target_width, |
| 57 size_t target_height, | 78 size_t target_height, |
| 58 int64_t scroll_time_ms, | 79 int64_t scroll_time_ms, |
| 59 int64_t pause_time_ms); | 80 int64_t pause_time_ms); |
| 60 }; | 81 }; |
| 61 } // namespace test | 82 } // namespace test |
| 62 } // namespace webrtc | 83 } // namespace webrtc |
| 63 | 84 |
| 64 #endif // WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ | 85 #endif // WEBRTC_TEST_FRAME_GENERATOR_H_ |
| OLD | NEW |