summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-01 01:44:25 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-01 01:44:25 +0000
commitf894cc04c9edfae2f94d3d74584453e98778884b (patch)
tree4ec4dcc84d2c8a3a0c502622965cf946ba5419a2 /media
parentba05ffad7dd95dfbfe8a3ecca714c64de0bbb13e (diff)
downloadchromium_src-f894cc04c9edfae2f94d3d74584453e98778884b.zip
chromium_src-f894cc04c9edfae2f94d3d74584453e98778884b.tar.gz
chromium_src-f894cc04c9edfae2f94d3d74584453e98778884b.tar.bz2
Cast: increase the maximum outstanding audio frames
In the case of high latency congestion period, RTT is high and audio frames are mostly delivered on time. We do no want to drop audio frames frequently. This change sends up to three times of target delay worth of audio frames. It does not any harmful effect because audio packets are small and receiver has the ability to drop any one of them. Review URL: https://codereview.chromium.org/360103002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280724 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/cast/audio_sender/audio_sender.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/media/cast/audio_sender/audio_sender.cc b/media/cast/audio_sender/audio_sender.cc
index 02e12a87..f1e2d19 100644
--- a/media/cast/audio_sender/audio_sender.cc
+++ b/media/cast/audio_sender/audio_sender.cc
@@ -14,6 +14,7 @@
namespace media {
namespace cast {
+namespace {
const int kNumAggressiveReportsSentAtStart = 100;
const int kMinSchedulingDelayMs = 1;
@@ -23,17 +24,25 @@ const int kMinSchedulingDelayMs = 1;
// well.
const int kAudioFrameRate = 100;
+// Helper function to compute the maximum unacked audio frames that is sent.
+int GetMaxUnackedFrames(base::TimeDelta target_delay) {
+ // As long as it doesn't go over |kMaxUnackedFrames|, it is okay to send more
+ // audio data than the target delay would suggest. Audio packets are tiny and
+ // receiver has the ability to drop any one of the packets.
+ // We send up to three times of the target delay of audio frames.
+ int frames =
+ 1 + 3 * target_delay * kAudioFrameRate / base::TimeDelta::FromSeconds(1);
+ return std::min(kMaxUnackedFrames, frames);
+}
+} // namespace
+
AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
const AudioSenderConfig& audio_config,
transport::CastTransportSender* const transport_sender)
: cast_environment_(cast_environment),
target_playout_delay_(audio_config.target_playout_delay),
transport_sender_(transport_sender),
- max_unacked_frames_(
- std::min(kMaxUnackedFrames,
- 1 + static_cast<int>(target_playout_delay_ *
- kAudioFrameRate /
- base::TimeDelta::FromSeconds(1)))),
+ max_unacked_frames_(GetMaxUnackedFrames(target_playout_delay_)),
configured_encoder_bitrate_(audio_config.bitrate),
rtcp_(cast_environment,
this,