Disable libvpx partitions code for libvpx versions prior Cayuga.

Necessary for WebRTC to build with Chromium. 
Also fixes the decoder wrapper's Reset() function so that properly
reinitializes the decoder.
Review URL: http://webrtc-codereview.appspot.com/132012

git-svn-id: http://webrtc.googlecode.com/svn/trunk@562 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2011-09-08 13:05:48 +00:00
parent 9e812fca9f
commit 167328eab6
2 changed files with 19 additions and 2 deletions

View File

@@ -142,7 +142,9 @@ private:
WebRtc_Word32 GetEncodedFrame(const RawImage& input_image); WebRtc_Word32 GetEncodedFrame(const RawImage& input_image);
#if WEBRTC_LIBVPX_VERSION >= 971
WebRtc_Word32 GetEncodedPartitions(const RawImage& input_image); WebRtc_Word32 GetEncodedPartitions(const RawImage& input_image);
#endif
// Determine maximum target for Intra frames // Determine maximum target for Intra frames
// //

View File

@@ -22,6 +22,7 @@
#include "vpx/vp8cx.h" #include "vpx/vp8cx.h"
#include "vpx/vp8dx.h" #include "vpx/vp8dx.h"
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
@@ -618,6 +619,7 @@ VP8Encoder::GetEncodedFrame(const RawImage& input_image)
return WEBRTC_VIDEO_CODEC_ERROR; return WEBRTC_VIDEO_CODEC_ERROR;
} }
#if WEBRTC_LIBVPX_VERSION >= 971
WebRtc_Word32 WebRtc_Word32
VP8Encoder::GetEncodedPartitions(const RawImage& input_image) { VP8Encoder::GetEncodedPartitions(const RawImage& input_image) {
vpx_codec_iter_t iter = NULL; vpx_codec_iter_t iter = NULL;
@@ -666,6 +668,7 @@ VP8Encoder::GetEncodedPartitions(const RawImage& input_image) {
&frag_info); &frag_info);
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
} }
#endif
WebRtc_Word32 WebRtc_Word32
VP8Encoder::SetPacketLoss(WebRtc_UWord32 packetLoss) VP8Encoder::SetPacketLoss(WebRtc_UWord32 packetLoss)
@@ -702,11 +705,21 @@ VP8Decoder::~VP8Decoder()
WebRtc_Word32 WebRtc_Word32
VP8Decoder::Reset() VP8Decoder::Reset()
{ {
printf("Reset decoder\n");
if (!_inited) if (!_inited)
{ {
return WEBRTC_VIDEO_CODEC_UNINITIALIZED; return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
} }
InitDecode(NULL, 1); if (_inst != NULL)
{
VideoCodec inst;
inst = *_inst;
InitDecode(&inst, _numCores);
}
else
{
InitDecode(NULL, _numCores);
}
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
} }
@@ -714,6 +727,7 @@ WebRtc_Word32
VP8Decoder::InitDecode(const VideoCodec* inst, VP8Decoder::InitDecode(const VideoCodec* inst,
WebRtc_Word32 numberOfCores) WebRtc_Word32 numberOfCores)
{ {
printf("Init decoder\n");
vp8_postproc_cfg_t ppcfg; vp8_postproc_cfg_t ppcfg;
WebRtc_Word32 retVal = Release(); WebRtc_Word32 retVal = Release();
if (retVal < 0 ) if (retVal < 0 )
@@ -757,7 +771,7 @@ VP8Decoder::InitDecode(const VideoCodec* inst,
vpx_codec_control(_decoder, VP8_SET_POSTPROC, &ppcfg); vpx_codec_control(_decoder, VP8_SET_POSTPROC, &ppcfg);
// Save VideoCodec instance for later; mainly for duplicating the decoder. // Save VideoCodec instance for later; mainly for duplicating the decoder.
if (inst) if (inst && inst != _inst)
{ {
if (!_inst) if (!_inst)
{ {
@@ -999,6 +1013,7 @@ VP8Decoder::RegisterDecodeCompleteCallback(DecodedImageCallback* callback)
WebRtc_Word32 WebRtc_Word32
VP8Decoder::Release() VP8Decoder::Release()
{ {
printf("Release decoder\n");
if (_decodedImage._buffer != NULL) if (_decodedImage._buffer != NULL)
{ {
delete [] _decodedImage._buffer; delete [] _decodedImage._buffer;