OLD | NEW |
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 #include "media/cast/cast_config.h" | 5 #include "media/cast/cast_config.h" |
6 | 6 |
7 namespace { | |
8 | |
9 const float kDefaultCongestionControlBackOff = 0.875f; | |
10 | |
11 enum { | |
12 // Minimum and Maximum VP8 quantizer in default configuration. | |
13 kDefaultMaxQp = 63, | |
14 kDefaultMinQp = 4, | |
15 | |
16 kDefaultMaxCpuSaverQp = 25, | |
17 | |
18 // Number of video buffers in default configuration (applies only to certain | |
19 // external codecs). | |
20 kDefaultNumberOfVideoBuffers = 1, | |
21 }; | |
22 | |
23 } // namespace | |
24 | |
25 namespace media { | 7 namespace media { |
26 namespace cast { | 8 namespace cast { |
27 | 9 |
28 // TODO(miu): Revisit code factoring of these structs. There are a number of | 10 VideoCodecParams::VideoCodecParams() |
29 // common elements between them all, so it might be reasonable to only have one | 11 : max_qp(kDefaultMaxQp), |
30 // or two structs; or, at least a common base class. | 12 min_qp(kDefaultMinQp), |
| 13 max_cpu_saver_qp(kDefaultMaxCpuSaverQp), |
| 14 max_number_of_video_buffers_used(kDefaultNumberOfVideoBuffers), |
| 15 number_of_encode_threads(1) {} |
31 | 16 |
32 // TODO(miu): Make sure all POD members are initialized by ctors. Policy | 17 VideoCodecParams::VideoCodecParams(const VideoCodecParams& other) = default; |
33 // decision: Reasonable defaults or use invalid placeholder values to expose | 18 |
34 // unset members? | 19 VideoCodecParams::~VideoCodecParams() {} |
35 | 20 |
36 // TODO(miu): Provide IsValidConfig() functions? | 21 // TODO(miu): Provide IsValidConfig() functions? |
37 | 22 |
38 // TODO(miu): Throughout the code, there is a lot of copy-and-paste of the same | 23 FrameSenderConfig::FrameSenderConfig() |
39 // calculations based on these config values. So, why don't we add methods to | 24 : sender_ssrc(0), |
40 // these classes to centralize the logic? | |
41 | |
42 VideoSenderConfig::VideoSenderConfig() | |
43 : ssrc(0), | |
44 receiver_ssrc(0), | 25 receiver_ssrc(0), |
| 26 min_playout_delay( |
| 27 base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs)), |
45 max_playout_delay( | 28 max_playout_delay( |
46 base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs)), | 29 base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs)), |
| 30 animated_playout_delay(min_playout_delay), |
47 rtp_payload_type(RtpPayloadType::UNKNOWN), | 31 rtp_payload_type(RtpPayloadType::UNKNOWN), |
48 use_external_encoder(false), | 32 use_external_encoder(false), |
49 congestion_control_back_off(kDefaultCongestionControlBackOff), | 33 rtp_timebase(0), |
50 max_bitrate(kDefaultMaxVideoKbps * 1000), | 34 channels(0), |
51 min_bitrate(kDefaultMinVideoKbps * 1000), | 35 max_bitrate(0), |
52 start_bitrate(kDefaultMaxVideoKbps * 1000), | 36 min_bitrate(0), |
53 max_qp(kDefaultMaxQp), | 37 start_bitrate(0), |
54 min_qp(kDefaultMinQp), | |
55 max_cpu_saver_qp(kDefaultMaxCpuSaverQp), | |
56 max_frame_rate(kDefaultMaxFrameRate), | 38 max_frame_rate(kDefaultMaxFrameRate), |
57 max_number_of_video_buffers_used(kDefaultNumberOfVideoBuffers), | 39 codec(CODEC_UNKNOWN) {} |
58 codec(CODEC_VIDEO_VP8), | |
59 number_of_encode_threads(1) {} | |
60 | 40 |
61 VideoSenderConfig::VideoSenderConfig(const VideoSenderConfig& other) = default; | 41 FrameSenderConfig::FrameSenderConfig(const FrameSenderConfig& other) = default; |
62 | 42 |
63 VideoSenderConfig::~VideoSenderConfig() {} | 43 FrameSenderConfig::~FrameSenderConfig() {} |
64 | |
65 AudioSenderConfig::AudioSenderConfig() | |
66 : ssrc(0), | |
67 receiver_ssrc(0), | |
68 max_playout_delay( | |
69 base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs)), | |
70 rtp_payload_type(RtpPayloadType::UNKNOWN), | |
71 use_external_encoder(false), | |
72 frequency(0), | |
73 channels(0), | |
74 bitrate(kDefaultAudioEncoderBitrate), | |
75 codec(CODEC_AUDIO_OPUS) {} | |
76 | |
77 AudioSenderConfig::AudioSenderConfig(const AudioSenderConfig& other) = default; | |
78 | |
79 AudioSenderConfig::~AudioSenderConfig() {} | |
80 | 44 |
81 FrameReceiverConfig::FrameReceiverConfig() | 45 FrameReceiverConfig::FrameReceiverConfig() |
82 : receiver_ssrc(0), | 46 : receiver_ssrc(0), |
83 sender_ssrc(0), | 47 sender_ssrc(0), |
84 rtp_max_delay_ms(kDefaultRtpMaxDelayMs), | 48 rtp_max_delay_ms(kDefaultRtpMaxDelayMs), |
85 rtp_payload_type(RtpPayloadType::UNKNOWN), | 49 rtp_payload_type(RtpPayloadType::UNKNOWN), |
86 rtp_timebase(0), | 50 rtp_timebase(0), |
87 channels(0), | 51 channels(0), |
88 target_frame_rate(0), | 52 target_frame_rate(0), |
89 codec(CODEC_UNKNOWN) {} | 53 codec(CODEC_UNKNOWN) {} |
90 | 54 |
91 FrameReceiverConfig::FrameReceiverConfig(const FrameReceiverConfig& other) = | 55 FrameReceiverConfig::FrameReceiverConfig(const FrameReceiverConfig& other) = |
92 default; | 56 default; |
93 | 57 |
94 FrameReceiverConfig::~FrameReceiverConfig() {} | 58 FrameReceiverConfig::~FrameReceiverConfig() {} |
95 | 59 |
96 } // namespace cast | 60 } // namespace cast |
97 } // namespace media | 61 } // namespace media |
OLD | NEW |