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

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

Issue 560223002: [Cast] Limit frames in flight by duration, and not by number of frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaks addressing review comments on PS6. Created 6 years, 3 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/sender/audio_sender.cc
diff --git a/media/cast/sender/audio_sender.cc b/media/cast/sender/audio_sender.cc
index 4dc7de411ffec4acb37756fcbda1810461d4fa07..23fd6d1072dd47583bcf3db77cdeefc920cb7eb0 100644
--- a/media/cast/sender/audio_sender.cc
+++ b/media/cast/sender/audio_sender.cc
@@ -32,7 +32,7 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
base::TimeDelta::FromMilliseconds(audio_config.rtcp_interval),
audio_config.frequency,
audio_config.ssrc,
- kAudioFrameRate * 2.0, // We lie to increase max outstanding frames.
+ kAudioFrameRate,
audio_config.min_playout_delay,
audio_config.max_playout_delay,
NewFixedCongestionControl(audio_config.bitrate)),
@@ -62,11 +62,6 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
transport_config.ssrc = audio_config.ssrc;
transport_config.feedback_ssrc = audio_config.incoming_feedback_ssrc;
transport_config.rtp_payload_type = audio_config.rtp_payload_type;
- transport_config.stored_frames =
- std::min(kMaxUnackedFrames,
- 1 + static_cast<int>(max_playout_delay_ *
- max_frame_rate_ /
- base::TimeDelta::FromSeconds(1)));
transport_config.aes_key = audio_config.aes_key;
transport_config.aes_iv_mask = audio_config.aes_iv_mask;
@@ -89,13 +84,10 @@ void AudioSender::InsertAudio(scoped_ptr<AudioBus> audio_bus,
}
DCHECK(audio_encoder_.get()) << "Invalid internal state";
- // TODO(miu): An |audio_bus| that represents more duration than a single
- // frame's duration can defeat our logic here, causing too much data to become
- // enqueued. This will be addressed in a soon-upcoming change.
- if (ShouldDropNextFrame(recorded_time)) {
- VLOG(1) << "Dropping frame due to too many frames currently in-flight.";
+ const base::TimeDelta next_frame_duration =
+ RtpDeltaToTimeDelta(audio_bus->frames(), rtp_timebase());
+ if (ShouldDropNextFrame(next_frame_duration))
return;
- }
samples_in_encoder_ += audio_bus->frames();
@@ -108,6 +100,12 @@ int AudioSender::GetNumberOfFramesInEncoder() const {
return samples_in_encoder_ / audio_encoder_->GetSamplesPerFrame();
}
+base::TimeDelta AudioSender::GetInFlightMediaDuration() const {
+ const int samples_in_flight = samples_in_encoder_ +
+ GetUnacknowledgedFrameCount() * audio_encoder_->GetSamplesPerFrame();
+ return RtpDeltaToTimeDelta(samples_in_flight, rtp_timebase());
+}
+
void AudioSender::OnAck(uint32 frame_id) {
}

Powered by Google App Engine
This is Rietveld 408576698