Fixing a number of issues in VCM and codec tests

Issues come from previous change to routing of CodecSpecificInfo.
A few tests are asserted out, and will be until the corresponding
routing has been made on the decoder side.
Review URL: http://webrtc-codereview.appspot.com/60007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@184 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
hlundin@google.com
2011-07-08 13:05:23 +00:00
parent 12c9df1a69
commit edac1733e2
10 changed files with 30 additions and 22 deletions

View File

@@ -176,8 +176,6 @@ FrameQueueTuple::~FrameQueueTuple()
{ {
if (_codecSpecificInfo != NULL) if (_codecSpecificInfo != NULL)
{ {
// TODO(holmer): implement virtual function for deleting this and
// remove warnings
delete _codecSpecificInfo; delete _codecSpecificInfo;
} }
if (_frame != NULL) if (_frame != NULL)
@@ -187,7 +185,7 @@ FrameQueueTuple::~FrameQueueTuple()
} }
void FrameQueue::PushFrame(TestVideoEncodedBuffer *frame, void FrameQueue::PushFrame(TestVideoEncodedBuffer *frame,
void* codecSpecificInfo) webrtc::CodecSpecificInfo* codecSpecificInfo)
{ {
WriteLockScoped cs(_queueRWLock); WriteLockScoped cs(_queueRWLock);
_frameBufferQueue.push(new FrameQueueTuple(frame, codecSpecificInfo)); _frameBufferQueue.push(new FrameQueueTuple(frame, codecSpecificInfo));
@@ -218,7 +216,7 @@ WebRtc_UWord32 VideoEncodeCompleteCallback::EncodedBytes()
WebRtc_Word32 WebRtc_Word32
VideoEncodeCompleteCallback::Encoded(EncodedImage& encodedImage, VideoEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
const void* codecSpecificInfo, const webrtc::CodecSpecificInfo* codecSpecificInfo,
const webrtc::RTPFragmentationHeader* const webrtc::RTPFragmentationHeader*
fragmentation) fragmentation)
{ {
@@ -231,7 +229,7 @@ VideoEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
// it for an empty frame and then just do: // it for an empty frame and then just do:
// emptyFrame->SwapBuffers(encodedBuffer); // emptyFrame->SwapBuffers(encodedBuffer);
// This is how it should be done in Video Engine to save in on memcpys // This is how it should be done in Video Engine to save in on memcpys
void* codecSpecificInfoCopy = webrtc::CodecSpecificInfo* codecSpecificInfoCopy =
_test.CopyCodecSpecificInfo(codecSpecificInfo); _test.CopyCodecSpecificInfo(codecSpecificInfo);
_test.CopyEncodedImage(*newBuffer, encodedImage, codecSpecificInfoCopy); _test.CopyEncodedImage(*newBuffer, encodedImage, codecSpecificInfoCopy);
if (_encodedFile != NULL) if (_encodedFile != NULL)
@@ -447,12 +445,10 @@ NormalAsyncTest::Encode()
_hasReceivedSLI = false; // don't trigger both at once _hasReceivedSLI = false; // don't trigger both at once
} }
void* codecSpecificInfo = CreateEncoderSpecificInfo(); webrtc::CodecSpecificInfo* codecSpecificInfo = CreateEncoderSpecificInfo();
int ret = _encoder->Encode(rawImage, codecSpecificInfo, frameType); int ret = _encoder->Encode(rawImage, codecSpecificInfo, frameType);
if (codecSpecificInfo != NULL) if (codecSpecificInfo != NULL)
{ {
// TODO(holmer): implement virtual function for deleting this and
// remove warnings
delete codecSpecificInfo; delete codecSpecificInfo;
codecSpecificInfo = NULL; codecSpecificInfo = NULL;
} }

View File

@@ -23,14 +23,14 @@ class FrameQueueTuple
{ {
public: public:
FrameQueueTuple(TestVideoEncodedBuffer *frame, FrameQueueTuple(TestVideoEncodedBuffer *frame,
const void* codecSpecificInfo = NULL) const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL)
: :
_frame(frame), _frame(frame),
_codecSpecificInfo(codecSpecificInfo) _codecSpecificInfo(codecSpecificInfo)
{}; {};
~FrameQueueTuple(); ~FrameQueueTuple();
TestVideoEncodedBuffer* _frame; TestVideoEncodedBuffer* _frame;
const void* _codecSpecificInfo; const webrtc::CodecSpecificInfo* _codecSpecificInfo;
}; };
class FrameQueue class FrameQueue
@@ -49,7 +49,7 @@ public:
} }
void PushFrame(TestVideoEncodedBuffer *frame, void PushFrame(TestVideoEncodedBuffer *frame,
void* codecSpecificInfo = NULL); webrtc::CodecSpecificInfo* codecSpecificInfo = NULL);
FrameQueueTuple* PopFrame(); FrameQueueTuple* PopFrame();
bool Empty(); bool Empty();
@@ -83,13 +83,17 @@ public:
virtual void Perform(); virtual void Perform();
virtual void Encoded(const webrtc::EncodedImage& encodedImage); virtual void Encoded(const webrtc::EncodedImage& encodedImage);
virtual void Decoded(const webrtc::RawImage& decodedImage); virtual void Decoded(const webrtc::RawImage& decodedImage);
virtual void* virtual webrtc::CodecSpecificInfo*
CopyCodecSpecificInfo(const void* /*codecSpecificInfo */) const CopyCodecSpecificInfo(
const webrtc::CodecSpecificInfo* /*codecSpecificInfo */) const
{ return NULL; }; { return NULL; };
virtual void CopyEncodedImage(TestVideoEncodedBuffer& dest, virtual void CopyEncodedImage(TestVideoEncodedBuffer& dest,
webrtc::EncodedImage& src, webrtc::EncodedImage& src,
void* /*codecSpecificInfo*/) const; void* /*codecSpecificInfo*/) const;
virtual void* CreateEncoderSpecificInfo() const { return NULL; }; virtual webrtc::CodecSpecificInfo* CreateEncoderSpecificInfo() const
{
return NULL;
};
virtual WebRtc_Word32 virtual WebRtc_Word32
ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId) { return 0;}; ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId) { return 0;};
virtual WebRtc_Word32 virtual WebRtc_Word32
@@ -149,7 +153,7 @@ public:
WebRtc_Word32 WebRtc_Word32
Encoded(webrtc::EncodedImage& encodedImage, Encoded(webrtc::EncodedImage& encodedImage,
const void* codecSpecificInfo = NULL, const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL,
const webrtc::RTPFragmentationHeader* fragmentation = NULL); const webrtc::RTPFragmentationHeader* fragmentation = NULL);
WebRtc_UWord32 EncodedBytes(); WebRtc_UWord32 EncodedBytes();
private: private:

