Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: media/cast/cast_config.h

Issue 2133223003: Revert of Refactoring: Merge VideoSenderConfig and AudioSenderConfig. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_CAST_CAST_CONFIG_H_ 5 #ifndef MEDIA_CAST_CAST_CONFIG_H_
6 #define MEDIA_CAST_CAST_CONFIG_H_ 6 #define MEDIA_CAST_CAST_CONFIG_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 28 matching lines...) Expand all
39 // End-to-end latency in milliseconds. 39 // End-to-end latency in milliseconds.
40 // 40 //
41 // DO NOT USE THIS (400 ms is proven as ideal for general-purpose use). 41 // DO NOT USE THIS (400 ms is proven as ideal for general-purpose use).
42 // 42 //
43 // TODO(miu): Change to 400, and confirm nothing has broken in later change. 43 // TODO(miu): Change to 400, and confirm nothing has broken in later change.
44 // http://crbug.com/530839 44 // http://crbug.com/530839
45 kDefaultRtpMaxDelayMs = 100, 45 kDefaultRtpMaxDelayMs = 100,
46 46
47 // Suggested minimum and maximum video bitrates for general-purpose use (up to 47 // Suggested minimum and maximum video bitrates for general-purpose use (up to
48 // 1080p, 30 FPS). 48 // 1080p, 30 FPS).
49 kDefaultMinVideoBitrate = 300000, 49 kDefaultMinVideoKbps = 300,
50 kDefaultMaxVideoBitrate = 5000000, 50 kDefaultMaxVideoKbps = 5000,
51
52 // Minimum and Maximum VP8 quantizer in default configuration.
53 kDefaultMaxQp = 63,
54 kDefaultMinQp = 4,
55
56 kDefaultMaxCpuSaverQp = 25,
57
58 // Number of video buffers in default configuration (applies only to certain
59 // external codecs).
60 kDefaultNumberOfVideoBuffers = 1,
61 }; 51 };
62 52
63 // These parameters are only for video encoders. 53 // TODO(miu): Merge AudioSenderConfig and VideoSenderConfig and make their
64 struct VideoCodecParams { 54 // naming/documentation consistent with FrameReceiverConfig.
65 VideoCodecParams(); 55 // http://crbug.com/530839
66 VideoCodecParams(const VideoCodecParams& other); 56 struct AudioSenderConfig {
67 ~VideoCodecParams(); 57 AudioSenderConfig();
58 AudioSenderConfig(const AudioSenderConfig& other);
59 ~AudioSenderConfig();
68 60
69 int max_qp; 61 // Identifier referring to the sender, used by the receiver.
70 int min_qp; 62 uint32_t ssrc;
71
72 // The maximum |min_quantizer| set to the encoder when CPU is constrained.
73 // This is a trade-off between higher resolution with lower encoding quality
74 // and lower resolution with higher encoding quality. The set value indicates
75 // the maximum quantizer that the encoder might produce better quality video
76 // at this resolution than lowering resolution with similar CPU usage and
77 // smaller quantizer. The set value has to be between |min_qp| and |max_qp|.
78 // Suggested value range: [4, 30]. It is only used by software VP8 codec.
79 int max_cpu_saver_qp;
80
81 // This field is used differently by various encoders.
82 //
83 // It defaults to 1.
84 //
85 // For VP8, this field is ignored.
86 //
87 // For H.264 on Mac or iOS, it controls the max number of frames the encoder
88 // may hold before emitting a frame. A larger window may allow higher encoding
89 // efficiency at the cost of latency and memory. Set to 0 to let the encoder
90 // choose a suitable value for the platform and other encoding settings.
91 int max_number_of_video_buffers_used;
92
93 int number_of_encode_threads;
94 };
95
96 struct FrameSenderConfig {
97 FrameSenderConfig();
98 FrameSenderConfig(const FrameSenderConfig& other);
99 ~FrameSenderConfig();
100
101 // The sender's SSRC identifier.
102 uint32_t sender_ssrc;
103 63
104 // The receiver's SSRC identifier. 64 // The receiver's SSRC identifier.
105 uint32_t receiver_ssrc; 65 uint32_t receiver_ssrc;
106 66
107 // The total amount of time between a frame's capture/recording on the sender 67 // The total amount of time between a frame's capture/recording on the sender
108 // and its playback on the receiver (i.e., shown to a user). This should be 68 // and its playback on the receiver (i.e., shown to a user). This should be
109 // set to a value large enough to give the system sufficient time to encode, 69 // set to a value large enough to give the system sufficient time to encode,
110 // transmit/retransmit, receive, decode, and render; given its run-time 70 // transmit/retransmit, receive, decode, and render; given its run-time
111 // environment (sender/receiver hardware performance, network conditions, 71 // environment (sender/receiver hardware performance, network conditions,
112 // etc.). 72 // etc.).
113 base::TimeDelta min_playout_delay; 73 base::TimeDelta min_playout_delay;
114 base::TimeDelta max_playout_delay; 74 base::TimeDelta max_playout_delay;
115 75
116 // Starting playout delay when streaming animated content. 76 // Starting playout delay when streaming animated content.
117 base::TimeDelta animated_playout_delay; 77 base::TimeDelta animated_playout_delay;
118 78
119 // RTP payload type enum: Specifies the type/encoding of frame data. 79 // RTP payload type enum: Specifies the type/encoding of frame data.
120 RtpPayloadType rtp_payload_type; 80 RtpPayloadType rtp_payload_type;
121 81
122 // If true, use an external HW encoder rather than the built-in
123 // software-based one.
124 bool use_external_encoder; 82 bool use_external_encoder;
125 83 int frequency;
126 // RTP timebase: The number of RTP units advanced per one second. For audio,
127 // this is the sampling rate. For video, by convention, this is 90 kHz.
128 int rtp_timebase;
129
130 // Number of channels. For audio, this is normally 2. For video, this must
131 // be 1 as Cast does not have support for stereoscopic video.
132 int channels; 84 int channels;
133 85 int bitrate; // Set to <= 0 for "auto variable bitrate" (libopus knows best).
134 // For now, only fixed bitrate is used for audio encoding. So for audio,
135 // |max_bitrate| is used, and the other two will be overriden if they are not
136 // equal to |max_bitrate|.
137 int max_bitrate;
138 int min_bitrate;
139 int start_bitrate;
140
141 double max_frame_rate;
142
143 // Codec used for the compression of signal data.
144 Codec codec; 86 Codec codec;
145 87
146 // The AES crypto key and initialization vector. Each of these strings 88 // The AES crypto key and initialization vector. Each of these strings
147 // contains the data in binary form, of size kAesKeySize. If they are empty 89 // contains the data in binary form, of size kAesKeySize. If they are empty
148 // strings, crypto is not being used. 90 // strings, crypto is not being used.
149 std::string aes_key; 91 std::string aes_key;
150 std::string aes_iv_mask; 92 std::string aes_iv_mask;
93 };
151 94
152 // These are codec specific parameters for video streams only. 95 struct VideoSenderConfig {
153 VideoCodecParams video_codec_params; 96 VideoSenderConfig();
97 VideoSenderConfig(const VideoSenderConfig& other);
98 ~VideoSenderConfig();
99
100 // Identifier referring to the sender, used by the receiver.
101 uint32_t ssrc;
102
103 // The receiver's SSRC identifier.
104 uint32_t receiver_ssrc;
105
106 // The total amount of time between a frame's capture/recording on the sender
107 // and its playback on the receiver (i.e., shown to a user). This should be
108 // set to a value large enough to give the system sufficient time to encode,
109 // transmit/retransmit, receive, decode, and render; given its run-time
110 // environment (sender/receiver hardware performance, network conditions,
111 // etc.).
112 base::TimeDelta min_playout_delay;
113 base::TimeDelta max_playout_delay;
114
115 // Starting playout delay when streaming animated content.
116 base::TimeDelta animated_playout_delay;
117
118 // RTP payload type enum: Specifies the type/encoding of frame data.
119 RtpPayloadType rtp_payload_type;
120
121 bool use_external_encoder;
122
123 float congestion_control_back_off;
124 int max_bitrate;
125 int min_bitrate;
126 int start_bitrate;
127 int max_qp;
128 int min_qp;
129
130 // The maximum |min_quantizer| set to the encoder when CPU is constrained.
131 // This is a trade-off between higher resolution with lower encoding quality
132 // and lower resolution with higher encoding quality. The set value indicates
133 // the maximum quantizer that the encoder might produce better quality video
134 // at this resolution than lowering resolution with similar CPU usage and
135 // smaller quantizer. The set value has to be between |min_qp| and |max_qp|.
136 // Suggested value range: [4, 30].
137 int max_cpu_saver_qp;
138
139 int max_frame_rate; // TODO(miu): Should be double, not int.
140
141 // This field is used differently by various encoders. It defaults to 1.
142 //
143 // For VP8, this field is ignored.
144 //
145 // For H.264 on Mac or iOS, it controls the max number of frames the encoder
146 // may hold before emitting a frame. A larger window may allow higher encoding
147 // efficiency at the cost of latency and memory. Set to 0 to let the encoder
148 // choose a suitable value for the platform and other encoding settings.
149 int max_number_of_video_buffers_used;
150
151 Codec codec;
152 int number_of_encode_threads;
153
154 // The AES crypto key and initialization vector. Each of these strings
155 // contains the data in binary form, of size kAesKeySize. If they are empty
156 // strings, crypto is not being used.
157 std::string aes_key;
158 std::string aes_iv_mask;
154 }; 159 };
155 160
156 // TODO(miu): Naming and minor type changes are badly needed in a later CL. 161 // TODO(miu): Naming and minor type changes are badly needed in a later CL.
157 struct FrameReceiverConfig { 162 struct FrameReceiverConfig {
158 FrameReceiverConfig(); 163 FrameReceiverConfig();
159 FrameReceiverConfig(const FrameReceiverConfig& other); 164 FrameReceiverConfig(const FrameReceiverConfig& other);
160 ~FrameReceiverConfig(); 165 ~FrameReceiverConfig();
161 166
162 // The receiver's SSRC identifier. 167 // The receiver's SSRC identifier.
163 uint32_t receiver_ssrc; 168 uint32_t receiver_ssrc;
(...skipping 16 matching lines...) Expand all
180 // this is the sampling rate. For video, by convention, this is 90 kHz. 185 // this is the sampling rate. For video, by convention, this is 90 kHz.
181 int rtp_timebase; 186 int rtp_timebase;
182 187
183 // Number of channels. For audio, this is normally 2. For video, this must 188 // Number of channels. For audio, this is normally 2. For video, this must
184 // be 1 as Cast does not have support for stereoscopic video. 189 // be 1 as Cast does not have support for stereoscopic video.
185 int channels; 190 int channels;
186 191
187 // The target frame rate. For audio, this is normally 100 (i.e., frames have 192 // The target frame rate. For audio, this is normally 100 (i.e., frames have
188 // a duration of 10ms each). For video, this is normally 30, but any frame 193 // a duration of 10ms each). For video, this is normally 30, but any frame
189 // rate is supported. 194 // rate is supported.
190 double target_frame_rate; 195 int target_frame_rate;
191 196
192 // Codec used for the compression of signal data. 197 // Codec used for the compression of signal data.
193 // TODO(miu): Merge the AudioCodec and VideoCodec enums into one so this union 198 // TODO(miu): Merge the AudioCodec and VideoCodec enums into one so this union
194 // is not necessary. 199 // is not necessary.
195 Codec codec; 200 Codec codec;
196 201
197 // The AES crypto key and initialization vector. Each of these strings 202 // The AES crypto key and initialization vector. Each of these strings
198 // contains the data in binary form, of size kAesKeySize. If they are empty 203 // contains the data in binary form, of size kAesKeySize. If they are empty
199 // strings, crypto is not being used. 204 // strings, crypto is not being used.
200 std::string aes_key; 205 std::string aes_key;
201 std::string aes_iv_mask; 206 std::string aes_iv_mask;
202 }; 207 };
203 208
204 // TODO(miu): Remove the CreateVEA callbacks. http://crbug.com/454029 209 // TODO(miu): Remove the CreateVEA callbacks. http://crbug.com/454029
205 typedef base::Callback<void(scoped_refptr<base::SingleThreadTaskRunner>, 210 typedef base::Callback<void(scoped_refptr<base::SingleThreadTaskRunner>,
206 std::unique_ptr<media::VideoEncodeAccelerator>)> 211 std::unique_ptr<media::VideoEncodeAccelerator>)>
207 ReceiveVideoEncodeAcceleratorCallback; 212 ReceiveVideoEncodeAcceleratorCallback;
208 typedef base::Callback<void(const ReceiveVideoEncodeAcceleratorCallback&)> 213 typedef base::Callback<void(const ReceiveVideoEncodeAcceleratorCallback&)>
209 CreateVideoEncodeAcceleratorCallback; 214 CreateVideoEncodeAcceleratorCallback;
210 typedef base::Callback<void(std::unique_ptr<base::SharedMemory>)> 215 typedef base::Callback<void(std::unique_ptr<base::SharedMemory>)>
211 ReceiveVideoEncodeMemoryCallback; 216 ReceiveVideoEncodeMemoryCallback;
212 typedef base::Callback<void(size_t size, 217 typedef base::Callback<void(size_t size,
213 const ReceiveVideoEncodeMemoryCallback&)> 218 const ReceiveVideoEncodeMemoryCallback&)>
214 CreateVideoEncodeMemoryCallback; 219 CreateVideoEncodeMemoryCallback;
215 220
216 } // namespace cast 221 } // namespace cast
217 } // namespace media 222 } // namespace media
218 223
219 #endif // MEDIA_CAST_CAST_CONFIG_H_ 224 #endif // MEDIA_CAST_CAST_CONFIG_H_
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/cast_streaming/rtp_stream_error.js ('k') | media/cast/cast_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698