blob: 799ea9ad2fe1a5f0e64c807eec37d25ff16bd7f3 [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 {
66 uint32_t ssrc;
67 int fraction_loss;
68 int cumulative_loss;
69 int extended_max_sequence_number;
70 std::string c_name;
71};
72
73// RTCP mode to use. Compound mode is described by RFC 4585 and reduced sized
74// RTCP mode is described by RFC 5506.
75enum RtcpMode {
76 kRtcpCompound,
77 kRtcpReducedSize
78};
79
80// Settings for NACK, see RFC 4585 for details.
81struct NackConfig {
82 // Send side: the time RTP packets are stored for retransmissions.
83 // Receive side: the time the receiver is prepared to wait for
84 // retransmissions.
85 // Set to '0' to disable
86 int rtp_history_ms;
87};
88
89// Settings for forward error correction, see RFC 5109 for details. Set the
90// payload types to '-1' to disable.
91struct FecConfig {
92 // Payload type used for ULPFEC packets.
93 int ulpfec_payload_type;
94
95 // Payload type used for RED packets.
96 int red_payload_type;
97};
98
99// Settings for RTP retransmission payload format, see RFC 4588 for details.
100struct RtxConfig {
101 // SSRC to use for the RTX stream, set to '0' for a random generated SSRC.
102 uint32_t ssrc;
103
104 // Payload type to use for the RTX stream.
105 int rtx_payload_type;
106
107 // Original video payload this RTX stream is used for.
108 int video_payload_type;
109};
110
111// RTP header extension to use for the video stream, see RFC 5285.
112struct RtpExtension {
113 // TODO(mflodman) Add API to query supported extensions.
114 std::string name;
115 int id;
116};
117
118} // namespace newapi
119} // namespace webrtc
120
121#endif // WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_COMMON_H_