2017-04-05 03:02:20 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef WEBRTC_API_VIDEO_CODECS_VIDEO_DECODER_H_
|
|
|
|
|
#define WEBRTC_API_VIDEO_CODECS_VIDEO_DECODER_H_
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
Reland of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2853383005/ )
Reason for revert:
Downstream projects have been fixed.
Original issue's description:
> Revert of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2854873003/ )
>
> Reason for revert:
> More downstream breakage discovered.
>
> Original issue's description:
> > Reland of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2854883002/ )
> >
> > Reason for revert:
> > Will make another attempt to track down and fix downstream projects.
> >
> > Original issue's description:
> > > Revert of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2852303002/ )
> > >
> > > Reason for revert:
> > > Unfortunately, more downstream updates needed.
> > >
> > > Original issue's description:
> > > > Reland of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2845333002/ )
> > > >
> > > > Reason for revert:
> > > > Downstream projects being updated.
> > > >
> > > > For Chrome, relanding depends on cl
> > > > https://codereview.chromium.org/2855783003/
> > > >
> > > > Original issue's description:
> > > > > Revert of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #17 id:320001 of https://codereview.webrtc.org/2622263002/ )
> > > > >
> > > > > Reason for revert:
> > > > > Broke Chrome build, see, e.g.,
> > > > > http://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/16237
> > > > >
> > > > > Original issue's description:
> > > > > > Delete deprecated and transitional stuff related to video frame refactoring.
> > > > > >
> > > > > > BUG=webrtc:5880
> > > > > >
> > > > > > Review-Url: https://codereview.webrtc.org/2622263002
> > > > > > Cr-Commit-Position: refs/heads/master@{#17928}
> > > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/713a3bbcc74a4c1a1f54d6dbd0bdaa715f5c1ae1
> > > > >
> > > > > TBR=mflodman@webrtc.org,perkj@webrtc.org
> > > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > > NOPRESUBMIT=true
> > > > > NOTREECHECKS=true
> > > > > NOTRY=true
> > > > > BUG=webrtc:5880
> > > > >
> > > > > Review-Url: https://codereview.webrtc.org/2845333002
> > > > > Cr-Commit-Position: refs/heads/master@{#17929}
> > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/aec49d2b49e1beceb286cbb29ad220aefd0ac648
> > > >
> > > > TBR=mflodman@webrtc.org,perkj@webrtc.org
> > > > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > > > BUG=webrtc:5880
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2852303002
> > > > Cr-Commit-Position: refs/heads/master@{#17974}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/d71ebd70f6c40a37559a7ee2930002a804ad3f13
> > >
> > > TBR=mflodman@webrtc.org,perkj@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:5880
> > >
> > > Review-Url: https://codereview.webrtc.org/2854883002
> > > Cr-Commit-Position: refs/heads/master@{#17978}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/6e6a485a028799501ea4753ceefc811dd826f52f
> >
> > TBR=mflodman@webrtc.org,perkj@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> >
> > BUG=webrtc:5880
> >
> > Review-Url: https://codereview.webrtc.org/2854873003
> > Cr-Commit-Position: refs/heads/master@{#18006}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/3870a071c452dc2e782196bc5bba0375d019b653
>
> TBR=mflodman@webrtc.org,perkj@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5880
>
> Review-Url: https://codereview.webrtc.org/2853383005
> Cr-Commit-Position: refs/heads/master@{#18008}
> Committed: https://chromium.googlesource.com/external/webrtc/+/61b22dde133aff91a0db6a628d87b2ea9134fa15
TBR=mflodman@webrtc.org,perkj@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5880
Review-Url: https://codereview.webrtc.org/2867703002
Cr-Commit-Position: refs/heads/master@{#18081}
2017-05-10 05:25:59 -07:00
|
|
|
#include "webrtc/api/video/video_frame.h"
|
2017-04-05 03:02:20 -07:00
|
|
|
#include "webrtc/common_types.h"
|
2017-05-15 02:42:11 -07:00
|
|
|
#include "webrtc/common_video/include/video_frame.h"
|
2017-04-05 03:02:20 -07:00
|
|
|
#include "webrtc/typedefs.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
class RTPFragmentationHeader;
|
|
|
|
|
// TODO(pbos): Expose these through a public (root) header or change these APIs.
|
|
|
|
|
struct CodecSpecificInfo;
|
|
|
|
|
class VideoCodec;
|
|
|
|
|
|
|
|
|
|
class DecodedImageCallback {
|
|
|
|
|
public:
|
|
|
|
|
virtual ~DecodedImageCallback() {}
|
|
|
|
|
|
|
|
|
|
virtual int32_t Decoded(VideoFrame& decodedImage) = 0;
|
|
|
|
|
// Provides an alternative interface that allows the decoder to specify the
|
|
|
|
|
// decode time excluding waiting time for any previous pending frame to
|
|
|
|
|
// return. This is necessary for breaking positive feedback in the delay
|
|
|
|
|
// estimation when the decoder has a single output buffer.
|
|
|
|
|
virtual int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) {
|
|
|
|
|
// The default implementation ignores custom decode time value.
|
|
|
|
|
return Decoded(decodedImage);
|
|
|
|
|
}
|
|
|
|
|
// TODO(sakal): Remove other implementations when upstream projects have been
|
|
|
|
|
// updated.
|
|
|
|
|
virtual void Decoded(VideoFrame& decodedImage,
|
|
|
|
|
rtc::Optional<int32_t> decode_time_ms,
|
|
|
|
|
rtc::Optional<uint8_t> qp) {
|
|
|
|
|
Decoded(decodedImage,
|
|
|
|
|
decode_time_ms ? static_cast<int32_t>(*decode_time_ms) : -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId) { return -1; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class VideoDecoder {
|
|
|
|
|
public:
|
|
|
|
|
virtual ~VideoDecoder() {}
|
|
|
|
|
|
|
|
|
|
virtual int32_t InitDecode(const VideoCodec* codec_settings,
|
|
|
|
|
int32_t number_of_cores) = 0;
|
|
|
|
|
|
|
|
|
|
virtual int32_t Decode(const EncodedImage& input_image,
|
|
|
|
|
bool missing_frames,
|
|
|
|
|
const RTPFragmentationHeader* fragmentation,
|
|
|
|
|
const CodecSpecificInfo* codec_specific_info = NULL,
|
|
|
|
|
int64_t render_time_ms = -1) = 0;
|
|
|
|
|
|
|
|
|
|
virtual int32_t RegisterDecodeCompleteCallback(
|
|
|
|
|
DecodedImageCallback* callback) = 0;
|
|
|
|
|
|
|
|
|
|
virtual int32_t Release() = 0;
|
|
|
|
|
|
|
|
|
|
// Returns true if the decoder prefer to decode frames late.
|
|
|
|
|
// That is, it can not decode infinite number of frames before the decoded
|
|
|
|
|
// frame is consumed.
|
|
|
|
|
virtual bool PrefersLateDecoding() const { return true; }
|
|
|
|
|
|
|
|
|
|
virtual const char* ImplementationName() const { return "unknown"; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
#endif // WEBRTC_API_VIDEO_CODECS_VIDEO_DECODER_H_
|