Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Side by Side Diff: webrtc/test/frame_generator_capturer.h

Issue 2304363002: Let ViEEncoder express resolution requests as Sinkwants (Closed)
Patch Set: Rebased. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/test/frame_generator.cc ('k') | webrtc/test/frame_generator_capturer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CAPTURER_H_ 10 #ifndef WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_
(...skipping 13 matching lines...) Expand all
24 24
25 class CriticalSectionWrapper; 25 class CriticalSectionWrapper;
26 class EventTimerWrapper; 26 class EventTimerWrapper;
27 27
28 namespace test { 28 namespace test {
29 29
30 class FrameGenerator; 30 class FrameGenerator;
31 31
32 class FrameGeneratorCapturer : public VideoCapturer { 32 class FrameGeneratorCapturer : public VideoCapturer {
33 public: 33 public:
34 class SinkWantsObserver {
35 public:
36 // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink
37 // is called.
38 virtual void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
39 const rtc::VideoSinkWants& wants) = 0;
40
41 protected:
42 virtual ~SinkWantsObserver() {}
43 };
44
34 static FrameGeneratorCapturer* Create(size_t width, 45 static FrameGeneratorCapturer* Create(size_t width,
35 size_t height, 46 size_t height,
36 int target_fps, 47 int target_fps,
37 Clock* clock); 48 Clock* clock);
38 49
39 static FrameGeneratorCapturer* CreateFromYuvFile(const std::string& file_name, 50 static FrameGeneratorCapturer* CreateFromYuvFile(const std::string& file_name,
40 size_t width, 51 size_t width,
41 size_t height, 52 size_t height,
42 int target_fps, 53 int target_fps,
43 Clock* clock); 54 Clock* clock);
44 virtual ~FrameGeneratorCapturer(); 55 virtual ~FrameGeneratorCapturer();
45 56
46 void Start() override; 57 void Start() override;
47 void Stop() override; 58 void Stop() override;
48 void ChangeResolution(size_t width, size_t height); 59 void ChangeResolution(size_t width, size_t height);
49 60
61 void SetSinkWantsObserver(SinkWantsObserver* observer);
62
50 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, 63 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
51 const rtc::VideoSinkWants& wants) override; 64 const rtc::VideoSinkWants& wants) override;
52 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override; 65 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
53 66
54 void ForceFrame(); 67 void ForceFrame();
55 void SetFakeRotation(VideoRotation rotation); 68 void SetFakeRotation(VideoRotation rotation);
56 69
57 int64_t first_frame_capture_time() const { return first_frame_capture_time_; } 70 int64_t first_frame_capture_time() const { return first_frame_capture_time_; }
58 71
59 FrameGeneratorCapturer(Clock* clock, 72 FrameGeneratorCapturer(Clock* clock,
60 FrameGenerator* frame_generator, 73 FrameGenerator* frame_generator,
61 int target_fps); 74 int target_fps);
62 bool Init(); 75 bool Init();
63 76
64 private: 77 private:
65 void InsertFrame(); 78 void InsertFrame();
66 static bool Run(void* obj); 79 static bool Run(void* obj);
67 80
68 Clock* const clock_; 81 Clock* const clock_;
69 bool sending_; 82 bool sending_;
70 rtc::VideoSinkInterface<VideoFrame>* sink_ GUARDED_BY(&lock_); 83 rtc::VideoSinkInterface<VideoFrame>* sink_ GUARDED_BY(&lock_);
84 SinkWantsObserver* sink_wants_observer_ GUARDED_BY(&lock_);
71 85
72 std::unique_ptr<EventTimerWrapper> tick_; 86 std::unique_ptr<EventTimerWrapper> tick_;
73 rtc::CriticalSection lock_; 87 rtc::CriticalSection lock_;
74 rtc::PlatformThread thread_; 88 rtc::PlatformThread thread_;
75 std::unique_ptr<FrameGenerator> frame_generator_; 89 std::unique_ptr<FrameGenerator> frame_generator_;
76 90
77 int target_fps_; 91 int target_fps_;
78 VideoRotation fake_rotation_ = kVideoRotation_0; 92 VideoRotation fake_rotation_ = kVideoRotation_0;
79 93
80 int64_t first_frame_capture_time_; 94 int64_t first_frame_capture_time_;
81 }; 95 };
82 } // test 96 } // test
83 } // webrtc 97 } // webrtc
84 98
85 #endif // WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_ 99 #endif // WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_
OLDNEW
« no previous file with comments | « webrtc/test/frame_generator.cc ('k') | webrtc/test/frame_generator_capturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698