View File

@@ -267,11 +267,10 @@ bool PerformanceTest::Encode()
{ {
frameType = kKeyFrame; frameType = kKeyFrame;
} }
void* codecSpecificInfo = CreateEncoderSpecificInfo(); webrtc::CodecSpecificInfo* codecSpecificInfo = CreateEncoderSpecificInfo();
int ret = _encoder->Encode(rawImage, codecSpecificInfo, frameType); int ret = _encoder->Encode(rawImage, codecSpecificInfo, frameType);
if (codecSpecificInfo != NULL) if (codecSpecificInfo != NULL)
{ {
// TODO(holmer): implement virtual function for deleting this and remove warnings
delete codecSpecificInfo; delete codecSpecificInfo;
codecSpecificInfo = NULL; codecSpecificInfo = NULL;
} }

View File

@@ -87,7 +87,7 @@ UnitTest::~UnitTest()
WebRtc_Word32 WebRtc_Word32
UnitTestEncodeCompleteCallback::Encoded(EncodedImage& encodedImage, UnitTestEncodeCompleteCallback::Encoded(EncodedImage& encodedImage,
const void* codecSpecificInfo, const webrtc::CodecSpecificInfo* codecSpecificInfo,
const webrtc::RTPFragmentationHeader* const webrtc::RTPFragmentationHeader*
fragmentation) fragmentation)
{ {

View File

@@ -103,7 +103,7 @@ public:
_decoderSpecificInfo(decoderSpecificInfo), _decoderSpecificInfo(decoderSpecificInfo),
_encodeComplete(false) {} _encodeComplete(false) {}
WebRtc_Word32 Encoded(webrtc::EncodedImage& encodedImage, WebRtc_Word32 Encoded(webrtc::EncodedImage& encodedImage,
const void* codecSpecificInfo, const webrtc::CodecSpecificInfo* codecSpecificInfo,
const webrtc::RTPFragmentationHeader* const webrtc::RTPFragmentationHeader*
fragmentation = NULL); fragmentation = NULL);
bool EncodeComplete(); bool EncodeComplete();

View File

@@ -66,7 +66,7 @@ VP8NormalAsyncTest::ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId
return 0; return 0;
} }
void* CodecSpecificInfo*
VP8NormalAsyncTest::CreateEncoderSpecificInfo() const VP8NormalAsyncTest::CreateEncoderSpecificInfo() const
{ {
CodecSpecificInfo* vp8CodecSpecificInfo = new CodecSpecificInfo(); CodecSpecificInfo* vp8CodecSpecificInfo = new CodecSpecificInfo();

View File

@@ -23,7 +23,7 @@ protected:
VP8NormalAsyncTest(std::string name, std::string description, unsigned int testNo) : NormalAsyncTest(name, description, testNo) {} VP8NormalAsyncTest(std::string name, std::string description, unsigned int testNo) : NormalAsyncTest(name, description, testNo) {}
virtual void CodecSpecific_InitBitrate(); virtual void CodecSpecific_InitBitrate();
virtual void CodecSettings(int width, int height, WebRtc_UWord32 frameRate=30, WebRtc_UWord32 bitRate=0); virtual void CodecSettings(int width, int height, WebRtc_UWord32 frameRate=30, WebRtc_UWord32 bitRate=0);
virtual void* CreateEncoderSpecificInfo() const; virtual webrtc::CodecSpecificInfo* CreateEncoderSpecificInfo() const;
virtual WebRtc_Word32 ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId); virtual WebRtc_Word32 ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId);
private: private:
mutable bool _hasReceivedRPSI; mutable bool _hasReceivedRPSI;

