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

Unified Diff: chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc

Issue 2133293003: [Chromecast] Make ALSA rendering delay either accurate or kNoTimestamp (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fix ALSA unit tests Created 4 years, 5 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: chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc
diff --git a/chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc b/chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc
index b85d1962f2ad52e662ec82025fd9347c4a6220e6..0a8f0a462da7a4550cd0060682e3d5ac05139214 100644
--- a/chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc
+++ b/chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc
@@ -5,6 +5,7 @@
#include "chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.h"
#include <algorithm>
+#include <limits>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -53,6 +54,7 @@ const int64_t kFadeMs = 15;
// fill the frames with silence.
const int kPausedReadSamples = 512;
const int kDefaultReadSize = ::media::SincResampler::kDefaultRequestSize;
+const int64_t kNoTimestamp = std::numeric_limits<int64_t>::min();
} // namespace
@@ -200,9 +202,11 @@ MediaPipelineBackendAlsa::RenderingDelay StreamMixerAlsaInputImpl::QueueData(
}
MediaPipelineBackendAlsa::RenderingDelay delay = mixer_rendering_delay_;
- delay.delay_microseconds += static_cast<int64_t>(
- queued_frames_including_resampler_ * base::Time::kMicrosecondsPerSecond /
- input_samples_per_second_);
+ if (delay.timestamp_microseconds != kNoTimestamp) {
+ delay.delay_microseconds += static_cast<int64_t>(
+ queued_frames_including_resampler_ *
+ base::Time::kMicrosecondsPerSecond / input_samples_per_second_);
+ }
return delay;
}
« no previous file with comments | « chromecast/media/cma/backend/alsa/stream_mixer_alsa.cc ('k') | chromecast/media/cma/backend/multizone_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698