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

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

Issue 1632393002: [Chromecast] Resample all audio below 32000 Hz. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chromecast/media/cma/backend/alsa/stream_mixer_alsa.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
27 TRACE_EVENT2("cma", __FUNCTION__, #arg1, arg1, #arg2, arg2) 27 TRACE_EVENT2("cma", __FUNCTION__, #arg1, arg1, #arg2, arg2)
28 28
29 namespace chromecast { 29 namespace chromecast {
30 namespace media { 30 namespace media {
31 31
32 namespace { 32 namespace {
33 33
34 const CastAudioDecoder::OutputFormat kDecoderSampleFormat = 34 const CastAudioDecoder::OutputFormat kDecoderSampleFormat =
35 CastAudioDecoder::kOutputPlanarFloat; 35 CastAudioDecoder::kOutputPlanarFloat;
36 36
37 const int kInvalidSampleRate = -1;
38 const int64_t kInvalidDelayTimestamp = std::numeric_limits<int64_t>::min(); 37 const int64_t kInvalidDelayTimestamp = std::numeric_limits<int64_t>::min();
39 38
40 AudioDecoderAlsa::RenderingDelay kInvalidRenderingDelay() { 39 AudioDecoderAlsa::RenderingDelay kInvalidRenderingDelay() {
41 AudioDecoderAlsa::RenderingDelay delay; 40 AudioDecoderAlsa::RenderingDelay delay;
42 delay.timestamp_microseconds = kInvalidDelayTimestamp; 41 delay.timestamp_microseconds = kInvalidDelayTimestamp;
43 delay.delay_microseconds = 0; 42 delay.delay_microseconds = 0;
44 return delay; 43 return delay;
45 } 44 }
46 45
47 } // namespace 46 } // namespace
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 last_known_delay_.timestamp_microseconds = kInvalidDelayTimestamp; 85 last_known_delay_.timestamp_microseconds = kInvalidDelayTimestamp;
87 return false; 86 return false;
88 } 87 }
89 last_known_delay_.delay_microseconds = 0; 88 last_known_delay_.delay_microseconds = 0;
90 return true; 89 return true;
91 } 90 }
92 91
93 bool AudioDecoderAlsa::Start(int64_t start_pts) { 92 bool AudioDecoderAlsa::Start(int64_t start_pts) {
94 TRACE_FUNCTION_ENTRY0(); 93 TRACE_FUNCTION_ENTRY0();
95 current_pts_ = start_pts; 94 current_pts_ = start_pts;
96 DCHECK_NE(config_.samples_per_second, kInvalidSampleRate); 95 DCHECK(IsValidConfig(config_));
97 mixer_input_.reset(new StreamMixerAlsaInput( 96 mixer_input_.reset(new StreamMixerAlsaInput(
98 this, config_.samples_per_second, backend_->Primary())); 97 this, config_.samples_per_second, backend_->Primary()));
99 mixer_input_->SetVolumeMultiplier(volume_multiplier_); 98 mixer_input_->SetVolumeMultiplier(volume_multiplier_);
100 // Create decoder_ if necessary. This can happen if Stop() was called, and 99 // Create decoder_ if necessary. This can happen if Stop() was called, and
101 // SetConfig() was not called since then. 100 // SetConfig() was not called since then.
102 if (!decoder_) 101 if (!decoder_)
103 CreateDecoder(); 102 CreateDecoder();
104 return true; 103 return true;
105 } 104 }
106 105
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void AudioDecoderAlsa::OnMixerError() { 289 void AudioDecoderAlsa::OnMixerError() {
291 TRACE_FUNCTION_ENTRY0(); 290 TRACE_FUNCTION_ENTRY0();
292 DCHECK(task_runner_->BelongsToCurrentThread()); 291 DCHECK(task_runner_->BelongsToCurrentThread());
293 LOG(ERROR) << "Mixer error occured."; 292 LOG(ERROR) << "Mixer error occured.";
294 error_ = true; 293 error_ = true;
295 delegate_->OnDecoderError(); 294 delegate_->OnDecoderError();
296 } 295 }
297 296
298 } // namespace media 297 } // namespace media
299 } // namespace chromecast 298 } // namespace chromecast
OLDNEW
« no previous file with comments | « no previous file | chromecast/media/cma/backend/alsa/stream_mixer_alsa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698