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

Unified Diff: media/cast/sender/audio_sender.cc

Issue 605803004: [cast] Allow audio encoder implementations to specify the frame length. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move inline namespace back inside media::cast to better match original file. Created 6 years, 2 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
« no previous file with comments | « media/cast/sender/audio_encoder_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/audio_sender.cc
diff --git a/media/cast/sender/audio_sender.cc b/media/cast/sender/audio_sender.cc
index 8916a1785f0336aba17fec53f8aaf6b2a90ca981..4748218c8ebb7f5bf41b5406bd632b112b11e2c7 100644
--- a/media/cast/sender/audio_sender.cc
+++ b/media/cast/sender/audio_sender.cc
@@ -13,29 +13,20 @@
namespace media {
namespace cast {
-namespace {
-
-// TODO(miu): This should be specified in AudioSenderConfig, but currently it is
-// fixed to 100 FPS (i.e., 10 ms per frame), and AudioEncoder assumes this as
-// well.
-const int kAudioFrameRate = 100;
-
-} // namespace
AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
const AudioSenderConfig& audio_config,
CastTransportSender* const transport_sender)
- : FrameSender(
- cast_environment,
- true,
- transport_sender,
- base::TimeDelta::FromMilliseconds(audio_config.rtcp_interval),
- audio_config.frequency,
- audio_config.ssrc,
- kAudioFrameRate,
- audio_config.min_playout_delay,
- audio_config.max_playout_delay,
- NewFixedCongestionControl(audio_config.bitrate)),
+ : FrameSender(cast_environment,
+ true,
+ transport_sender,
+ base::TimeDelta::FromMilliseconds(audio_config.rtcp_interval),
+ audio_config.frequency,
+ audio_config.ssrc,
+ 0, // |max_frame_rate_| is set after encoder initialization.
+ audio_config.min_playout_delay,
+ audio_config.max_playout_delay,
+ NewFixedCongestionControl(audio_config.bitrate)),
samples_in_encoder_(0),
weak_factory_(this) {
cast_initialization_status_ = STATUS_AUDIO_UNINITIALIZED;
@@ -56,6 +47,12 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
cast_initialization_status_ = STATUS_AUDIO_UNINITIALIZED;
}
+ // The number of samples per encoded audio frame depends on the codec and its
+ // initialization parameters. Now that we have an encoder, we can calculate
+ // the maximum frame rate.
+ max_frame_rate_ =
+ audio_config.frequency / audio_encoder_->GetSamplesPerFrame();
+
media::cast::CastTransportRtpConfig transport_config;
transport_config.ssrc = audio_config.ssrc;
transport_config.feedback_ssrc = audio_config.incoming_feedback_ssrc;
« no previous file with comments | « media/cast/sender/audio_encoder_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698