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

Unified 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, 6 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 side-by-side diff with in-line comments
Download patch
Index: media/cast/cast_config.cc
diff --git a/media/cast/cast_config.cc b/media/cast/cast_config.cc
index 1a619fd0703985f49a2ac06d73765ae1a81fb717..2535170800beea13fea405983e61e788e257e4a9 100644
--- a/media/cast/cast_config.cc
+++ b/media/cast/cast_config.cc
@@ -4,85 +4,50 @@
#include "media/cast/cast_config.h"
-namespace {
-
-const float kDefaultCongestionControlBackOff = 0.875f;
-
-enum {
- // Minimum and Maximum VP8 quantizer in default configuration.
- kDefaultMaxQp = 63,
- kDefaultMinQp = 4,
-
- kDefaultMaxCpuSaverQp = 25,
-
- // Number of video buffers in default configuration (applies only to certain
- // external codecs).
- kDefaultNumberOfVideoBuffers = 1,
-};
-
-} // namespace
-
namespace media {
namespace cast {
-// TODO(miu): Revisit code factoring of these structs. There are a number of
-// common elements between them all, so it might be reasonable to only have one
-// or two structs; or, at least a common base class.
-
-// TODO(miu): Make sure all POD members are initialized by ctors. Policy
-// decision: Reasonable defaults or use invalid placeholder values to expose
-// unset members?
-
-// TODO(miu): Provide IsValidConfig() functions?
-
-// TODO(miu): Throughout the code, there is a lot of copy-and-paste of the same
-// calculations based on these config values. So, why don't we add methods to
-// these classes to centralize the logic?
-
-VideoSenderConfig::VideoSenderConfig()
- : ssrc(0),
- receiver_ssrc(0),
- max_playout_delay(
- base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs)),
- rtp_payload_type(0),
- use_external_encoder(false),
- congestion_control_back_off(kDefaultCongestionControlBackOff),
- max_bitrate(kDefaultMaxVideoKbps * 1000),
- min_bitrate(kDefaultMinVideoKbps * 1000),
- start_bitrate(kDefaultMaxVideoKbps * 1000),
+CodecSpecificParams::CodecSpecificParams()
+ : start_bitrate(0),
max_qp(kDefaultMaxQp),
min_qp(kDefaultMinQp),
max_cpu_saver_qp(kDefaultMaxCpuSaverQp),
- max_frame_rate(kDefaultMaxFrameRate),
max_number_of_video_buffers_used(kDefaultNumberOfVideoBuffers),
- codec(CODEC_VIDEO_VP8),
number_of_encode_threads(1) {}
-VideoSenderConfig::VideoSenderConfig(const VideoSenderConfig& other) = default;
+CodecSpecificParams::CodecSpecificParams(const CodecSpecificParams& other) =
+ default;
-VideoSenderConfig::~VideoSenderConfig() {}
+CodecSpecificParams::~CodecSpecificParams() {}
-AudioSenderConfig::AudioSenderConfig()
- : ssrc(0),
+// TODO(miu): Provide IsValidConfig() functions?
+
+FrameSenderConfig::FrameSenderConfig()
+ : sender_ssrc(0),
receiver_ssrc(0),
+ min_playout_delay(
+ base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs)),
max_playout_delay(
base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs)),
- rtp_payload_type(0),
+ animated_playout_delay(min_playout_delay),
+ rtp_payload_type(RtpPayloadType::UNKNOWN),
use_external_encoder(false),
frequency(0),
channels(0),
- bitrate(kDefaultAudioEncoderBitrate),
- codec(CODEC_AUDIO_OPUS) {}
+ max_bitrate(0),
+ min_bitrate(0),
+ max_frame_rate(kDefaultMaxFrameRate),
+ codec(CODEC_UNKNOWN) {}
-AudioSenderConfig::AudioSenderConfig(const AudioSenderConfig& other) = default;
+FrameSenderConfig::FrameSenderConfig(const FrameSenderConfig& other) = default;
-AudioSenderConfig::~AudioSenderConfig() {}
+FrameSenderConfig::~FrameSenderConfig() {}
FrameReceiverConfig::FrameReceiverConfig()
: receiver_ssrc(0),
sender_ssrc(0),
rtp_max_delay_ms(kDefaultRtpMaxDelayMs),
- rtp_payload_type(0),
+ rtp_payload_type(RtpPayloadType::UNKNOWN),
rtp_timebase(0),
channels(0),
target_frame_rate(0),

Powered by Google App Engine
This is Rietveld 408576698