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

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

Issue 1682253005: Fix SetRates for encoders with internal sources. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: sync Created 4 years, 8 months 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/modules/video_coding/video_sender_unittest.cc ('k') | webrtc/test/fake_encoder.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 10
11 #ifndef WEBRTC_TEST_FAKE_ENCODER_H_ 11 #ifndef WEBRTC_TEST_FAKE_ENCODER_H_
12 #define WEBRTC_TEST_FAKE_ENCODER_H_ 12 #define WEBRTC_TEST_FAKE_ENCODER_H_
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/platform_thread.h"
16 #include "webrtc/common_types.h" 17 #include "webrtc/common_types.h"
17 #include "webrtc/system_wrappers/include/clock.h" 18 #include "webrtc/system_wrappers/include/clock.h"
18 #include "webrtc/video_encoder.h" 19 #include "webrtc/video_encoder.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 namespace test { 22 namespace test {
22 23
23 class FakeEncoder : public VideoEncoder { 24 class FakeEncoder : public VideoEncoder {
24 public: 25 public:
25 explicit FakeEncoder(Clock* clock); 26 explicit FakeEncoder(Clock* clock);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 DelayedEncoder(Clock* clock, int delay_ms); 76 DelayedEncoder(Clock* clock, int delay_ms);
76 virtual ~DelayedEncoder() {} 77 virtual ~DelayedEncoder() {}
77 78
78 int32_t Encode(const VideoFrame& input_image, 79 int32_t Encode(const VideoFrame& input_image,
79 const CodecSpecificInfo* codec_specific_info, 80 const CodecSpecificInfo* codec_specific_info,
80 const std::vector<FrameType>* frame_types) override; 81 const std::vector<FrameType>* frame_types) override;
81 82
82 private: 83 private:
83 const int delay_ms_; 84 const int delay_ms_;
84 }; 85 };
86
87 // An encoder that is marked as internal source, so ignores everything but
pbos 2016/04/07 12:20:21 This class just looks like dead code, if it's not
88 // keyframe requests in Encode calls, and generates frames (encoded callbacks)
89 // periodically.
90 class InternalSourceEncoder : public test::FakeEncoder {
91 public:
92 InternalSourceEncoder(Clock* clock,
93 uint32_t frame_period_ms,
94 uint32_t first_frame_timestamp_ms);
95 virtual ~InternalSourceEncoder(){};
96
97 // Overridden to ignore input.
98 int32_t Encode(const VideoFrame& input_image,
99 const CodecSpecificInfo* codec_specific_info,
100 const std::vector<FrameType>* frame_types) override;
101 // Overridden to start frame production.
102 int32_t InitEncode(const VideoCodec* config,
103 int32_t number_of_cores,
104 size_t max_payload_size) override;
105 // Overridden to stop frame production.
106 int32_t Release() override;
107
108 private:
109 static bool EncoderProcess(void* encoder);
110 // Encode a fake frame. Returns true to continue background thread processing.
111 bool EncodeFrame();
112 rtc::PlatformThread thread_;
113 const uint32_t frame_period_ms_;
114 // No guard, because it is only modified on |thread_|.
115 uint32_t current_frame_timestamp_ms_;
116 rtc::CriticalSection lock_;
117 bool shutting_down_ GUARDED_BY(lock_);
118 FrameType next_frame_type_ GUARDED_BY(lock_);
119 };
120
85 } // namespace test 121 } // namespace test
86 } // namespace webrtc 122 } // namespace webrtc
87 123
88 #endif // WEBRTC_TEST_FAKE_ENCODER_H_ 124 #endif // WEBRTC_TEST_FAKE_ENCODER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/video_sender_unittest.cc ('k') | webrtc/test/fake_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698