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

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

Issue 147993010: Cast: end2end bug fixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + nits Created 6 years, 10 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 | « no previous file | media/cast/audio_sender/audio_sender.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/audio_sender/audio_encoder.cc
diff --git a/media/cast/audio_sender/audio_encoder.cc b/media/cast/audio_sender/audio_encoder.cc
index ac9415e5b04b9490061907f03d02dc698311d73f..2363619750d6d462c428946cc13b9d28a2c27802 100644
--- a/media/cast/audio_sender/audio_encoder.cc
+++ b/media/cast/audio_sender/audio_encoder.cc
@@ -75,6 +75,7 @@ class AudioEncoder::ImplBase : public base::SupportsWeakPtr<ImplBase> {
const base::TimeTicks& recorded_time,
const base::Closure& done_callback) {
int src_pos = 0;
+ int packet_count = 0;
while (audio_bus && src_pos < audio_bus->frames()) {
const int num_samples_to_xfer = std::min(
samples_per_10ms_ - buffer_fill_end_, audio_bus->frames() - src_pos);
@@ -124,12 +125,19 @@ class AudioEncoder::ImplBase : public base::SupportsWeakPtr<ImplBase> {
base::TimeDelta::FromMilliseconds(10) / samples_per_10ms_;
// TODO(miu): Consider batching EncodedAudioFrames so we only post a
// at most one task for each call to this method.
- cast_environment_->PostTask(
+ // Postpone every packet by 10mS with respect to the previous. Playout
+ // is postponed already by 10mS, and this will better correlate with
+ // the pacer's expectations.
+ //TODO(mikhal): Turn this into a list of packets.
+ // Update the end2end allowed error once this is fixed.
+ cast_environment_->PostDelayedTask(
CastEnvironment::MAIN,
FROM_HERE,
base::Bind(callback_,
base::Passed(&audio_frame),
- recorded_time - buffer_time_offset));
+ recorded_time - buffer_time_offset),
+ base::TimeDelta::FromMilliseconds(packet_count * 10));
+ ++packet_count;
}
buffer_fill_end_ = 0;
}
« no previous file with comments | « no previous file | media/cast/audio_sender/audio_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698