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

Side by Side Diff: chromecast/media/cma/backend/alsa/audio_decoder_alsa.cc

Issue 2701613006: [Chromecast] Process streams with different post-processing. (Closed)
Patch Set: Fix unittests Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromecast/media/cma/backend/alsa/audio_decoder_alsa.h" 5 #include "chromecast/media/cma/backend/alsa/audio_decoder_alsa.h"
6 6
7 #include <time.h> 7 #include <time.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 pending_output_frames_ = kNoPendingOutput; 101 pending_output_frames_ = kNoPendingOutput;
102 102
103 last_mixer_delay_.timestamp_microseconds = kInvalidTimestamp; 103 last_mixer_delay_.timestamp_microseconds = kInvalidTimestamp;
104 last_mixer_delay_.delay_microseconds = 0; 104 last_mixer_delay_.delay_microseconds = 0;
105 } 105 }
106 106
107 bool AudioDecoderAlsa::Start(int64_t start_pts) { 107 bool AudioDecoderAlsa::Start(int64_t start_pts) {
108 TRACE_FUNCTION_ENTRY0(); 108 TRACE_FUNCTION_ENTRY0();
109 current_pts_ = start_pts; 109 current_pts_ = start_pts;
110 DCHECK(IsValidConfig(config_)); 110 DCHECK(IsValidConfig(config_));
111 mixer_input_.reset(new StreamMixerAlsaInput( 111 mixer_input_.reset(new StreamMixerAlsaInput(this, config_.samples_per_second,
112 this, config_.samples_per_second, backend_->Primary())); 112 backend_->Primary(),
113 backend_->DeviceId()));
113 mixer_input_->SetVolumeMultiplier(volume_multiplier_); 114 mixer_input_->SetVolumeMultiplier(volume_multiplier_);
114 // Create decoder_ if necessary. This can happen if Stop() was called, and 115 // Create decoder_ if necessary. This can happen if Stop() was called, and
115 // SetConfig() was not called since then. 116 // SetConfig() was not called since then.
116 if (!decoder_) { 117 if (!decoder_) {
117 CreateDecoder(); 118 CreateDecoder();
118 } 119 }
119 if (!rate_shifter_) { 120 if (!rate_shifter_) {
120 CreateRateShifter(config_.samples_per_second); 121 CreateRateShifter(config_.samples_per_second);
121 } 122 }
122 return true; 123 return true;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 (config.samples_per_second != config_.samples_per_second); 223 (config.samples_per_second != config_.samples_per_second);
223 224
224 if (!rate_shifter_ || changed_sample_rate) { 225 if (!rate_shifter_ || changed_sample_rate) {
225 CreateRateShifter(config.samples_per_second); 226 CreateRateShifter(config.samples_per_second);
226 } 227 }
227 228
228 if (mixer_input_ && changed_sample_rate) { 229 if (mixer_input_ && changed_sample_rate) {
229 // Destroy the old input first to ensure that the mixer output sample rate 230 // Destroy the old input first to ensure that the mixer output sample rate
230 // is updated. 231 // is updated.
231 mixer_input_.reset(); 232 mixer_input_.reset();
232 mixer_input_.reset(new StreamMixerAlsaInput( 233 mixer_input_.reset(new StreamMixerAlsaInput(this, config.samples_per_second,
233 this, config.samples_per_second, backend_->Primary())); 234 backend_->Primary(),
235 backend_->DeviceId()));
234 mixer_input_->SetVolumeMultiplier(volume_multiplier_); 236 mixer_input_->SetVolumeMultiplier(volume_multiplier_);
235 pending_output_frames_ = kNoPendingOutput; 237 pending_output_frames_ = kNoPendingOutput;
236 } 238 }
237 239
238 config_ = config; 240 config_ = config;
239 decoder_.reset(); 241 decoder_.reset();
240 CreateDecoder(); 242 CreateDecoder();
241 243
242 if (pending_buffer_complete_ && changed_sample_rate) { 244 if (pending_buffer_complete_ && changed_sample_rate) {
243 pending_buffer_complete_ = false; 245 pending_buffer_complete_ = false;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 TRACE_FUNCTION_ENTRY0(); 529 TRACE_FUNCTION_ENTRY0();
528 DCHECK(task_runner_->BelongsToCurrentThread()); 530 DCHECK(task_runner_->BelongsToCurrentThread());
529 if (error != MixerError::kInputIgnored) 531 if (error != MixerError::kInputIgnored)
530 LOG(ERROR) << "Mixer error occurred."; 532 LOG(ERROR) << "Mixer error occurred.";
531 mixer_error_ = true; 533 mixer_error_ = true;
532 delegate_->OnDecoderError(); 534 delegate_->OnDecoderError();
533 } 535 }
534 536
535 } // namespace media 537 } // namespace media
536 } // namespace chromecast 538 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/media/cma/backend/alsa/BUILD.gn ('k') | chromecast/media/cma/backend/alsa/audio_filter_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698