Revert "Reject corrupted frames in the VP8 video decoder." This reverts commit ba511622a24945fdd2b5b26b5a9275f0c6daff5e. Reason for revert: breaks downstream test Original change's description: > Reject corrupted frames in the VP8 video decoder. > > The libvpx VP8 decoder has always returned error on malformed keyframes > but it turns out that corrupted delta frames may actually decode with > error, upon which the decoder still returns `VPX_CODEC_OK`. It is then > up to the user to poll the `VP8D_GET_FRAME_CORRUPTED` flag to see if it > was indeed OK. > > This CL adds a unit test the demonstrated this condition and shows that > we now reject the corrupted frame instead of continuing with error. > > Bug: chromium:561396583 > Change-Id: I1e5c65225fc389be8b37d4c7da9a2cbf9a0c6ec2 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/505800 > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > Commit-Queue: Erik Språng <sprang@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#48727} Bug: chromium:561396583, b/566204684 Change-Id: I862d07778dfa77aa9615ddda1e96c4b2925d25b7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/505880 Auto-Submit: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Erik Språng <sprang@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#48736}
diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc index f9d0cb0..ee52e72 100644 --- a/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc +++ b/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
@@ -31,7 +31,6 @@ #include "modules/video_coding/codecs/vp8/include/vp8.h" #include "modules/video_coding/include/video_error_codes.h" #include "rtc_base/checks.h" -#include "rtc_base/logging.h" #include "rtc_base/numerics/exp_filter.h" #include "system_wrappers/include/metrics.h" #include "third_party/libvpx/source/libvpx/vpx/vp8.h" @@ -255,14 +254,6 @@ return WEBRTC_VIDEO_CODEC_ERROR; } - int corrupted = 0; - if (vpx_codec_control(decoder_, VP8D_GET_FRAME_CORRUPTED, &corrupted) != - VPX_CODEC_OK || - corrupted != 0) { - RTC_LOG(LS_WARNING) << "Rejecting corrupted VP8 frame."; - return WEBRTC_VIDEO_CODEC_ERROR; - } - vpx_codec_iter_t iter = nullptr; vpx_image_t* img = vpx_codec_get_frame(decoder_, &iter); int qp;
diff --git a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc index 5a31858..08df457 100644 --- a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc +++ b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc
@@ -371,36 +371,6 @@ EXPECT_EQ(encoded_frame.qp_, *decoded_qp); } -TEST_F(TestVp8Impl, RejectsCorruptedDeltaFrame) { - VideoFrame input_frame = NextInputFrame(); - EncodedImage key_frame; - CodecSpecificInfo codec_specific_info; - EncodeAndWaitForFrame(input_frame, &key_frame, &codec_specific_info, - /*keyframe=*/true); - EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Decode(key_frame, -1)); - std::unique_ptr<VideoFrame> decoded_frame; - std::optional<uint8_t> decoded_qp; - ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); - - EncodedImage delta_frame; - EncodeAndWaitForFrame(NextInputFrame(), &delta_frame, &codec_specific_info, - /*keyframe=*/false); - - // Truncate the delta frame to corrupt the token partition while leaving - // the frame header and first partition intact. Libvpx will decode the frame - // with error and flag it as corrupted. - delta_frame.set_size(delta_frame.size() / 2); - EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, decoder_->Decode(delta_frame, -1)); - - // Verify that a subsequent key frame can still be decoded successfully. - EncodedImage new_key_frame; - EncodeAndWaitForFrame(NextInputFrame(), &new_key_frame, &codec_specific_info, - /*keyframe=*/true); - EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Decode(new_key_frame, -1)); - ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); - ASSERT_TRUE(decoded_frame); -} - TEST_F(TestVp8Impl, ChecksSimulcastSettings) { codec_settings_.numberOfSimulcastStreams = 2; // Resolutions are not in ascending order, temporal layers do not match.