Index: webrtc/modules/video_coding/codecs/test/video_codec_test.cc |
diff --git a/webrtc/modules/video_coding/codecs/test/video_codec_test.cc b/webrtc/modules/video_coding/codecs/test/video_codec_test.cc |
index d94c215281bd7ec3f8e01f2c2df4a9fec9241b56..1a14750f2221c5ae95ce4ca2e12ccdb0e4cfa433 100644 |
--- a/webrtc/modules/video_coding/codecs/test/video_codec_test.cc |
+++ b/webrtc/modules/video_coding/codecs/test/video_codec_test.cc |
@@ -34,6 +34,11 @@ VideoCodecTest::FakeEncodeCompleteCallback::OnEncodedImage( |
const RTPFragmentationHeader* fragmentation) { |
rtc::CritScope lock(&test_->encoded_frame_section_); |
test_->encoded_frame_.emplace(frame); |
+ RTC_DCHECK(codec_specific_info); |
+ test_->codec_specific_info_.codecType = codec_specific_info->codecType; |
+ // Skip |codec_name|, to avoid allocating. |
+ test_->codec_specific_info_.codecSpecific = |
+ codec_specific_info->codecSpecific; |
test_->encoded_frame_event_.Set(); |
return Result(Result::OK); |
} |
@@ -66,7 +71,9 @@ void VideoCodecTest::SetUp() { |
InitCodecs(); |
} |
-bool VideoCodecTest::WaitForEncodedFrame(EncodedImage* frame) { |
+bool VideoCodecTest::WaitForEncodedFrame( |
+ EncodedImage* frame, |
+ CodecSpecificInfo* codec_specific_info) { |
bool ret = encoded_frame_event_.Wait(kEncodeTimeoutMs); |
EXPECT_TRUE(ret) << "Timed out while waiting for an encoded frame."; |
// This becomes unsafe if there are multiple threads waiting for frames. |
@@ -75,6 +82,9 @@ bool VideoCodecTest::WaitForEncodedFrame(EncodedImage* frame) { |
if (encoded_frame_) { |
*frame = std::move(*encoded_frame_); |
encoded_frame_.reset(); |
+ RTC_DCHECK(codec_specific_info); |
+ codec_specific_info->codecType = codec_specific_info_.codecType; |
+ codec_specific_info->codecSpecific = codec_specific_info_.codecSpecific; |
return true; |
} else { |
return false; |
@@ -99,18 +109,18 @@ bool VideoCodecTest::WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame, |
} |
void VideoCodecTest::InitCodecs() { |
- VideoCodec codec_inst = codec_settings(); |
- codec_inst.startBitrate = kStartBitrate; |
- codec_inst.targetBitrate = kTargetBitrate; |
- codec_inst.maxBitrate = kMaxBitrate; |
- codec_inst.maxFramerate = kMaxFramerate; |
- codec_inst.width = kWidth; |
- codec_inst.height = kHeight; |
+ codec_settings_ = codec_settings(); |
+ codec_settings_.startBitrate = kStartBitrate; |
+ codec_settings_.targetBitrate = kTargetBitrate; |
+ codec_settings_.maxBitrate = kMaxBitrate; |
+ codec_settings_.maxFramerate = kMaxFramerate; |
+ codec_settings_.width = kWidth; |
+ codec_settings_.height = kHeight; |
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
- encoder_->InitEncode(&codec_inst, 1 /* number of cores */, |
+ encoder_->InitEncode(&codec_settings_, 1 /* number of cores */, |
0 /* max payload size (unused) */)); |
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
- decoder_->InitDecode(&codec_inst, 1 /* number of cores */)); |
+ decoder_->InitDecode(&codec_settings_, 1 /* number of cores */)); |
} |
} // namespace webrtc |