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"
|
2022-10-14 14:38:31 +00:00
|
|
|
#include "api/video_codecs/video_decoder.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
|
2021-08-09 13:02:57 +02:00
|
|
|
// `kDefaultTimingFramesDelayMs`, or if the frame is at least
|
2023-08-15 10:20:50 +02:00
|
|
|
// `kDefaultOutlierFrameSizePercent` in size of average frame.
|
2017-06-19 07:18:55 -07:00
|
|
|
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 {
|
|
|
|
|
kProtectionNack,
|
|
|
|
|
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
|
|
|
virtual int32_t FrameToRender(VideoFrame& videoFrame, // NOLINT
|
|
|
|
|
absl::optional<uint8_t> qp,
|
2022-06-17 07:34:23 +02:00
|
|
|
TimeDelta decode_time,
|
2023-08-15 10:20:50 +02:00
|
|
|
VideoContentType content_type,
|
2023-08-15 16:13:37 +02:00
|
|
|
VideoFrameType frame_type) = 0;
|
2017-05-08 02:59:38 -07:00
|
|
|
|
2019-08-26 15:04:43 +02:00
|
|
|
virtual void OnDroppedFrames(uint32_t frames_dropped);
|
|
|
|
|
|
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);
|
2022-10-14 14:38:31 +00:00
|
|
|
virtual void OnDecoderInfoChanged(
|
|
|
|
|
const VideoDecoder::DecoderInfo& decoder_info);
|
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 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_
|