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

Side by Side Diff: webrtc/video/screenshare_loopback.cc

Issue 1306813009: H.264 video codec support using OpenH264/FFmpeg (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Misc (WebRtcVideoChannel2::...::ConfigureVideoEncoderSettings care about H264 case) Created 5 years, 3 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
« webrtc/video/loopback.cc ('K') | « webrtc/video/loopback.cc ('k') | no next file » | 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 explicit ScreenshareLoopback(const Config& config) : Loopback(config) { 156 explicit ScreenshareLoopback(const Config& config) : Loopback(config) {
157 CHECK_GE(config.num_temporal_layers, 1u); 157 CHECK_GE(config.num_temporal_layers, 1u);
158 CHECK_LE(config.num_temporal_layers, 2u); 158 CHECK_LE(config.num_temporal_layers, 2u);
159 CHECK_GE(config.num_spatial_layers, 1u); 159 CHECK_GE(config.num_spatial_layers, 1u);
160 CHECK_LE(config.num_spatial_layers, 5u); 160 CHECK_LE(config.num_spatial_layers, 5u);
161 CHECK(config.num_spatial_layers == 1 || config.codec == "VP9"); 161 CHECK(config.num_spatial_layers == 1 || config.codec == "VP9");
162 CHECK(config.num_spatial_layers == 1 || config.num_temporal_layers == 1); 162 CHECK(config.num_spatial_layers == 1 || config.num_temporal_layers == 1);
163 CHECK_LT(config.tl_discard_threshold, config.num_temporal_layers); 163 CHECK_LT(config.tl_discard_threshold, config.num_temporal_layers);
164 CHECK_LT(config.sl_discard_threshold, config.num_spatial_layers); 164 CHECK_LT(config.sl_discard_threshold, config.num_spatial_layers);
165 165
166 h264_settings_ = VideoEncoder::GetDefaultH264Settings();
167 h264_settings_.frameDroppingOn = false;
168
166 vp8_settings_ = VideoEncoder::GetDefaultVp8Settings(); 169 vp8_settings_ = VideoEncoder::GetDefaultVp8Settings();
167 vp8_settings_.denoisingOn = false; 170 vp8_settings_.denoisingOn = false;
168 vp8_settings_.frameDroppingOn = false; 171 vp8_settings_.frameDroppingOn = false;
169 vp8_settings_.numberOfTemporalLayers = 172 vp8_settings_.numberOfTemporalLayers =
170 static_cast<unsigned char>(config.num_temporal_layers); 173 static_cast<unsigned char>(config.num_temporal_layers);
171 174
172 vp9_settings_ = VideoEncoder::GetDefaultVp9Settings(); 175 vp9_settings_ = VideoEncoder::GetDefaultVp9Settings();
173 vp9_settings_.denoisingOn = false; 176 vp9_settings_.denoisingOn = false;
174 vp9_settings_.frameDroppingOn = false; 177 vp9_settings_.frameDroppingOn = false;
175 vp9_settings_.numberOfTemporalLayers = 178 vp9_settings_.numberOfTemporalLayers =
176 static_cast<unsigned char>(config.num_temporal_layers); 179 static_cast<unsigned char>(config.num_temporal_layers);
177 vp9_settings_.numberOfSpatialLayers = 180 vp9_settings_.numberOfSpatialLayers =
178 static_cast<unsigned char>(config.num_spatial_layers); 181 static_cast<unsigned char>(config.num_spatial_layers);
179 } 182 }
180 virtual ~ScreenshareLoopback() {} 183 virtual ~ScreenshareLoopback() {}
181 184
182 protected: 185 protected:
183 VideoEncoderConfig CreateEncoderConfig() override { 186 VideoEncoderConfig CreateEncoderConfig() override {
184 VideoEncoderConfig encoder_config(test::Loopback::CreateEncoderConfig()); 187 VideoEncoderConfig encoder_config(test::Loopback::CreateEncoderConfig());
185 VideoStream* stream = &encoder_config.streams[0]; 188 VideoStream* stream = &encoder_config.streams[0];
186 encoder_config.content_type = VideoEncoderConfig::ContentType::kScreen; 189 encoder_config.content_type = VideoEncoderConfig::ContentType::kScreen;
187 encoder_config.min_transmit_bitrate_bps = flags::MinTransmitBitrate(); 190 encoder_config.min_transmit_bitrate_bps = flags::MinTransmitBitrate();
188 int num_temporal_layers; 191 int num_temporal_layers;
189 if (config_.codec == "VP8") { 192 if (config_.codec == "H264") {
193 encoder_config.encoder_specific_settings = &h264_settings_;
194 num_temporal_layers = 1;
195 } else if (config_.codec == "VP8") {
190 encoder_config.encoder_specific_settings = &vp8_settings_; 196 encoder_config.encoder_specific_settings = &vp8_settings_;
191 num_temporal_layers = vp8_settings_.numberOfTemporalLayers; 197 num_temporal_layers = vp8_settings_.numberOfTemporalLayers;
192 } else if (config_.codec == "VP9") { 198 } else if (config_.codec == "VP9") {
193 encoder_config.encoder_specific_settings = &vp9_settings_; 199 encoder_config.encoder_specific_settings = &vp9_settings_;
194 num_temporal_layers = vp9_settings_.numberOfTemporalLayers; 200 num_temporal_layers = vp9_settings_.numberOfTemporalLayers;
195 } else { 201 } else {
196 RTC_NOTREACHED() << "Codec not supported!"; 202 RTC_NOTREACHED() << "Codec not supported!";
197 abort(); 203 abort();
198 } 204 }
199 stream->temporal_layer_thresholds_bps.clear(); 205 stream->temporal_layer_thresholds_bps.clear();
(...skipping 27 matching lines...) Expand all
227 test::FrameGenerator::CreateScrollingInputFromYuvFiles( 233 test::FrameGenerator::CreateScrollingInputFromYuvFiles(
228 Clock::GetRealTimeClock(), slides, kWidth, kHeight, flags::Width(), 234 Clock::GetRealTimeClock(), slides, kWidth, kHeight, flags::Width(),
229 flags::Height(), flags::ScrollDuration() * 1000, kPauseDurationMs); 235 flags::Height(), flags::ScrollDuration() * 1000, kPauseDurationMs);
230 236
231 test::FrameGeneratorCapturer* capturer(new test::FrameGeneratorCapturer( 237 test::FrameGeneratorCapturer* capturer(new test::FrameGeneratorCapturer(
232 clock_, send_stream->Input(), frame_generator, flags::Fps())); 238 clock_, send_stream->Input(), frame_generator, flags::Fps()));
233 EXPECT_TRUE(capturer->Init()); 239 EXPECT_TRUE(capturer->Init());
234 return capturer; 240 return capturer;
235 } 241 }
236 242
243 VideoCodecH264 h264_settings_;
237 VideoCodecVP8 vp8_settings_; 244 VideoCodecVP8 vp8_settings_;
238 VideoCodecVP9 vp9_settings_; 245 VideoCodecVP9 vp9_settings_;
239 }; 246 };
240 247
241 void Loopback() { 248 void Loopback() {
242 test::Loopback::Config config{flags::Width(), 249 test::Loopback::Config config{flags::Width(),
243 flags::Height(), 250 flags::Height(),
244 flags::Fps(), 251 flags::Fps(),
245 flags::MinBitrate(), 252 flags::MinBitrate(),
246 flags::StartBitrate(), 253 flags::StartBitrate(),
(...skipping 16 matching lines...) Expand all
263 } // namespace webrtc 270 } // namespace webrtc
264 271
265 int main(int argc, char* argv[]) { 272 int main(int argc, char* argv[]) {
266 ::testing::InitGoogleTest(&argc, argv); 273 ::testing::InitGoogleTest(&argc, argv);
267 google::ParseCommandLineFlags(&argc, &argv, true); 274 google::ParseCommandLineFlags(&argc, &argv, true);
268 webrtc::test::InitFieldTrialsFromString( 275 webrtc::test::InitFieldTrialsFromString(
269 webrtc::flags::FLAGS_force_fieldtrials); 276 webrtc::flags::FLAGS_force_fieldtrials);
270 webrtc::test::RunTest(webrtc::Loopback); 277 webrtc::test::RunTest(webrtc::Loopback);
271 return 0; 278 return 0;
272 } 279 }
OLDNEW
« webrtc/video/loopback.cc ('K') | « webrtc/video/loopback.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698