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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_
|
|
|
|
|
#define MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_
|
2015-11-18 22:00:21 +01:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdint.h>
|
2016-03-08 03:36:15 -08:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "absl/types/optional.h"
|
|
|
|
|
#include "api/video/video_content_type.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/video/video_frame.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "api/video/video_timing.h"
|
2015-11-18 22:00:21 +01:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
// Error codes
|
2015-12-21 04:12:39 -08:00
|
|
|
#define VCM_FRAME_NOT_READY 3
|
|
|
|
|
#define VCM_MISSING_CALLBACK 1
|
|
|
|
|
#define VCM_OK 0
|
|
|
|
|
#define VCM_GENERAL_ERROR -1
|
|
|
|
|
#define VCM_PARAMETER_ERROR -4
|
2015-11-18 22:00:21 +01:00
|
|
|
#define VCM_NO_CODEC_REGISTERED -8
|
|
|
|
|
#define VCM_JITTER_BUFFER_ERROR -9
|
|
|
|
|
|
2017-06-19 07:18:55 -07:00
|
|
|
enum {
|
|
|
|
|
// Timing frames settings. Timing frames are sent every
|
|
|
|
|
// |kDefaultTimingFramesDelayMs|, or if the frame is at least
|
|
|
|
|
// |kDefaultOutliserFrameSizePercent| in size of average frame.
|
|
|
|
|
kDefaultTimingFramesDelayMs = 200,
|
2018-11-06 12:54:30 +01:00
|
|
|
kDefaultOutlierFrameSizePercent = 500,
|
2017-10-23 10:45:37 +02:00
|
|
|
// Maximum number of frames for what we store encode start timing information.
|
2019-04-24 12:41:16 +02:00
|
|
|
kMaxEncodeStartTimeListSize = 150,
|
2017-06-19 07:18:55 -07:00
|
|
|
};
|
2015-11-18 22:00:21 +01:00
|
|
|
|
|
|
|
|
enum VCMVideoProtection {
|
|
|
|
|
kProtectionNone,
|
|
|
|
|
kProtectionNack,
|
|
|
|
|
kProtectionFEC,
|
|
|
|
|
kProtectionNackFEC,
|
|
|
|
|
};
|
|
|
|
|
|
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:
|
2019-07-01 10:07:50 +02:00
|
|
|
// TODO(kron): Remove once downstream projects are updated.
|
Reland of Add QP sum stats for received streams. (patchset #2 id:300001 of https://codereview.webrtc.org/2680893002/ )
Reason for revert:
Fix the problem.
Original issue's description:
> Revert of Add QP sum stats for received streams. (patchset #10 id:180001 of https://codereview.webrtc.org/2649133005/ )
>
> Reason for revert:
> Breaks downstream build.
>
> Original issue's description:
> > Add QP sum stats for received streams.
> >
> > This is not implemented yet in any of the decoders.
> >
> > BUG=webrtc:6541
> >
> > Review-Url: https://codereview.webrtc.org/2649133005
> > Cr-Commit-Position: refs/heads/master@{#16475}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/ff0e72fd165facac27f0313aa178648782e63bc4
>
> TBR=hta@webrtc.org,hbos@webrtc.org,sprang@webrtc.org,magjed@webrtc.org,stefan@webrtc.org,sakal@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:6541
>
> Review-Url: https://codereview.webrtc.org/2680893002 .
> Cr-Commit-Position: refs/heads/master@{#16480}
> Committed: https://chromium.googlesource.com/external/webrtc/+/69fb2cca4d54f3df7ceddcd1c3e9b0ad80fa849b
TBR=hta@webrtc.org,hbos@webrtc.org,sprang@webrtc.org,magjed@webrtc.org,stefan@webrtc.org,skvlad@webrtc.org
BUG=webrtc:6541
Review-Url: https://codereview.webrtc.org/2681663005
Cr-Commit-Position: refs/heads/master@{#16511}
2017-02-09 04:53:45 -08:00
|
|
|
virtual int32_t FrameToRender(VideoFrame& videoFrame, // NOLINT
|
2018-06-18 10:48:16 +02:00
|
|
|
absl::optional<uint8_t> qp,
|
2019-07-01 10:07:50 +02:00
|
|
|
VideoContentType content_type) {
|
|
|
|
|
// Cannot be pure virtual since this should be removed from derived
|
|
|
|
|
// classes.
|
|
|
|
|
return FrameToRender(videoFrame, qp, 0, content_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual int32_t FrameToRender(VideoFrame& videoFrame, // NOLINT
|
|
|
|
|
absl::optional<uint8_t> qp,
|
|
|
|
|
int32_t decode_time_ms,
|
|
|
|
|
VideoContentType content_type) {
|
|
|
|
|
return FrameToRender(videoFrame, qp, content_type);
|
|
|
|
|
}
|
2017-05-08 02:59:38 -07:00
|
|
|
|
2015-11-18 22:00:21 +01:00
|
|
|
// Called when the current receive codec changes.
|
2018-03-27 08:31:45 +02:00
|
|
|
virtual void OnIncomingPayloadType(int payload_type);
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
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:
|
2017-08-30 03:32:14 -07:00
|
|
|
virtual void OnCompleteFrame(bool is_keyframe,
|
|
|
|
|
size_t size_bytes,
|
|
|
|
|
VideoContentType content_type) = 0;
|
2019-03-28 08:59:07 +01:00
|
|
|
|
2019-07-01 10:07:50 +02:00
|
|
|
virtual void OnFrameBufferTimingsUpdated(int max_decode_ms,
|
2017-02-22 05:30:39 -08:00
|
|
|
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
|
|
|
|
2017-07-06 03:06:50 -07:00
|
|
|
virtual void OnTimingFrameInfoUpdated(const TimingFrameInfo& info) = 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
|
|
|
};
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_
|