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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 int total_bitrate_bps = 0; | 45 int total_bitrate_bps = 0; |
46 int retransmit_bitrate_bps = 0; | 46 int retransmit_bitrate_bps = 0; |
47 int avg_delay_ms = 0; | 47 int avg_delay_ms = 0; |
48 int max_delay_ms = 0; | 48 int max_delay_ms = 0; |
49 StreamDataCounters rtp_stats; | 49 StreamDataCounters rtp_stats; |
50 RtcpPacketTypeCounter rtcp_packet_type_counts; | 50 RtcpPacketTypeCounter rtcp_packet_type_counts; |
51 RtcpStatistics rtcp_stats; | 51 RtcpStatistics rtcp_stats; |
52 }; | 52 }; |
53 | 53 |
54 struct Stats { | 54 struct Stats { |
55 Stats() | 55 int input_frame_rate = 0; |
56 : input_frame_rate(0), | 56 int encode_frame_rate = 0; |
57 encode_frame_rate(0), | 57 int avg_encode_time_ms = 0; |
58 avg_encode_time_ms(0), | 58 int encode_usage_percent = 0; |
59 encode_usage_percent(0), | 59 int target_media_bitrate_bps = 0; |
60 target_media_bitrate_bps(0), | 60 int media_bitrate_bps = 0; |
61 media_bitrate_bps(0), | 61 bool suspended = false; |
62 suspended(false) {} | |
63 int input_frame_rate; | |
64 int encode_frame_rate; | |
65 int avg_encode_time_ms; | |
66 int encode_usage_percent; | |
67 int target_media_bitrate_bps; | |
68 int media_bitrate_bps; | |
69 bool suspended; | |
70 std::map<uint32_t, StreamStats> substreams; | 62 std::map<uint32_t, StreamStats> substreams; |
71 }; | 63 }; |
72 | 64 |
73 struct Config { | 65 struct Config { |
74 Config() | |
75 : pre_encode_callback(NULL), | |
76 post_encode_callback(NULL), | |
77 local_renderer(NULL), | |
78 render_delay_ms(0), | |
79 target_delay_ms(0), | |
80 suspend_below_min_bitrate(false) {} | |
81 std::string ToString() const; | 66 std::string ToString() const; |
82 | 67 |
83 struct EncoderSettings { | 68 struct EncoderSettings { |
84 EncoderSettings() : payload_type(-1), encoder(NULL) {} | |
85 | |
86 std::string ToString() const; | 69 std::string ToString() const; |
87 | 70 |
88 std::string payload_name; | 71 std::string payload_name; |
89 int payload_type; | 72 int payload_type = -1; |
90 | 73 |
91 // Uninitialized VideoEncoder instance to be used for encoding. Will be | 74 // Uninitialized VideoEncoder instance to be used for encoding. Will be |
92 // initialized from inside the VideoSendStream. | 75 // initialized from inside the VideoSendStream. |
93 VideoEncoder* encoder; | 76 VideoEncoder* encoder = nullptr; |
94 } encoder_settings; | 77 } encoder_settings; |
95 | 78 |
96 static const size_t kDefaultMaxPacketSize = 1500 - 40; // TCP over IPv4. | 79 static const size_t kDefaultMaxPacketSize = 1500 - 40; // TCP over IPv4. |
97 struct Rtp { | 80 struct Rtp { |
98 Rtp() : max_packet_size(kDefaultMaxPacketSize) {} | |
99 std::string ToString() const; | 81 std::string ToString() const; |
100 | 82 |
101 std::vector<uint32_t> ssrcs; | 83 std::vector<uint32_t> ssrcs; |
102 | 84 |
103 // Max RTP packet size delivered to send transport from VideoEngine. | 85 // Max RTP packet size delivered to send transport from VideoEngine. |
104 size_t max_packet_size; | 86 size_t max_packet_size = kDefaultMaxPacketSize; |
105 | 87 |
106 // RTP header extensions to use for this send stream. | 88 // RTP header extensions to use for this send stream. |
107 std::vector<RtpExtension> extensions; | 89 std::vector<RtpExtension> extensions; |
108 | 90 |
109 // See NackConfig for description. | 91 // See NackConfig for description. |
110 NackConfig nack; | 92 NackConfig nack; |
111 | 93 |
112 // See FecConfig for description. | 94 // See FecConfig for description. |
113 FecConfig fec; | 95 FecConfig fec; |
114 | 96 |
115 // Settings for RTP retransmission payload format, see RFC 4588 for | 97 // Settings for RTP retransmission payload format, see RFC 4588 for |
116 // details. | 98 // details. |
117 struct Rtx { | 99 struct Rtx { |
118 Rtx() : payload_type(-1) {} | |
119 std::string ToString() const; | 100 std::string ToString() const; |
120 // SSRCs to use for the RTX streams. | 101 // SSRCs to use for the RTX streams. |
121 std::vector<uint32_t> ssrcs; | 102 std::vector<uint32_t> ssrcs; |
122 | 103 |
123 // Payload type to use for the RTX stream. | 104 // Payload type to use for the RTX stream. |
124 int payload_type; | 105 int payload_type = -1; |
125 } rtx; | 106 } rtx; |
126 | 107 |
127 // RTCP CNAME, see RFC 3550. | 108 // RTCP CNAME, see RFC 3550. |
128 std::string c_name; | 109 std::string c_name; |
129 } rtp; | 110 } rtp; |
130 | 111 |
131 // Called for each I420 frame before encoding the frame. Can be used for | 112 // Called for each I420 frame before encoding the frame. Can be used for |
132 // effects, snapshots etc. 'NULL' disables the callback. | 113 // effects, snapshots etc. 'nullptr' disables the callback. |
133 I420FrameCallback* pre_encode_callback; | 114 I420FrameCallback* pre_encode_callback = nullptr; |
134 | 115 |
135 // Called for each encoded frame, e.g. used for file storage. 'NULL' | 116 // Called for each encoded frame, e.g. used for file storage. 'nullptr' |
136 // disables the callback. | 117 // disables the callback. |
137 EncodedFrameObserver* post_encode_callback; | 118 EncodedFrameObserver* post_encode_callback = nullptr; |
138 | 119 |
139 // Renderer for local preview. The local renderer will be called even if | 120 // Renderer for local preview. The local renderer will be called even if |
140 // sending hasn't started. 'NULL' disables local rendering. | 121 // sending hasn't started. 'nullptr' disables local rendering. |
141 VideoRenderer* local_renderer; | 122 VideoRenderer* local_renderer = nullptr; |
142 | 123 |
143 // Expected delay needed by the renderer, i.e. the frame will be delivered | 124 // Expected delay needed by the renderer, i.e. the frame will be delivered |
144 // this many milliseconds, if possible, earlier than expected render time. | 125 // this many milliseconds, if possible, earlier than expected render time. |
145 // Only valid if |local_renderer| is set. | 126 // Only valid if |local_renderer| is set. |
146 int render_delay_ms; | 127 int render_delay_ms = 0; |
147 | 128 |
148 // Target delay in milliseconds. A positive value indicates this stream is | 129 // Target delay in milliseconds. A positive value indicates this stream is |
149 // used for streaming instead of a real-time call. | 130 // used for streaming instead of a real-time call. |
150 int target_delay_ms; | 131 int target_delay_ms = 0; |
151 | 132 |
152 // True if the stream should be suspended when the available bitrate fall | 133 // True if the stream should be suspended when the available bitrate fall |
153 // below the minimum configured bitrate. If this variable is false, the | 134 // below the minimum configured bitrate. If this variable is false, the |
154 // stream may send at a rate higher than the estimated available bitrate. | 135 // stream may send at a rate higher than the estimated available bitrate. |
155 bool suspend_below_min_bitrate; | 136 bool suspend_below_min_bitrate = false; |
156 }; | 137 }; |
157 | 138 |
158 // Gets interface used to insert captured frames. Valid as long as the | 139 // Gets interface used to insert captured frames. Valid as long as the |
159 // VideoSendStream is valid. | 140 // VideoSendStream is valid. |
160 virtual VideoSendStreamInput* Input() = 0; | 141 virtual VideoSendStreamInput* Input() = 0; |
161 | 142 |
162 virtual void Start() = 0; | 143 virtual void Start() = 0; |
163 virtual void Stop() = 0; | 144 virtual void Stop() = 0; |
164 | 145 |
165 // Set which streams to send. Must have at least as many SSRCs as configured | 146 // Set which streams to send. Must have at least as many SSRCs as configured |
166 // in the config. Encoder settings are passed on to the encoder instance along | 147 // in the config. Encoder settings are passed on to the encoder instance along |
167 // with the VideoStream settings. | 148 // with the VideoStream settings. |
168 virtual bool ReconfigureVideoEncoder(const VideoEncoderConfig& config) = 0; | 149 virtual bool ReconfigureVideoEncoder(const VideoEncoderConfig& config) = 0; |
169 | 150 |
170 virtual Stats GetStats() = 0; | 151 virtual Stats GetStats() = 0; |
171 | 152 |
172 protected: | 153 protected: |
173 virtual ~VideoSendStream() {} | 154 virtual ~VideoSendStream() {} |
174 }; | 155 }; |
175 | 156 |
176 } // namespace webrtc | 157 } // namespace webrtc |
177 | 158 |
178 #endif // WEBRTC_VIDEO_SEND_STREAM_H_ | 159 #endif // WEBRTC_VIDEO_SEND_STREAM_H_ |
OLD | NEW |