Skip to content

Commit

Permalink
Remove unused VideoDecoder methods.
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
Peter Boström committed May 21, 2015
1 parent 1a07a1e commit b302ad4
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 116 deletions.
5 changes: 0 additions & 5 deletions webrtc/modules/video_coding/codecs/i420/main/interface/i420.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
80 changes: 0 additions & 80 deletions webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(ref_frame_->img.d_w) ||
last_frame_height_ != static_cast<int>(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<vpx_img_fmt_t>(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<VideoDecoder*>(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.
Expand Down
16 changes: 6 additions & 10 deletions webrtc/modules/video_coding/codecs/vp8/vp8_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions webrtc/modules/video_coding/main/source/generic_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions webrtc/modules/video_coding/main/source/generic_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ class VCMGenericDecoder
*/
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.
*/
Expand Down
7 changes: 0 additions & 7 deletions webrtc/video_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b302ad4

Please sign in to comment.