Fix a crash in video codec tester

Bug: webrtc:14852
Change-Id: I282fd41f2c2486b4b788581221bf9811f6e918ec
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334221
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41514}
This commit is contained in:
Sergey Silkin 2024-01-12 10:50:53 +00:00 committed by WebRTC LUCI CQ
parent d123ca8e41
commit 2ab1997d9d

View File

@ -1144,8 +1144,11 @@ class Encoder : public EncodedImageCallback {
}
static bool IsSvc(const EncodedImage& encoded_frame,
const CodecSpecificInfo* codec_specific_info) {
ScalabilityMode scalability_mode = *codec_specific_info->scalability_mode;
const CodecSpecificInfo& codec_specific_info) {
if (!codec_specific_info.scalability_mode) {
return false;
}
ScalabilityMode scalability_mode = *codec_specific_info.scalability_mode;
return (kFullSvcScalabilityModes.count(scalability_mode) ||
(kKeySvcScalabilityModes.count(scalability_mode) &&
encoded_frame.FrameType() == VideoFrameType::kVideoFrameKey));
@ -1171,7 +1174,8 @@ class Encoder : public EncodedImageCallback {
return last_superframe_->encoded_frame;
}
if (IsSvc(encoded_frame, codec_specific_info)) {
RTC_CHECK(codec_specific_info != nullptr);
if (IsSvc(encoded_frame, *codec_specific_info)) {
last_superframe_ = Superframe{
.encoded_frame = EncodedImage(encoded_frame),
.encoded_data = EncodedImageBuffer::Create(encoded_frame.data(),