Revert "Delete deprecated variant of VideoDecoder::Decode"

This reverts commit 3a86d9520c9692abe4c6d2a73faf4fb7a0cb80b2.

Reason for revert: breaks downstream project

Original change's description:
> Delete deprecated variant of VideoDecoder::Decode
> 
> Bug: webrtc:10379
> Change-Id: I4dd8b503625a9ea2a71177165238e128ac3e49bb
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132554
> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#27712}

TBR=brandtr@webrtc.org,sakal@webrtc.org,nisse@webrtc.org,kthelgason@webrtc.org,sprang@webrtc.org

Change-Id: Ie971fd821f4de9e4b68e1608d7074835bdf2ed16
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10379
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133907
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27713}
This commit is contained in:
Danil Chapovalov 2019-04-23 12:52:02 +00:00 committed by Commit Bot
parent 3a86d9520c
commit d8bf2d4986
7 changed files with 43 additions and 2 deletions

View File

@ -28,6 +28,19 @@ int32_t DecodedImageCallback::ReceivedDecodedFrame(const uint64_t pictureId) {
return -1;
}
int32_t VideoDecoder::Decode(const EncodedImage& input_image,
bool missing_frames,
int64_t render_time_ms) {
return Decode(input_image, missing_frames, nullptr, render_time_ms);
}
int32_t VideoDecoder::Decode(const EncodedImage& input_image,
bool missing_frames,
const CodecSpecificInfo* codec_specific_info,
int64_t render_time_ms) {
return Decode(input_image, missing_frames, render_time_ms);
}
bool VideoDecoder::PrefersLateDecoding() const {
return true;
}

View File

@ -22,6 +22,10 @@
namespace webrtc {
// TODO(pbos): Expose these through a public (root) header or change these APIs.
struct CodecSpecificInfo;
class VideoCodec;
class RTC_EXPORT DecodedImageCallback {
public:
virtual ~DecodedImageCallback() {}
@ -51,7 +55,14 @@ class RTC_EXPORT VideoDecoder {
virtual int32_t Decode(const EncodedImage& input_image,
bool missing_frames,
int64_t render_time_ms) = 0;
int64_t render_time_ms);
// TODO(bugs.webrtc.org/10379): Deprecated. Delete, and make above method pure
// virtual, as soon as downstream applications are updated.
virtual int32_t Decode(const EncodedImage& input_image,
bool missing_frames,
const CodecSpecificInfo* codec_specific_info,
int64_t render_time_ms);
virtual int32_t RegisterDecodeCompleteCallback(
DecodedImageCallback* callback) = 0;

View File

@ -65,6 +65,7 @@ class MediaCodecVideoDecoder : public VideoDecoder, public rtc::MessageHandler {
int32_t Decode(const EncodedImage& inputImage,
bool missingFrames,
const CodecSpecificInfo* codecSpecificInfo = NULL,
int64_t renderTimeMs = -1) override;
int32_t RegisterDecodeCompleteCallback(
@ -349,6 +350,7 @@ int32_t MediaCodecVideoDecoder::ProcessHWErrorOnCodecThread() {
int32_t MediaCodecVideoDecoder::Decode(
const EncodedImage& inputImage,
bool missingFrames,
const CodecSpecificInfo* codecSpecificInfo,
int64_t renderTimeMs) {
if (sw_fallback_required_) {
ALOGE << "Decode() - fallback to SW codec";

View File

@ -88,6 +88,7 @@ int32_t VideoDecoderWrapper::InitDecodeInternal(JNIEnv* jni) {
int32_t VideoDecoderWrapper::Decode(
const EncodedImage& image_param,
bool missing_frames,
const CodecSpecificInfo* codec_specific_info,
int64_t render_time_ms) {
RTC_DCHECK_RUN_ON(&decoder_thread_checker_);
if (!initialized_) {

View File

@ -35,6 +35,7 @@ class VideoDecoderWrapper : public VideoDecoder {
int32_t Decode(const EncodedImage& input_image,
bool missing_frames,
const CodecSpecificInfo* codec_specific_info,
int64_t render_time_ms) override;
int32_t RegisterDecodeCompleteCallback(

View File

@ -51,13 +51,25 @@ class ObjCVideoDecoder : public VideoDecoder {
int32_t Decode(const EncodedImage &input_image,
bool missing_frames,
const CodecSpecificInfo *codec_specific_info = NULL,
int64_t render_time_ms = -1) override {
RTCEncodedImage *encodedImage =
[[RTCEncodedImage alloc] initWithNativeEncodedImage:input_image];
// webrtc::CodecSpecificInfo only handles a hard coded list of codecs
id<RTCCodecSpecificInfo> rtcCodecSpecificInfo = nil;
if (codec_specific_info) {
if (codec_specific_info->codecType == kVideoCodecH264) {
RTCCodecSpecificInfoH264 *h264Info = [[RTCCodecSpecificInfoH264 alloc] init];
h264Info.packetizationMode =
(RTCH264PacketizationMode)codec_specific_info->codecSpecific.H264.packetization_mode;
rtcCodecSpecificInfo = h264Info;
}
}
return [decoder_ decode:encodedImage
missingFrames:missing_frames
codecSpecificInfo:nil
codecSpecificInfo:rtcCodecSpecificInfo
renderTimeMs:render_time_ms];
}

View File

@ -210,6 +210,7 @@ VideoStreamDecoderImpl::DecodeResult VideoStreamDecoderImpl::DecodeNextFrame(
int32_t decode_result = decoder->Decode(frame->EncodedImage(),
false, // missing_frame
nullptr, // codec specific info
frame->RenderTimeMs());
return decode_result == WEBRTC_VIDEO_CODEC_OK ? kOk : kDecodeFailure;