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

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

Issue 1642143003: [Chromecast] Log sample rate changes and tweak audio logging output. (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
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/stream_mixer_alsa.h" 5 #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 &unsigned_output_samples_per_second, 340 &unsigned_output_samples_per_second,
341 kAlsaDirDontCare); 341 kAlsaDirDontCare);
342 if (requested_rate != unsigned_output_samples_per_second) { 342 if (requested_rate != unsigned_output_samples_per_second) {
343 LOG(ERROR) << "Requested sample rate (" << requested_rate 343 LOG(ERROR) << "Requested sample rate (" << requested_rate
344 << " Hz) does not match the actual sample rate (" 344 << " Hz) does not match the actual sample rate ("
345 << unsigned_output_samples_per_second 345 << unsigned_output_samples_per_second
346 << " Hz). This may lead to lower audio quality."; 346 << " Hz). This may lead to lower audio quality.";
347 } 347 }
348 output_samples_per_second_ = 348 output_samples_per_second_ =
349 static_cast<int>(unsigned_output_samples_per_second); 349 static_cast<int>(unsigned_output_samples_per_second);
350 LOG(INFO) << "Sample rate changed from " << output_samples_per_second_
kmackay 2016/01/28 23:25:41 Seems like this should be moved up above the line
jyw 2016/01/28 23:39:22 Done.
351 << " to " << unsigned_output_samples_per_second;
350 352
351 snd_pcm_uframes_t requested_buffer_size = alsa_buffer_size_; 353 snd_pcm_uframes_t requested_buffer_size = alsa_buffer_size_;
352 RETURN_ERROR_CODE(PcmHwParamsSetBufferSizeNear, pcm_, pcm_hw_params_, 354 RETURN_ERROR_CODE(PcmHwParamsSetBufferSizeNear, pcm_, pcm_hw_params_,
353 &alsa_buffer_size_); 355 &alsa_buffer_size_);
354 if (requested_buffer_size != alsa_buffer_size_) { 356 if (requested_buffer_size != alsa_buffer_size_) {
355 LOG(ERROR) << "Requested buffer size (" << requested_buffer_size 357 LOG(ERROR) << "Requested buffer size (" << requested_buffer_size
356 << " frames) does not match the actual buffer size (" 358 << " frames) does not match the actual buffer size ("
357 << alsa_buffer_size_ 359 << alsa_buffer_size_
358 << " frames). This may lead to an increase in " 360 << " frames). This may lead to an increase in "
359 "either audio latency or audio underruns."; 361 "either audio latency or audio underruns.";
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 rendering_delay_.timestamp_microseconds = 760 rendering_delay_.timestamp_microseconds =
759 TimespecToMicroseconds(status_timestamp); 761 TimespecToMicroseconds(status_timestamp);
760 snd_pcm_sframes_t delay_frames = alsa_->PcmStatusGetDelay(pcm_status_); 762 snd_pcm_sframes_t delay_frames = alsa_->PcmStatusGetDelay(pcm_status_);
761 rendering_delay_.delay_microseconds = static_cast<int64_t>(delay_frames) * 763 rendering_delay_.delay_microseconds = static_cast<int64_t>(delay_frames) *
762 base::Time::kMicrosecondsPerSecond / 764 base::Time::kMicrosecondsPerSecond /
763 output_samples_per_second_; 765 output_samples_per_second_;
764 } 766 }
765 767
766 } // namespace media 768 } // namespace media
767 } // namespace chromecast 769 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698