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

Side by Side Diff: webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc

Issue 3013463002: Fix VideoProcessorIntegrationTest on iOS. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | 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) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 }); 182 });
183 183
184 // Process all frames. 184 // Process all frames.
185 int frame_number = 0; 185 int frame_number = 0;
186 const int num_frames = rate_profile.num_frames; 186 const int num_frames = rate_profile.num_frames;
187 RTC_DCHECK_GE(num_frames, 1); 187 RTC_DCHECK_GE(num_frames, 1);
188 while (frame_number < num_frames) { 188 while (frame_number < num_frames) {
189 // In order to not overwhelm the OpenMAX buffers in the Android 189 // In order to not overwhelm the OpenMAX buffers in the Android
190 // MediaCodec API, we roughly pace the frames here. The downside 190 // MediaCodec API, we roughly pace the frames here. The downside
191 // of this is that the encode run will be done in real-time. 191 // of this is that the encode run will be done in real-time.
192 // TODO(brandtr): Investigate if this is needed on iOS. 192 #if defined(WEBRTC_ANDROID)
193 if (config_.hw_encoder || config_.hw_decoder) { 193 if (config_.hw_encoder || config_.hw_decoder) {
194 SleepMs(rtc::kNumMillisecsPerSec / 194 SleepMs(rtc::kNumMillisecsPerSec /
195 rate_profile.input_frame_rate[rate_update_index]); 195 rate_profile.input_frame_rate[rate_update_index]);
196 } 196 }
197 #endif
197 198
198 task_queue.PostTask([this] { processor_->ProcessFrame(); }); 199 task_queue.PostTask([this] { processor_->ProcessFrame(); });
199 ++frame_number; 200 ++frame_number;
200 201
201 if (frame_number == 202 if (frame_number ==
202 rate_profile.frame_index_rate_update[rate_update_index + 1]) { 203 rate_profile.frame_index_rate_update[rate_update_index + 1]) {
203 ++rate_update_index; 204 ++rate_update_index;
204 205
205 task_queue.PostTask([this, &rate_profile, rate_update_index] { 206 task_queue.PostTask([this, &rate_profile, rate_update_index] {
206 processor_->SetRates(rate_profile.target_bit_rate[rate_update_index], 207 processor_->SetRates(rate_profile.target_bit_rate[rate_update_index],
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 EXPECT_EQ(kVideoCodecH264, config_.codec_settings.codecType) 296 EXPECT_EQ(kVideoCodecH264, config_.codec_settings.codecType)
296 << "iOS HW codecs only support H264."; 297 << "iOS HW codecs only support H264.";
297 decoder_factory_ = CreateObjCDecoderFactory(); 298 decoder_factory_ = CreateObjCDecoderFactory();
298 #else 299 #else
299 RTC_NOTREACHED() << "Only support HW decoder on Android and iOS."; 300 RTC_NOTREACHED() << "Only support HW decoder on Android and iOS.";
300 #endif 301 #endif
301 } else { 302 } else {
302 decoder_factory_.reset(new cricket::InternalDecoderFactory()); 303 decoder_factory_.reset(new cricket::InternalDecoderFactory());
303 } 304 }
304 305
305 cricket::VideoCodec encoder_codec; 306 cricket::VideoCodec codec;
307 cricket::VideoDecoderParams decoder_params; // Empty.
306 switch (config_.codec_settings.codecType) { 308 switch (config_.codec_settings.codecType) {
307 case kVideoCodecVP8: 309 case kVideoCodecVP8:
308 encoder_codec = cricket::VideoCodec(cricket::kVp8CodecName); 310 codec = cricket::VideoCodec(cricket::kVp8CodecName);
309 encoder_.reset(encoder_factory->CreateVideoEncoder(encoder_codec)); 311 encoder_.reset(encoder_factory->CreateVideoEncoder(codec));
310 decoder_ = decoder_factory_->CreateVideoDecoder(kVideoCodecVP8); 312 decoder_ =
313 decoder_factory_->CreateVideoDecoderWithParams(codec, decoder_params);
311 break; 314 break;
312 case kVideoCodecVP9: 315 case kVideoCodecVP9:
313 encoder_codec = cricket::VideoCodec(cricket::kVp9CodecName); 316 codec = cricket::VideoCodec(cricket::kVp9CodecName);
314 encoder_.reset(encoder_factory->CreateVideoEncoder(encoder_codec)); 317 encoder_.reset(encoder_factory->CreateVideoEncoder(codec));
315 decoder_ = decoder_factory_->CreateVideoDecoder(kVideoCodecVP9); 318 decoder_ =
319 decoder_factory_->CreateVideoDecoderWithParams(codec, decoder_params);
316 break; 320 break;
317 case kVideoCodecH264: 321 case kVideoCodecH264:
318 // TODO(brandtr): Generalize so that we support multiple profiles here. 322 // TODO(brandtr): Generalize so that we support multiple profiles here.
319 encoder_codec = cricket::VideoCodec(cricket::kH264CodecName); 323 codec = cricket::VideoCodec(cricket::kH264CodecName);
320 encoder_.reset(encoder_factory->CreateVideoEncoder(encoder_codec)); 324 encoder_.reset(encoder_factory->CreateVideoEncoder(codec));
321 decoder_ = decoder_factory_->CreateVideoDecoder(kVideoCodecH264); 325 decoder_ =
326 decoder_factory_->CreateVideoDecoderWithParams(codec, decoder_params);
322 break; 327 break;
323 default: 328 default:
324 RTC_NOTREACHED(); 329 RTC_NOTREACHED();
325 break; 330 break;
326 } 331 }
327 332
328 if (config_.sw_fallback_encoder) { 333 if (config_.sw_fallback_encoder) {
329 encoder_ = rtc::MakeUnique<VideoEncoderSoftwareFallbackWrapper>( 334 encoder_ = rtc::MakeUnique<VideoEncoderSoftwareFallbackWrapper>(
330 encoder_codec, std::move(encoder_)); 335 codec, std::move(encoder_));
331 } 336 }
332 337
333 EXPECT_TRUE(encoder_) << "Encoder not successfully created."; 338 EXPECT_TRUE(encoder_) << "Encoder not successfully created.";
334 EXPECT_TRUE(decoder_) << "Decoder not successfully created."; 339 EXPECT_TRUE(decoder_) << "Decoder not successfully created.";
335 } 340 }
336 341
337 void VideoProcessorIntegrationTest::DestroyEncoderAndDecoder() { 342 void VideoProcessorIntegrationTest::DestroyEncoderAndDecoder() {
338 encoder_.reset(); 343 encoder_.reset();
339 decoder_factory_->DestroyVideoDecoder(decoder_); 344 decoder_factory_->DestroyVideoDecoder(decoder_);
340 } 345 }
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 perc_encoding_rate_mismatch_ = 0.0f; 648 perc_encoding_rate_mismatch_ = 0.0f;
644 num_frames_to_hit_target_ = 649 num_frames_to_hit_target_ =
645 rate_profile.frame_index_rate_update[rate_update_index + 1]; 650 rate_profile.frame_index_rate_update[rate_update_index + 1];
646 encoding_rate_within_target_ = false; 651 encoding_rate_within_target_ = false;
647 sum_key_frame_size_mismatch_ = 0.0; 652 sum_key_frame_size_mismatch_ = 0.0;
648 num_key_frames_ = 0; 653 num_key_frames_ = 0;
649 } 654 }
650 655
651 } // namespace test 656 } // namespace test
652 } // namespace webrtc 657 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698