From b302ad4eab114eb76c3d4531bd92ae8a4e454761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= Date: Thu, 21 May 2015 09:42:33 +0200 Subject: [PATCH] Remove unused VideoDecoder methods. Removing VideoDecoder::Copy() and VideoDecoder::SetCodecConfigParameters(). Also adding override to VP8DecoderImpl. BUG= R=mflodman@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/55409004 Cr-Commit-Position: refs/heads/master@{#9244} --- .../codecs/i420/main/interface/i420.h | 5 -- .../video_coding/codecs/vp8/vp8_impl.cc | 80 ------------------- .../video_coding/codecs/vp8/vp8_impl.h | 16 ++-- .../main/source/generic_decoder.cc | 5 -- .../main/source/generic_decoder.h | 9 --- webrtc/video_decoder.h | 7 -- 6 files changed, 6 insertions(+), 116 deletions(-) diff --git a/webrtc/modules/video_coding/codecs/i420/main/interface/i420.h b/webrtc/modules/video_coding/codecs/i420/main/interface/i420.h index e1a13df76..f8204b538 100644 --- a/webrtc/modules/video_coding/codecs/i420/main/interface/i420.h +++ b/webrtc/modules/video_coding/codecs/i420/main/interface/i420.h @@ -102,11 +102,6 @@ class I420Decoder : public VideoDecoder { int InitDecode(const VideoCodec* codecSettings, int /*numberOfCores*/) override; - int SetCodecConfigParameters(const uint8_t* /*buffer*/, - int /*size*/) override { - return WEBRTC_VIDEO_CODEC_OK; - } - // Decode encoded image (as a part of a video stream). The decoded image // will be returned to the user through the decode complete callback. // diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc index c2127f09c..7ab369196 100644 --- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc +++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc @@ -1390,86 +1390,6 @@ int VP8DecoderImpl::Release() { return WEBRTC_VIDEO_CODEC_OK; } -VideoDecoder* VP8DecoderImpl::Copy() { - // Sanity checks. - if (!inited_) { - // Not initialized. - assert(false); - return NULL; - } - if (last_frame_width_ == 0 || last_frame_height_ == 0) { - // Nothing has been decoded before; cannot clone. - return NULL; - } - if (last_keyframe_._buffer == NULL) { - // Cannot clone if we have no key frame to start with. - return NULL; - } - // Create a new VideoDecoder object - VP8DecoderImpl* copy = new VP8DecoderImpl; - - // Initialize the new decoder - if (copy->InitDecode(&codec_, 1) != WEBRTC_VIDEO_CODEC_OK) { - delete copy; - return NULL; - } - // Inject last key frame into new decoder. - if (vpx_codec_decode(copy->decoder_, last_keyframe_._buffer, - last_keyframe_._length, NULL, VPX_DL_REALTIME)) { - delete copy; - return NULL; - } - // Allocate memory for reference image copy - assert(last_frame_width_ > 0); - assert(last_frame_height_ > 0); - assert(image_format_ > VPX_IMG_FMT_NONE); - // Check if frame format has changed. - if (ref_frame_ && - (last_frame_width_ != static_cast(ref_frame_->img.d_w) || - last_frame_height_ != static_cast(ref_frame_->img.d_h) || - image_format_ != ref_frame_->img.fmt)) { - vpx_img_free(&ref_frame_->img); - delete ref_frame_; - ref_frame_ = NULL; - } - - - if (!ref_frame_) { - ref_frame_ = new vpx_ref_frame_t; - // Setting alignment to 32 - as that ensures at least 16 for all - // planes (32 for Y, 16 for U,V) - libvpx sets the requested stride - // for the y plane, but only half of it to the u and v planes. - if (!vpx_img_alloc(&ref_frame_->img, - static_cast(image_format_), - last_frame_width_, last_frame_height_, - kVp832ByteAlign)) { - assert(false); - delete copy; - return NULL; - } - } - const vpx_ref_frame_type_t type_vec[] = { VP8_LAST_FRAME, VP8_GOLD_FRAME, - VP8_ALTR_FRAME }; - for (uint32_t ix = 0; - ix < sizeof(type_vec) / sizeof(vpx_ref_frame_type_t); ++ix) { - ref_frame_->frame_type = type_vec[ix]; - if (CopyReference(copy) < 0) { - delete copy; - return NULL; - } - } - // Copy all member variables (that are not set in initialization). - copy->feedback_mode_ = feedback_mode_; - copy->image_format_ = image_format_; - copy->last_keyframe_ = last_keyframe_; // Shallow copy. - // Allocate memory. (Discard copied _buffer pointer.) - copy->last_keyframe_._buffer = new uint8_t[last_keyframe_._size]; - memcpy(copy->last_keyframe_._buffer, last_keyframe_._buffer, - last_keyframe_._length); - - return static_cast(copy); -} - int VP8DecoderImpl::CopyReference(VP8DecoderImpl* copy) { // The type of frame to copy should be set in ref_frame_->frame_type // before the call to this function. diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h index d9c4f4bd2..fd5d606d4 100644 --- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h +++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h @@ -128,21 +128,17 @@ class VP8DecoderImpl : public VP8Decoder { virtual ~VP8DecoderImpl(); - virtual int InitDecode(const VideoCodec* inst, int number_of_cores); + int InitDecode(const VideoCodec* inst, int number_of_cores) override; - virtual int Decode(const EncodedImage& input_image, + int Decode(const EncodedImage& input_image, bool missing_frames, const RTPFragmentationHeader* fragmentation, const CodecSpecificInfo* codec_specific_info, - int64_t /*render_time_ms*/); + int64_t /*render_time_ms*/) override; - virtual int RegisterDecodeCompleteCallback(DecodedImageCallback* callback); - - virtual int Release(); - - virtual int Reset(); - - virtual VideoDecoder* Copy(); + int RegisterDecodeCompleteCallback(DecodedImageCallback* callback) override; + int Release() override; + int Reset() override; private: // Copy reference image from this _decoder to the _decoder in copyTo. Set diff --git a/webrtc/modules/video_coding/main/source/generic_decoder.cc b/webrtc/modules/video_coding/main/source/generic_decoder.cc index 88bc75ae9..f8b45b5d8 100644 --- a/webrtc/modules/video_coding/main/source/generic_decoder.cc +++ b/webrtc/modules/video_coding/main/source/generic_decoder.cc @@ -186,11 +186,6 @@ int32_t VCMGenericDecoder::Reset() return _decoder.Reset(); } -int32_t VCMGenericDecoder::SetCodecConfigParameters(const uint8_t* buffer, int32_t size) -{ - return _decoder.SetCodecConfigParameters(buffer, size); -} - int32_t VCMGenericDecoder::RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback) { _callback = callback; diff --git a/webrtc/modules/video_coding/main/source/generic_decoder.h b/webrtc/modules/video_coding/main/source/generic_decoder.h index fab94bc87..3befeb0c4 100644 --- a/webrtc/modules/video_coding/main/source/generic_decoder.h +++ b/webrtc/modules/video_coding/main/source/generic_decoder.h @@ -90,15 +90,6 @@ public: */ int32_t Reset(); - /** - * Codec configuration data sent out-of-band, i.e. in SIP call setup - * - * buffer pointer to the configuration data - * size the size of the configuration data in bytes - */ - int32_t SetCodecConfigParameters(const uint8_t* /*buffer*/, - int32_t /*size*/); - /** * Set decode callback. Deregistering while decoding is illegal. */ diff --git a/webrtc/video_decoder.h b/webrtc/video_decoder.h index 6ebc39245..d4770e7bc 100644 --- a/webrtc/video_decoder.h +++ b/webrtc/video_decoder.h @@ -62,13 +62,6 @@ class VideoDecoder { virtual int32_t Release() = 0; virtual int32_t Reset() = 0; - - virtual int32_t SetCodecConfigParameters(const uint8_t* /*buffer*/, - int32_t /*size*/) { - return -1; - } - - virtual VideoDecoder* Copy() { return NULL; } }; // Class used to wrap external VideoDecoders to provide a fallback option on