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