View File

@@ -582,5 +582,8 @@ VCMEncComplete_KeyReqTest::SendData(
_timeStamp += 3000; _timeStamp += 3000;
rtpInfo.type.Video.isFirstPacket = false; rtpInfo.type.Video.isFirstPacket = false;
rtpInfo.frameType = kVideoFrameKey; rtpInfo.frameType = kVideoFrameKey;
// TODO(hlundin): Remove assert once we've piped PictureID into VCM
// through the WebRtcRTPHeader.
assert(rtpInfo.type.Video.codec != kRTPVideoVP8);
return _vcm.IncomingPacket(payloadData, payloadSize, rtpInfo); return _vcm.IncomingPacket(payloadData, payloadSize, rtpInfo);
} }

View File

@@ -113,6 +113,9 @@ VCMNTEncodeCompleteCallback::SendData(
{ {
_skipCnt++; _skipCnt++;
} }
// TODO(hlundin): Remove assert once we've piped PictureID into VCM
// through the WebRtcRTPHeader.
assert(rtpInfo.type.Video.codec != kRTPVideoVP8);
_VCMReceiver->IncomingPacket(payloadData, payloadSize, rtpInfo); _VCMReceiver->IncomingPacket(payloadData, payloadSize, rtpInfo);
return 0; return 0;
} }

View File

@@ -80,6 +80,9 @@ VCMEncodeCompleteCallback::SendData(
_encodedBytes += payloadSize; _encodedBytes += payloadSize;
// directly to receiver // directly to receiver
// TODO(hlundin): Remove assert once we've piped PictureID into VCM
// through the WebRtcRTPHeader.
assert(rtpInfo.type.Video.codec != kRTPVideoVP8);
_VCMReceiver->IncomingPacket(payloadData, payloadSize, rtpInfo); _VCMReceiver->IncomingPacket(payloadData, payloadSize, rtpInfo);
_encodeComplete = true; _encodeComplete = true;