From 167328eab63b97d41538444525211bd6df715e12 Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Thu, 8 Sep 2011 13:05:48 +0000 Subject: [PATCH] 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 --- .../codecs/vp8/main/interface/vp8.h | 2 ++ .../codecs/vp8/main/source/vp8.cc | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/modules/video_coding/codecs/vp8/main/interface/vp8.h b/src/modules/video_coding/codecs/vp8/main/interface/vp8.h index b6620ec73f..f8b13b4848 100644 --- a/src/modules/video_coding/codecs/vp8/main/interface/vp8.h +++ b/src/modules/video_coding/codecs/vp8/main/interface/vp8.h @@ -142,7 +142,9 @@ private: WebRtc_Word32 GetEncodedFrame(const RawImage& input_image); +#if WEBRTC_LIBVPX_VERSION >= 971 WebRtc_Word32 GetEncodedPartitions(const RawImage& input_image); +#endif // Determine maximum target for Intra frames // 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 ec3cdc7f61..b6c84776cc 100644 --- a/src/modules/video_coding/codecs/vp8/main/source/vp8.cc +++ b/src/modules/video_coding/codecs/vp8/main/source/vp8.cc @@ -22,6 +22,7 @@ #include "vpx/vp8cx.h" #include "vpx/vp8dx.h" +#include #include #include #include @@ -618,6 +619,7 @@ VP8Encoder::GetEncodedFrame(const RawImage& input_image) return WEBRTC_VIDEO_CODEC_ERROR; } +#if WEBRTC_LIBVPX_VERSION >= 971 WebRtc_Word32 VP8Encoder::GetEncodedPartitions(const RawImage& input_image) { vpx_codec_iter_t iter = NULL; @@ -666,6 +668,7 @@ VP8Encoder::GetEncodedPartitions(const RawImage& input_image) { &frag_info); return WEBRTC_VIDEO_CODEC_OK; } +#endif WebRtc_Word32 VP8Encoder::SetPacketLoss(WebRtc_UWord32 packetLoss) @@ -702,11 +705,21 @@ VP8Decoder::~VP8Decoder() WebRtc_Word32 VP8Decoder::Reset() { + printf("Reset decoder\n"); if (!_inited) { 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; } @@ -714,6 +727,7 @@ WebRtc_Word32 VP8Decoder::InitDecode(const VideoCodec* inst, WebRtc_Word32 numberOfCores) { + printf("Init decoder\n"); vp8_postproc_cfg_t ppcfg; WebRtc_Word32 retVal = Release(); if (retVal < 0 ) @@ -757,7 +771,7 @@ VP8Decoder::InitDecode(const VideoCodec* inst, vpx_codec_control(_decoder, VP8_SET_POSTPROC, &ppcfg); // Save VideoCodec instance for later; mainly for duplicating the decoder. - if (inst) + if (inst && inst != _inst) { if (!_inst) { @@ -999,6 +1013,7 @@ VP8Decoder::RegisterDecodeCompleteCallback(DecodedImageCallback* callback) WebRtc_Word32 VP8Decoder::Release() { + printf("Release decoder\n"); if (_decodedImage._buffer != NULL) { delete [] _decodedImage._buffer;