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

Unified Diff: media/filters/audio_renderer_algorithm.cc

Issue 2858393002: media: Increase the default audio buffer size for encrypted streams (Closed)
Patch Set: Fix another chromecast usage of AudioRendererAlgorithm Created 3 years, 7 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/filters/audio_renderer_algorithm.h ('k') | media/filters/audio_renderer_algorithm_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_renderer_algorithm.cc
diff --git a/media/filters/audio_renderer_algorithm.cc b/media/filters/audio_renderer_algorithm.cc
index efa45d35ef484a40cf509ac4f434c62095e2355d..fe30e80add0c81ac61903bb7731719dd53fa2a60 100644
--- a/media/filters/audio_renderer_algorithm.cc
+++ b/media/filters/audio_renderer_algorithm.cc
@@ -64,6 +64,16 @@ static const int kMaxCapacityInSeconds = 3;
// The minimum size in ms for the |audio_buffer_|. Arbitrarily determined.
static const int kStartingCapacityInMs = 200;
+// The minimum size in ms for the |audio_buffer_| for encrypted streams.
+// This is a temporary workaround for http://crbug.com/718161. Encrypted
+// audio may be decrypted on the renderer main thread, so if that thread
+// is blocked for a significant amount of time, decoding can stall. By
+// maintaining a larger audio buffer we are more resilient to underflows
+// caused by long running main thread tasks.
+// TODO(watk,xhwang): Delete this when decrypting moves to the media thread
+// (http://crbug.com/403462).
+static const int kStartingCapacityForEncryptedInMs = 500;
+
AudioRendererAlgorithm::AudioRendererAlgorithm()
: channels_(0),
samples_per_second_(0),
@@ -82,14 +92,17 @@ AudioRendererAlgorithm::AudioRendererAlgorithm()
AudioRendererAlgorithm::~AudioRendererAlgorithm() {}
-void AudioRendererAlgorithm::Initialize(const AudioParameters& params) {
+void AudioRendererAlgorithm::Initialize(const AudioParameters& params,
+ bool is_encrypted) {
CHECK(params.IsValid());
channels_ = params.channels();
samples_per_second_ = params.sample_rate();
- initial_capacity_ = capacity_ =
- std::max(params.frames_per_buffer() * 2,
- ConvertMillisecondsToFrames(kStartingCapacityInMs));
+ initial_capacity_ = capacity_ = std::max(
+ params.frames_per_buffer() * 2,
+ ConvertMillisecondsToFrames(is_encrypted
+ ? kStartingCapacityForEncryptedInMs
+ : kStartingCapacityInMs));
max_capacity_ =
std::max(initial_capacity_, kMaxCapacityInSeconds * samples_per_second_);
num_candidate_blocks_ = ConvertMillisecondsToFrames(kWsolaSearchIntervalMs);
« no previous file with comments | « media/filters/audio_renderer_algorithm.h ('k') | media/filters/audio_renderer_algorithm_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698