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

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

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

Powered by Google App Engine
This is Rietveld 408576698