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
This commit is contained in:
stefan@webrtc.org 2011-11-30 14:41:58 +00:00
parent ac2c677bf6
commit 0c2adf0b75
2 changed files with 10 additions and 12 deletions

View File

@ -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
}

View File

@ -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