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_TEST_FRAME_GENERATOR_H_ | 10 #ifndef WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ |
11 #define WEBRTC_TEST_FRAME_GENERATOR_H_ | 11 #define WEBRTC_COMMON_VIDEO_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" | |
18 #include "webrtc/typedefs.h" | 16 #include "webrtc/typedefs.h" |
19 #include "webrtc/video_frame.h" | 17 #include "webrtc/video_frame.h" |
20 | 18 |
21 namespace webrtc { | 19 namespace webrtc { |
22 class Clock; | 20 class Clock; |
23 namespace test { | 21 namespace test { |
24 | 22 |
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 | |
44 class FrameGenerator { | 23 class FrameGenerator { |
45 public: | 24 public: |
46 FrameGenerator() {} | 25 FrameGenerator() {} |
47 virtual ~FrameGenerator() {} | 26 virtual ~FrameGenerator() {} |
48 | 27 |
49 // Returns video frame that remains valid until next call. | 28 // Returns video frame that remains valid until next call. |
50 virtual VideoFrame* NextFrame() = 0; | 29 virtual VideoFrame* NextFrame() = 0; |
51 | 30 |
52 // Creates a test frame generator that creates fully saturated frames with | 31 // Creates a test frame generator that creates fully saturated frames with |
53 // varying U, V values over time. | 32 // varying U, V values over time. |
(...skipping 21 matching lines...) Expand all Loading... |
75 size_t source_width, | 54 size_t source_width, |
76 size_t source_height, | 55 size_t source_height, |
77 size_t target_width, | 56 size_t target_width, |
78 size_t target_height, | 57 size_t target_height, |
79 int64_t scroll_time_ms, | 58 int64_t scroll_time_ms, |
80 int64_t pause_time_ms); | 59 int64_t pause_time_ms); |
81 }; | 60 }; |
82 } // namespace test | 61 } // namespace test |
83 } // namespace webrtc | 62 } // namespace webrtc |
84 | 63 |
85 #endif // WEBRTC_TEST_FRAME_GENERATOR_H_ | 64 #endif // WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ |
OLD | NEW |