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

Side by Side Diff: webrtc/media/engine/fakewebrtcvideoengine.h

Issue 2510583002: Reland #2 of Issue 2434073003: Extract bitrate allocation ... (Closed)
Patch Set: Addressed comments 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2010 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
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 int num_created_decoders_; 125 int num_created_decoders_;
126 std::vector<VideoDecoderParams> params_; 126 std::vector<VideoDecoderParams> params_;
127 }; 127 };
128 128
129 // Fake class for mocking out webrtc::VideoEnoder 129 // Fake class for mocking out webrtc::VideoEnoder
130 class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder { 130 class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder {
131 public: 131 public:
132 FakeWebRtcVideoEncoder() 132 FakeWebRtcVideoEncoder()
133 : init_encode_event_(false, false), num_frames_encoded_(0) {} 133 : init_encode_event_(false, false), num_frames_encoded_(0) {}
134 134
135 virtual int32_t InitEncode(const webrtc::VideoCodec* codecSettings, 135 int32_t InitEncode(const webrtc::VideoCodec* codecSettings,
136 int32_t numberOfCores, 136 int32_t numberOfCores,
137 size_t maxPayloadSize) { 137 size_t maxPayloadSize) override {
138 rtc::CritScope lock(&crit_); 138 rtc::CritScope lock(&crit_);
139 codec_settings_ = *codecSettings; 139 codec_settings_ = *codecSettings;
140 init_encode_event_.Set(); 140 init_encode_event_.Set();
141 return WEBRTC_VIDEO_CODEC_OK; 141 return WEBRTC_VIDEO_CODEC_OK;
142 } 142 }
143 143
144 bool WaitForInitEncode() { return init_encode_event_.Wait(kEventTimeoutMs); } 144 bool WaitForInitEncode() { return init_encode_event_.Wait(kEventTimeoutMs); }
145 145
146 webrtc::VideoCodec GetCodecSettings() { 146 webrtc::VideoCodec GetCodecSettings() {
147 rtc::CritScope lock(&crit_); 147 rtc::CritScope lock(&crit_);
148 return codec_settings_; 148 return codec_settings_;
149 } 149 }
150 150
151 virtual int32_t Encode(const webrtc::VideoFrame& inputImage, 151 int32_t Encode(const webrtc::VideoFrame& inputImage,
152 const webrtc::CodecSpecificInfo* codecSpecificInfo, 152 const webrtc::CodecSpecificInfo* codecSpecificInfo,
153 const std::vector<webrtc::FrameType>* frame_types) { 153 const std::vector<webrtc::FrameType>* frame_types) override {
154 rtc::CritScope lock(&crit_); 154 rtc::CritScope lock(&crit_);
155 ++num_frames_encoded_; 155 ++num_frames_encoded_;
156 init_encode_event_.Set(); 156 init_encode_event_.Set();
157 return WEBRTC_VIDEO_CODEC_OK; 157 return WEBRTC_VIDEO_CODEC_OK;
158 } 158 }
159 159
160 virtual int32_t RegisterEncodeCompleteCallback( 160 int32_t RegisterEncodeCompleteCallback(
161 webrtc::EncodedImageCallback* callback) { 161 webrtc::EncodedImageCallback* callback) override {
162 return WEBRTC_VIDEO_CODEC_OK; 162 return WEBRTC_VIDEO_CODEC_OK;
163 } 163 }
164 164
165 virtual int32_t Release() { return WEBRTC_VIDEO_CODEC_OK; } 165 int32_t Release() override { return WEBRTC_VIDEO_CODEC_OK; }
166 166
167 virtual int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) { 167 int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) override {
168 return WEBRTC_VIDEO_CODEC_OK; 168 return WEBRTC_VIDEO_CODEC_OK;
169 } 169 }
170 170
171 virtual int32_t SetRates(uint32_t newBitRate, uint32_t frameRate) { 171 int32_t SetRateAllocation(const webrtc::BitrateAllocation& allocation,
172 uint32_t framerate) override {
172 return WEBRTC_VIDEO_CODEC_OK; 173 return WEBRTC_VIDEO_CODEC_OK;
173 } 174 }
174 175
175 int GetNumEncodedFrames() { 176 int GetNumEncodedFrames() {
176 rtc::CritScope lock(&crit_); 177 rtc::CritScope lock(&crit_);
177 return num_frames_encoded_; 178 return num_frames_encoded_;
178 } 179 }
179 180
180 private: 181 private:
181 rtc::CriticalSection crit_; 182 rtc::CriticalSection crit_;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 rtc::Event created_video_encoder_event_; 257 rtc::Event created_video_encoder_event_;
257 std::vector<cricket::VideoCodec> codecs_; 258 std::vector<cricket::VideoCodec> codecs_;
258 std::vector<FakeWebRtcVideoEncoder*> encoders_ GUARDED_BY(crit_); 259 std::vector<FakeWebRtcVideoEncoder*> encoders_ GUARDED_BY(crit_);
259 int num_created_encoders_ GUARDED_BY(crit_); 260 int num_created_encoders_ GUARDED_BY(crit_);
260 bool encoders_have_internal_sources_; 261 bool encoders_have_internal_sources_;
261 }; 262 };
262 263
263 } // namespace cricket 264 } // namespace cricket
264 265
265 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOENGINE_H_ 266 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOENGINE_H_
OLDNEW
« no previous file with comments | « webrtc/common_video/include/video_bitrate_allocator.h ('k') | webrtc/media/engine/videoencodersoftwarefallbackwrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698