blob: ca35ecec429eb2997187219be2c80a720d3bf1cb [file] [log] [blame]
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +00001/*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_COMMON_H_
12#define WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_COMMON_H_
13
14#include <string>
15
16#include "webrtc/common_types.h"
17
18namespace webrtc {
19
20class I420VideoFrame;
21
22namespace newapi {
23
24struct EncodedFrame;
25
26class I420FrameCallback {
27 public:
28 // This function is called with a I420 frame allowing the user to modify the
29 // frame content.
30 virtual void FrameCallback(I420VideoFrame* video_frame) = 0;
31
32 protected:
33 virtual ~I420FrameCallback() {}
34};
35
36class EncodedFrameObserver {
37 public:
38 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) = 0;
39
40 protected:
41 virtual ~EncodedFrameObserver() {}
42};
43
44class VideoRenderer {
45 public:
46 // This function should return as soon as possible and not block until it's
47 // time to render the frame.
48 // TODO(mflodman) Remove time_to_render_ms when I420VideoFrame contains NTP.
49 virtual void RenderFrame(const I420VideoFrame& video_frame,
50 int time_to_render_ms) = 0;
51
52 protected:
53 virtual ~VideoRenderer() {}
54};
55
56class Transport {
57 public:
58 virtual bool SendRTP(const void* packet, size_t length) = 0;
59 virtual bool SendRTCP(const void* packet, size_t length) = 0;
60
61 protected:
62 virtual ~Transport() {}
63};
64
65struct RtpStatistics {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000066 RtpStatistics()
67 : ssrc(0),
68 fraction_loss(0),
69 cumulative_loss(0),
70 extended_max_sequence_number(0) {}
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000071 uint32_t ssrc;
72 int fraction_loss;
73 int cumulative_loss;
74 int extended_max_sequence_number;
75 std::string c_name;
76};
77
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000078// RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000079// RTCP mode is described by RFC 5506.
80enum RtcpMode {
81 kRtcpCompound,
82 kRtcpReducedSize
83};
84
85// Settings for NACK, see RFC 4585 for details.
86struct NackConfig {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000087 NackConfig() : rtp_history_ms(0) {}
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000088 // Send side: the time RTP packets are stored for retransmissions.
89 // Receive side: the time the receiver is prepared to wait for
90 // retransmissions.
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000091 // Set to '0' to disable.
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000092 int rtp_history_ms;
93};
94
95// Settings for forward error correction, see RFC 5109 for details. Set the
96// payload types to '-1' to disable.
97struct FecConfig {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000098 FecConfig() : ulpfec_payload_type(-1), red_payload_type(-1) {}
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000099 // Payload type used for ULPFEC packets.
100 int ulpfec_payload_type;
101
102 // Payload type used for RED packets.
103 int red_payload_type;
104};
105
106// Settings for RTP retransmission payload format, see RFC 4588 for details.
107struct RtxConfig {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +0000108 RtxConfig() : ssrc(0), rtx_payload_type(0), video_payload_type(0) {}
109 // SSRC to use for the RTX stream.
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +0000110 uint32_t ssrc;
111
112 // Payload type to use for the RTX stream.
113 int rtx_payload_type;
114
115 // Original video payload this RTX stream is used for.
116 int video_payload_type;
117};
118
119// RTP header extension to use for the video stream, see RFC 5285.
120struct RtpExtension {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +0000121 RtpExtension() : id(0) {}
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +0000122 // TODO(mflodman) Add API to query supported extensions.
123 std::string name;
124 int id;
125};
126
127} // namespace newapi
128} // namespace webrtc
129
130#endif // WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_COMMON_H_