OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 enum RtcpMode { kRtcpCompound, kRtcpReducedSize }; | 29 enum RtcpMode { kRtcpCompound, kRtcpReducedSize }; |
30 } // namespace newapi | 30 } // namespace newapi |
31 | 31 |
32 class VideoDecoder; | 32 class VideoDecoder; |
33 | 33 |
34 class VideoReceiveStream { | 34 class VideoReceiveStream { |
35 public: | 35 public: |
36 // TODO(mflodman) Move all these settings to VideoDecoder and move the | 36 // TODO(mflodman) Move all these settings to VideoDecoder and move the |
37 // declaration to common_types.h. | 37 // declaration to common_types.h. |
38 struct Decoder { | 38 struct Decoder { |
39 Decoder() | |
40 : decoder(NULL), | |
41 payload_type(0), | |
42 is_renderer(false), | |
43 expected_delay_ms(0) {} | |
44 std::string ToString() const; | 39 std::string ToString() const; |
45 | 40 |
46 // The actual decoder instance. | 41 // The actual decoder instance. |
47 VideoDecoder* decoder; | 42 VideoDecoder* decoder = nullptr; |
48 | 43 |
49 // Received RTP packets with this payload type will be sent to this decoder | 44 // Received RTP packets with this payload type will be sent to this decoder |
50 // instance. | 45 // instance. |
51 int payload_type; | 46 int payload_type = 0; |
52 | 47 |
53 // Name of the decoded payload (such as VP8). Maps back to the depacketizer | 48 // Name of the decoded payload (such as VP8). Maps back to the depacketizer |
54 // used to unpack incoming packets. | 49 // used to unpack incoming packets. |
55 std::string payload_name; | 50 std::string payload_name; |
56 | 51 |
57 // 'true' if the decoder handles rendering as well. | 52 // 'true' if the decoder handles rendering as well. |
58 bool is_renderer; | 53 bool is_renderer = false; |
59 | 54 |
60 // The expected delay for decoding and rendering, i.e. the frame will be | 55 // The expected delay for decoding and rendering, i.e. the frame will be |
61 // delivered this many milliseconds, if possible, earlier than the ideal | 56 // delivered this many milliseconds, if possible, earlier than the ideal |
62 // render time. | 57 // render time. |
63 // Note: Ignored if 'renderer' is false. | 58 // Note: Ignored if 'renderer' is false. |
64 int expected_delay_ms; | 59 int expected_delay_ms = 0; |
65 }; | 60 }; |
66 | 61 |
67 struct Stats { | 62 struct Stats { |
68 int network_frame_rate = 0; | 63 int network_frame_rate = 0; |
69 int decode_frame_rate = 0; | 64 int decode_frame_rate = 0; |
70 int render_frame_rate = 0; | 65 int render_frame_rate = 0; |
71 | 66 |
72 // Decoder stats. | 67 // Decoder stats. |
73 FrameCounts frame_counts; | 68 FrameCounts frame_counts; |
74 int decode_ms = 0; | 69 int decode_ms = 0; |
75 int max_decode_ms = 0; | 70 int max_decode_ms = 0; |
76 int current_delay_ms = 0; | 71 int current_delay_ms = 0; |
77 int target_delay_ms = 0; | 72 int target_delay_ms = 0; |
78 int jitter_buffer_ms = 0; | 73 int jitter_buffer_ms = 0; |
79 int min_playout_delay_ms = 0; | 74 int min_playout_delay_ms = 0; |
80 int render_delay_ms = 10; | 75 int render_delay_ms = 10; |
81 | 76 |
82 int total_bitrate_bps = 0; | 77 int total_bitrate_bps = 0; |
83 int discarded_packets = 0; | 78 int discarded_packets = 0; |
84 | 79 |
85 uint32_t ssrc = 0; | 80 uint32_t ssrc = 0; |
86 std::string c_name; | 81 std::string c_name; |
87 StreamDataCounters rtp_stats; | 82 StreamDataCounters rtp_stats; |
88 RtcpPacketTypeCounter rtcp_packet_type_counts; | 83 RtcpPacketTypeCounter rtcp_packet_type_counts; |
89 RtcpStatistics rtcp_stats; | 84 RtcpStatistics rtcp_stats; |
90 }; | 85 }; |
91 | 86 |
92 struct Config { | 87 struct Config { |
93 Config() | |
94 : renderer(NULL), | |
95 render_delay_ms(10), | |
96 audio_channel_id(-1), | |
97 pre_decode_callback(NULL), | |
98 pre_render_callback(NULL), | |
99 target_delay_ms(0) {} | |
100 std::string ToString() const; | 88 std::string ToString() const; |
101 | 89 |
102 // Decoders for every payload that we can receive. | 90 // Decoders for every payload that we can receive. |
103 std::vector<Decoder> decoders; | 91 std::vector<Decoder> decoders; |
104 | 92 |
105 // Receive-stream specific RTP settings. | 93 // Receive-stream specific RTP settings. |
106 struct Rtp { | 94 struct Rtp { |
107 Rtp() | |
108 : remote_ssrc(0), | |
109 local_ssrc(0), | |
110 rtcp_mode(newapi::kRtcpCompound), | |
111 remb(false) {} | |
112 std::string ToString() const; | 95 std::string ToString() const; |
113 | 96 |
114 // Synchronization source (stream identifier) to be received. | 97 // Synchronization source (stream identifier) to be received. |
115 uint32_t remote_ssrc; | 98 uint32_t remote_ssrc = 0; |
116 // Sender SSRC used for sending RTCP (such as receiver reports). | 99 // Sender SSRC used for sending RTCP (such as receiver reports). |
117 uint32_t local_ssrc; | 100 uint32_t local_ssrc = 0; |
118 | 101 |
119 // See RtcpMode for description. | 102 // See RtcpMode for description. |
120 newapi::RtcpMode rtcp_mode; | 103 newapi::RtcpMode rtcp_mode = newapi::kRtcpCompound; |
121 | 104 |
122 // Extended RTCP settings. | 105 // Extended RTCP settings. |
123 struct RtcpXr { | 106 struct RtcpXr { |
124 RtcpXr() : receiver_reference_time_report(false) {} | |
125 | |
126 // True if RTCP Receiver Reference Time Report Block extension | 107 // True if RTCP Receiver Reference Time Report Block extension |
127 // (RFC 3611) should be enabled. | 108 // (RFC 3611) should be enabled. |
128 bool receiver_reference_time_report; | 109 bool receiver_reference_time_report = false; |
129 } rtcp_xr; | 110 } rtcp_xr; |
130 | 111 |
131 // See draft-alvestrand-rmcat-remb for information. | 112 // See draft-alvestrand-rmcat-remb for information. |
132 bool remb; | 113 bool remb = false; |
133 | 114 |
134 // See NackConfig for description. | 115 // See NackConfig for description. |
135 NackConfig nack; | 116 NackConfig nack; |
136 | 117 |
137 // See FecConfig for description. | 118 // See FecConfig for description. |
138 FecConfig fec; | 119 FecConfig fec; |
139 | 120 |
140 // RTX settings for incoming video payloads that may be received. RTX is | 121 // RTX settings for incoming video payloads that may be received. RTX is |
141 // disabled if there's no config present. | 122 // disabled if there's no config present. |
142 struct Rtx { | 123 struct Rtx { |
143 Rtx() : ssrc(0), payload_type(0) {} | |
144 | |
145 // SSRCs to use for the RTX streams. | 124 // SSRCs to use for the RTX streams. |
146 uint32_t ssrc; | 125 uint32_t ssrc = 0; |
147 | 126 |
148 // Payload type to use for the RTX stream. | 127 // Payload type to use for the RTX stream. |
149 int payload_type; | 128 int payload_type = 0; |
150 }; | 129 }; |
151 | 130 |
152 // Map from video RTP payload type -> RTX config. | 131 // Map from video RTP payload type -> RTX config. |
153 typedef std::map<int, Rtx> RtxMap; | 132 typedef std::map<int, Rtx> RtxMap; |
154 RtxMap rtx; | 133 RtxMap rtx; |
155 | 134 |
156 // RTP header extensions used for the received stream. | 135 // RTP header extensions used for the received stream. |
157 std::vector<RtpExtension> extensions; | 136 std::vector<RtpExtension> extensions; |
158 } rtp; | 137 } rtp; |
159 | 138 |
160 // VideoRenderer will be called for each decoded frame. 'NULL' disables | 139 // VideoRenderer will be called for each decoded frame. 'nullptr' disables |
161 // rendering of this stream. | 140 // rendering of this stream. |
162 VideoRenderer* renderer; | 141 VideoRenderer* renderer = nullptr; |
163 | 142 |
164 // Expected delay needed by the renderer, i.e. the frame will be delivered | 143 // Expected delay needed by the renderer, i.e. the frame will be delivered |
165 // this many milliseconds, if possible, earlier than the ideal render time. | 144 // this many milliseconds, if possible, earlier than the ideal render time. |
166 // Only valid if 'renderer' is set. | 145 // Only valid if 'renderer' is set. |
167 int render_delay_ms; | 146 int render_delay_ms = 10; |
168 | 147 |
169 // Audio channel corresponding to this video stream, used for audio/video | 148 // Audio channel corresponding to this video stream, used for audio/video |
170 // synchronization. 'audio_channel_id' is ignored if no VoiceEngine is set | 149 // synchronization. 'audio_channel_id' is ignored if no VoiceEngine is set |
171 // when creating the VideoEngine instance. '-1' disables a/v sync. | 150 // when creating the VideoEngine instance. '-1' disables a/v sync. |
172 int audio_channel_id; | 151 int audio_channel_id = -1; |
173 | 152 |
174 // Called for each incoming video frame, i.e. in encoded state. E.g. used | 153 // Called for each incoming video frame, i.e. in encoded state. E.g. used |
175 // when | 154 // when |
176 // saving the stream to a file. 'NULL' disables the callback. | 155 // saving the stream to a file. 'nullptr' disables the callback. |
177 EncodedFrameObserver* pre_decode_callback; | 156 EncodedFrameObserver* pre_decode_callback = nullptr; |
178 | 157 |
179 // Called for each decoded frame. E.g. used when adding effects to the | 158 // Called for each decoded frame. E.g. used when adding effects to the |
180 // decoded | 159 // decoded |
181 // stream. 'NULL' disables the callback. | 160 // stream. 'nullptr' disables the callback. |
182 I420FrameCallback* pre_render_callback; | 161 I420FrameCallback* pre_render_callback = nullptr; |
183 | 162 |
184 // Target delay in milliseconds. A positive value indicates this stream is | 163 // Target delay in milliseconds. A positive value indicates this stream is |
185 // used for streaming instead of a real-time call. | 164 // used for streaming instead of a real-time call. |
186 int target_delay_ms; | 165 int target_delay_ms = 0; |
187 }; | 166 }; |
188 | 167 |
189 virtual void Start() = 0; | 168 virtual void Start() = 0; |
190 virtual void Stop() = 0; | 169 virtual void Stop() = 0; |
191 | 170 |
192 // TODO(pbos): Add info on currently-received codec to Stats. | 171 // TODO(pbos): Add info on currently-received codec to Stats. |
193 virtual Stats GetStats() const = 0; | 172 virtual Stats GetStats() const = 0; |
194 | 173 |
195 protected: | 174 protected: |
196 virtual ~VideoReceiveStream() {} | 175 virtual ~VideoReceiveStream() {} |
197 }; | 176 }; |
198 | 177 |
199 } // namespace webrtc | 178 } // namespace webrtc |
200 | 179 |
201 #endif // WEBRTC_VIDEO_RECEIVE_STREAM_H_ | 180 #endif // WEBRTC_VIDEO_RECEIVE_STREAM_H_ |
OLD | NEW |