2015-11-18 22:00:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2012 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_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_
|
|
|
|
|
#define WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_
|
|
|
|
|
|
2016-05-02 11:35:24 -07:00
|
|
|
#include <string>
|
2016-03-08 03:36:15 -08:00
|
|
|
#include <vector>
|
|
|
|
|
|
2017-01-10 07:44:26 -08:00
|
|
|
#include "webrtc/api/video/video_frame.h"
|
2015-11-18 22:00:21 +01:00
|
|
|
#include "webrtc/modules/include/module_common_types.h"
|
|
|
|
|
#include "webrtc/typedefs.h"
|
2017-01-10 07:44:26 -08:00
|
|
|
// For EncodedImage
|
2015-11-18 22:00:21 +01:00
|
|
|
#include "webrtc/video_frame.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
// Error codes
|
2015-12-21 04:12:39 -08:00
|
|
|
#define VCM_FRAME_NOT_READY 3
|
|
|
|
|
#define VCM_REQUEST_SLI 2
|
|
|
|
|
#define VCM_MISSING_CALLBACK 1
|
|
|
|
|
#define VCM_OK 0
|
|
|
|
|
#define VCM_GENERAL_ERROR -1
|
|
|
|
|
#define VCM_LEVEL_EXCEEDED -2
|
|
|
|
|
#define VCM_MEMORY -3
|
|
|
|
|
#define VCM_PARAMETER_ERROR -4
|
|
|
|
|
#define VCM_UNKNOWN_PAYLOAD -5
|
|
|
|
|
#define VCM_CODEC_ERROR -6
|
|
|
|
|
#define VCM_UNINITIALIZED -7
|
2015-11-18 22:00:21 +01:00
|
|
|
#define VCM_NO_CODEC_REGISTERED -8
|
|
|
|
|
#define VCM_JITTER_BUFFER_ERROR -9
|
2015-12-21 04:12:39 -08:00
|
|
|
#define VCM_OLD_PACKET_ERROR -10
|
|
|
|
|
#define VCM_NO_FRAME_DECODED -11
|
|
|
|
|
#define VCM_ERROR_REQUEST_SLI -12
|
|
|
|
|
#define VCM_NOT_IMPLEMENTED -20
|
2015-11-18 22:00:21 +01:00
|
|
|
|
|
|
|
|
enum { kDefaultStartBitrateKbps = 300 };
|
|
|
|
|
|
|
|
|
|
enum VCMVideoProtection {
|
|
|
|
|
kProtectionNone,
|
|
|
|
|
kProtectionNack,
|
|
|
|
|
kProtectionFEC,
|
|
|
|
|
kProtectionNackFEC,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum VCMTemporalDecimation {
|
|
|
|
|
kBitrateOverUseDecimation,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct VCMFrameCount {
|
|
|
|
|
uint32_t numKeyFrames;
|
|
|
|
|
uint32_t numDeltaFrames;
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-21 04:12:39 -08:00
|
|
|
// Callback class used for passing decoded frames which are ready to be
|
|
|
|
|
// rendered.
|
2015-11-18 22:00:21 +01:00
|
|
|
class VCMReceiveCallback {
|
|
|
|
|
public:
|
2017-02-07 07:15:17 -08:00
|
|
|
virtual int32_t FrameToRender(VideoFrame& videoFrame, // NOLINT
|
|
|
|
|
rtc::Optional<uint8_t> qp) = 0;
|
2015-12-21 04:12:39 -08:00
|
|
|
virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) {
|
2015-11-18 22:00:21 +01:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
// Called when the current receive codec changes.
|
|
|
|
|
virtual void OnIncomingPayloadType(int payload_type) {}
|
2015-12-18 16:01:11 +01:00
|
|
|
virtual void OnDecoderImplementationName(const char* implementation_name) {}
|
2015-11-18 22:00:21 +01:00
|
|
|
|
|
|
|
|
protected:
|
2015-12-21 04:12:39 -08:00
|
|
|
virtual ~VCMReceiveCallback() {}
|
2015-11-18 22:00:21 +01:00
|
|
|
};
|
|
|
|
|
|
2016-05-02 11:35:24 -07:00
|
|
|
// Callback class used for informing the user of the bit rate and frame rate,
|
|
|
|
|
// and the name of the encoder.
|
2015-11-18 22:00:21 +01:00
|
|
|
class VCMSendStatisticsCallback {
|
|
|
|
|
public:
|
2016-09-01 00:21:16 -07:00
|
|
|
virtual void SendStatistics(uint32_t bitRate, uint32_t frameRate) = 0;
|
2015-11-18 22:00:21 +01:00
|
|
|
|
|
|
|
|
protected:
|
2015-12-21 04:12:39 -08:00
|
|
|
virtual ~VCMSendStatisticsCallback() {}
|
2015-11-18 22:00:21 +01:00
|
|
|
};
|
|
|
|
|
|
2015-12-21 04:12:39 -08:00
|
|
|
// Callback class used for informing the user of the incoming bit rate and frame
|
|
|
|
|
// rate.
|
2015-11-18 22:00:21 +01:00
|
|
|
class VCMReceiveStatisticsCallback {
|
|
|
|
|
public:
|
|
|
|
|
virtual void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) = 0;
|
Reland of Make the new jitter buffer the default jitter buffer. (patchset #2 id:260001 of https://codereview.chromium.org/2656983002/ )
Reason for revert:
Incoming fix: https://codereview.chromium.org/2675693002/
Original issue's description:
> Revert of Make the new jitter buffer the default jitter buffer. (patchset #2 id:290001 of https://codereview.chromium.org/2652043005/ )
>
> Reason for revert:
> Breaks downstream bots
>
> Original issue's description:
> > Reland of Make the new jitter buffer the default jitter buffer. (patchset #1 id:1 of https://codereview.webrtc.org/2638423003/ )
> >
> > Reason for revert:
> > Bugfixes related to the new jitter buffer has landed.
> >
> > Original issue's description:
> > > Revert of Make the new jitter buffer the default jitter buffer. (patchset #2 id:230001 of https://codereview.webrtc.org/2642753002/ )
> > >
> > > Reason for revert:
> > > Breaks tests downstream.
> > >
> > > Original issue's description:
> > > > Reland of Make the new jitter buffer the default jitter buffer. (patchset #1 id:1 of https://codereview.chromium.org/2632123005/ )
> > > >
> > > > Reason for revert:
> > > > Fix in this CL: https://codereview.chromium.org/2640793003/
> > > >
> > > > Original issue's description:
> > > > > Revert of Make the new jitter buffer the default jitter buffer. (patchset #7 id:120001 of https://codereview.chromium.org/2627463004/ )
> > > > >
> > > > > Reason for revert:
> > > > > Breaks android bots.
> > > > >
> > > > > Original issue's description:
> > > > > > Make the new jitter buffer the default jitter buffer.
> > > > > >
> > > > > > This CL contains only the changes necessary to make the switch to the new jitter
> > > > > > buffer, clean up will be done in follow up CLs.
> > > > > >
> > > > > > In this CL:
> > > > > > - Removed the WebRTC-NewVideoJitterBuffer experiment and made the
> > > > > > new video jitter buffer the default one.
> > > > > > - Moved WebRTC.Video.KeyFramesReceivedInPermille and
> > > > > > WebRTC.Video.JitterBufferDelayInMs to the ReceiveStatisticsProxy.
> > > > > >
> > > > > > BUG=webrtc:5514
> > > > > >
> > > > > > Review-Url: https://codereview.webrtc.org/2627463004
> > > > > > Cr-Commit-Position: refs/heads/master@{#16114}
> > > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/0f0763d86d5d4e7f27e8dece02560e39c6da97d6
> > > > >
> > > > > TBR=stefan@webrtc.org,terelius@webrtc.org
> > > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > > NOPRESUBMIT=true
> > > > > NOTREECHECKS=true
> > > > > NOTRY=true
> > > > > BUG=webrtc:5514
> > > > >
> > > > > Review-Url: https://codereview.webrtc.org/2632123005
> > > > > Cr-Commit-Position: refs/heads/master@{#16117}
> > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/c08c191f7d206dc0de945185370d18f29d556931
> > > >
> > > > TBR=stefan@webrtc.org,terelius@webrtc.org
> > > > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > > > BUG=webrtc:5514
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2642753002
> > > > Cr-Commit-Position: refs/heads/master@{#16149}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/f20dd0014d1cfc8a2e859a9e177e7fe2b21274ca
> > >
> > > TBR=stefan@webrtc.org,terelius@webrtc.org,philipel@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:5514
> > >
> > > Review-Url: https://codereview.webrtc.org/2638423003
> > > Cr-Commit-Position: refs/heads/master@{#16159}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/04926b82641c426d764aa6e013e133db519129db
> >
> > TBR=stefan@webrtc.org,terelius@webrtc.org,kjellander@webrtc.org,kjellander@google.com
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:5514
> >
> > Review-Url: https://codereview.webrtc.org/2652043005
> > Cr-Commit-Position: refs/heads/master@{#16293}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/09d6ef00fc21b9f2c2c27e50e5e2952329ac4b4b
>
> TBR=stefan@webrtc.org,terelius@webrtc.org,kjellander@webrtc.org,kjellander@google.com
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5514
>
> Review-Url: https://codereview.webrtc.org/2656983002
> Cr-Commit-Position: refs/heads/master@{#16316}
> Committed: https://chromium.googlesource.com/external/webrtc/+/27378f39ced81acb1c2a61808e5e42fcf65d4b8d
TBR=stefan@webrtc.org,terelius@webrtc.org,kjellander@webrtc.org,kjellander@google.com
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5514
Review-Url: https://codereview.webrtc.org/2670183002
Cr-Commit-Position: refs/heads/master@{#16420}
2017-02-02 09:53:00 -08:00
|
|
|
virtual void OnCompleteFrame(bool is_keyframe, size_t size_bytes) = 0;
|
2015-11-18 22:00:21 +01:00
|
|
|
virtual void OnDiscardedPacketsUpdated(int discarded_packets) = 0;
|
|
|
|
|
virtual void OnFrameCountsUpdated(const FrameCounts& frame_counts) = 0;
|
Reland of Make the new jitter buffer the default jitter buffer. (patchset #2 id:260001 of https://codereview.chromium.org/2656983002/ )
Reason for revert:
Incoming fix: https://codereview.chromium.org/2675693002/
Original issue's description:
> Revert of Make the new jitter buffer the default jitter buffer. (patchset #2 id:290001 of https://codereview.chromium.org/2652043005/ )
>
> Reason for revert:
> Breaks downstream bots
>
> Original issue's description:
> > Reland of Make the new jitter buffer the default jitter buffer. (patchset #1 id:1 of https://codereview.webrtc.org/2638423003/ )
> >
> > Reason for revert:
> > Bugfixes related to the new jitter buffer has landed.
> >
> > Original issue's description:
> > > Revert of Make the new jitter buffer the default jitter buffer. (patchset #2 id:230001 of https://codereview.webrtc.org/2642753002/ )
> > >
> > > Reason for revert:
> > > Breaks tests downstream.
> > >
> > > Original issue's description:
> > > > Reland of Make the new jitter buffer the default jitter buffer. (patchset #1 id:1 of https://codereview.chromium.org/2632123005/ )
> > > >
> > > > Reason for revert:
> > > > Fix in this CL: https://codereview.chromium.org/2640793003/
> > > >
> > > > Original issue's description:
> > > > > Revert of Make the new jitter buffer the default jitter buffer. (patchset #7 id:120001 of https://codereview.chromium.org/2627463004/ )
> > > > >
> > > > > Reason for revert:
> > > > > Breaks android bots.
> > > > >
> > > > > Original issue's description:
> > > > > > Make the new jitter buffer the default jitter buffer.
> > > > > >
> > > > > > This CL contains only the changes necessary to make the switch to the new jitter
> > > > > > buffer, clean up will be done in follow up CLs.
> > > > > >
> > > > > > In this CL:
> > > > > > - Removed the WebRTC-NewVideoJitterBuffer experiment and made the
> > > > > > new video jitter buffer the default one.
> > > > > > - Moved WebRTC.Video.KeyFramesReceivedInPermille and
> > > > > > WebRTC.Video.JitterBufferDelayInMs to the ReceiveStatisticsProxy.
> > > > > >
> > > > > > BUG=webrtc:5514
> > > > > >
> > > > > > Review-Url: https://codereview.webrtc.org/2627463004
> > > > > > Cr-Commit-Position: refs/heads/master@{#16114}
> > > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/0f0763d86d5d4e7f27e8dece02560e39c6da97d6
> > > > >
> > > > > TBR=stefan@webrtc.org,terelius@webrtc.org
> > > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > > NOPRESUBMIT=true
> > > > > NOTREECHECKS=true
> > > > > NOTRY=true
> > > > > BUG=webrtc:5514
> > > > >
> > > > > Review-Url: https://codereview.webrtc.org/2632123005
> > > > > Cr-Commit-Position: refs/heads/master@{#16117}
> > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/c08c191f7d206dc0de945185370d18f29d556931
> > > >
> > > > TBR=stefan@webrtc.org,terelius@webrtc.org
> > > > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > > > BUG=webrtc:5514
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2642753002
> > > > Cr-Commit-Position: refs/heads/master@{#16149}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/f20dd0014d1cfc8a2e859a9e177e7fe2b21274ca
> > >
> > > TBR=stefan@webrtc.org,terelius@webrtc.org,philipel@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:5514
> > >
> > > Review-Url: https://codereview.webrtc.org/2638423003
> > > Cr-Commit-Position: refs/heads/master@{#16159}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/04926b82641c426d764aa6e013e133db519129db
> >
> > TBR=stefan@webrtc.org,terelius@webrtc.org,kjellander@webrtc.org,kjellander@google.com
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:5514
> >
> > Review-Url: https://codereview.webrtc.org/2652043005
> > Cr-Commit-Position: refs/heads/master@{#16293}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/09d6ef00fc21b9f2c2c27e50e5e2952329ac4b4b
>
> TBR=stefan@webrtc.org,terelius@webrtc.org,kjellander@webrtc.org,kjellander@google.com
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5514
>
> Review-Url: https://codereview.webrtc.org/2656983002
> Cr-Commit-Position: refs/heads/master@{#16316}
> Committed: https://chromium.googlesource.com/external/webrtc/+/27378f39ced81acb1c2a61808e5e42fcf65d4b8d
TBR=stefan@webrtc.org,terelius@webrtc.org,kjellander@webrtc.org,kjellander@google.com
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5514
Review-Url: https://codereview.webrtc.org/2670183002
Cr-Commit-Position: refs/heads/master@{#16420}
2017-02-02 09:53:00 -08:00
|
|
|
virtual void OnFrameBufferTimingsUpdated(int decode_ms,
|
|
|
|
|
int max_decode_ms,
|
|
|
|
|
int current_delay_ms,
|
|
|
|
|
int target_delay_ms,
|
|
|
|
|
int jitter_buffer_ms,
|
|
|
|
|
int min_playout_delay_ms,
|
|
|
|
|
int render_delay_ms) = 0;
|
2015-11-18 22:00:21 +01:00
|
|
|
|
|
|
|
|
protected:
|
2015-12-21 04:12:39 -08:00
|
|
|
virtual ~VCMReceiveStatisticsCallback() {}
|
2015-11-18 22:00:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Callback class used for informing the user of decode timing info.
|
|
|
|
|
class VCMDecoderTimingCallback {
|
|
|
|
|
public:
|
|
|
|
|
virtual void OnDecoderTiming(int decode_ms,
|
|
|
|
|
int max_decode_ms,
|
|
|
|
|
int current_delay_ms,
|
|
|
|
|
int target_delay_ms,
|
|
|
|
|
int jitter_buffer_ms,
|
|
|
|
|
int min_playout_delay_ms,
|
|
|
|
|
int render_delay_ms) = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual ~VCMDecoderTimingCallback() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Callback class used for telling the user about how to configure the FEC,
|
|
|
|
|
// and the rates sent the last second is returned to the VCM.
|
|
|
|
|
class VCMProtectionCallback {
|
|
|
|
|
public:
|
|
|
|
|
virtual int ProtectionRequest(const FecProtectionParams* delta_params,
|
|
|
|
|
const FecProtectionParams* key_params,
|
|
|
|
|
uint32_t* sent_video_rate_bps,
|
|
|
|
|
uint32_t* sent_nack_rate_bps,
|
|
|
|
|
uint32_t* sent_fec_rate_bps) = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
2015-12-21 04:12:39 -08:00
|
|
|
virtual ~VCMProtectionCallback() {}
|
2015-11-18 22:00:21 +01:00
|
|
|
};
|
|
|
|
|
|
2015-12-21 04:12:39 -08:00
|
|
|
// Callback class used for telling the user about what frame type needed to
|
|
|
|
|
// continue decoding.
|
2015-11-18 22:00:21 +01:00
|
|
|
// Typically a key frame when the stream has been corrupted in some way.
|
|
|
|
|
class VCMFrameTypeCallback {
|
|
|
|
|
public:
|
|
|
|
|
virtual int32_t RequestKeyFrame() = 0;
|
2015-12-21 04:12:39 -08:00
|
|
|
virtual int32_t SliceLossIndicationRequest(const uint64_t pictureId) {
|
2015-11-18 22:00:21 +01:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
2015-12-21 04:12:39 -08:00
|
|
|
virtual ~VCMFrameTypeCallback() {}
|
2015-11-18 22:00:21 +01:00
|
|
|
};
|
|
|
|
|
|
2015-12-21 04:12:39 -08:00
|
|
|
// Callback class used for telling the user about which packet sequence numbers
|
|
|
|
|
// are currently
|
2015-11-18 22:00:21 +01:00
|
|
|
// missing and need to be resent.
|
2016-03-08 03:36:15 -08:00
|
|
|
// TODO(philipel): Deprecate VCMPacketRequestCallback
|
|
|
|
|
// and use NackSender instead.
|
2015-11-18 22:00:21 +01:00
|
|
|
class VCMPacketRequestCallback {
|
|
|
|
|
public:
|
|
|
|
|
virtual int32_t ResendPackets(const uint16_t* sequenceNumbers,
|
2015-12-21 04:12:39 -08:00
|
|
|
uint16_t length) = 0;
|
2015-11-18 22:00:21 +01:00
|
|
|
|
|
|
|
|
protected:
|
2015-12-21 04:12:39 -08:00
|
|
|
virtual ~VCMPacketRequestCallback() {}
|
2015-11-18 22:00:21 +01:00
|
|
|
};
|
|
|
|
|
|
2016-03-08 03:36:15 -08:00
|
|
|
class NackSender {
|
|
|
|
|
public:
|
|
|
|
|
virtual void SendNack(const std::vector<uint16_t>& sequence_numbers) = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual ~NackSender() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class KeyFrameRequestSender {
|
|
|
|
|
public:
|
|
|
|
|
virtual void RequestKeyFrame() = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual ~KeyFrameRequestSender() {}
|
|
|
|
|
};
|
|
|
|
|
|
2015-11-18 22:00:21 +01:00
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2015-12-21 04:12:39 -08:00
|
|
|
#endif // WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_
|