From 0c2adf0b75e74bbd0af0970c913f240b3b4947c3 Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Wed, 30 Nov 2011 14:41:58 +0000 Subject: [PATCH] Fix bug introduced when enabling VP8 frame dropping. Also fixes two unit test mismatches. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/299002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1061 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../codecs/test_framework/unit_test.cc | 8 +++----- .../video_coding/codecs/vp8/main/source/vp8.cc | 14 +++++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/modules/video_coding/codecs/test_framework/unit_test.cc b/src/modules/video_coding/codecs/test_framework/unit_test.cc index efe238047..1497411f0 100644 --- a/src/modules/video_coding/codecs/test_framework/unit_test.cc +++ b/src/modules/video_coding/codecs/test_framework/unit_test.cc @@ -514,8 +514,8 @@ UnitTest::Perform() //-- Decode() errors -- // Unallocated encodedVideoBuffer. _encodedVideoBuffer.Free(); - //_encodedVideoBuffer.UpdateLength(10); // Buffer NULL but length > 0 VideoEncodedBufferToEncodedImage(_encodedVideoBuffer, encodedImage); + encodedImage._length = 10; // Buffer NULL but length > 0 VIDEO_TEST(_decoder->Decode(encodedImage, false, NULL) == WEBRTC_VIDEO_CODEC_ERR_PARAMETER); _encodedVideoBuffer.VerifyAndAllocate(_lengthSourceFrame); @@ -789,8 +789,7 @@ UnitTest::RateControlTests() &videoFrameType) == WEBRTC_VIDEO_CODEC_OK); frameLength = WaitForEncodedFrame(); - VIDEO_TEST_EXIT_ON_ERR(frameLength > 0); - //VIDEO_TEST(frameLength > 0); + VIDEO_TEST_EXIT_ON_ERR(frameLength >= 0); totalBytes += frameLength; frames++; @@ -804,9 +803,8 @@ UnitTest::RateControlTests() printf("Target bitrate: %d kbps, actual bitrate: %d kbps\n", _bitRate, actualBitrate); // Test for close match over reasonable range. - if (_bitRate >= 100 && _bitRate <= 4000) + if (_bitRate >= 100 && _bitRate <= 2500) { - //VIDEO_TEST(fabs(actualBitrate - _bitRate) < 0.05 * _bitRate); VIDEO_TEST(abs(WebRtc_Word32(actualBitrate - _bitRate)) < 0.1 * _bitRate); // for VP8 } diff --git a/src/modules/video_coding/codecs/vp8/main/source/vp8.cc b/src/modules/video_coding/codecs/vp8/main/source/vp8.cc index 0d212c29b..df100dfcf 100644 --- a/src/modules/video_coding/codecs/vp8/main/source/vp8.cc +++ b/src/modules/video_coding/codecs/vp8/main/source/vp8.cc @@ -706,13 +706,13 @@ VP8Encoder::GetEncodedPartitions(const RawImage& input_image) { break; } } - if (_encodedImage._length == 0) - return WEBRTC_VIDEO_CODEC_ERROR; - _encodedImage._timeStamp = input_image._timeStamp; - _encodedImage._encodedHeight = _raw->h; - _encodedImage._encodedWidth = _raw->w; - _encodedCompleteCallback->Encoded(_encodedImage, &codecSpecific, - &frag_info); + if (_encodedImage._length > 0) { + _encodedImage._timeStamp = input_image._timeStamp; + _encodedImage._encodedHeight = _raw->h; + _encodedImage._encodedWidth = _raw->w; + _encodedCompleteCallback->Encoded(_encodedImage, &codecSpecific, + &frag_info); + } return WEBRTC_VIDEO_CODEC_OK; } #endif