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

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

Issue 1767603003: [chromecast] Add cast_shell --accept-resource-provider switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: bool -> int Created 4 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/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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // processed. 249 // processed.
250 int avail_min; 250 int avail_min;
251 GetSwitchValueAsNonNegativeInt(switches::kAlsaOutputAvailMin, period_size, 251 GetSwitchValueAsNonNegativeInt(switches::kAlsaOutputAvailMin, period_size,
252 &avail_min); 252 &avail_min);
253 if (avail_min > buffer_size) { 253 if (avail_min > buffer_size) {
254 LOG(DFATAL) << "ALSA avail min must be no larger than the buffer size"; 254 LOG(DFATAL) << "ALSA avail min must be no larger than the buffer size";
255 avail_min = alsa_period_size_; 255 avail_min = alsa_period_size_;
256 } 256 }
257 alsa_avail_min_ = avail_min; 257 alsa_avail_min_ = avail_min;
258 258
259 // --accept-resource-provider should imply a check close timeout of 0.
260 int default_close_timeout =
261 base::GetSwitchValueBoolean(switches::kAcceptResourceProvider)
262 ? 0
263 : kDefaultCheckCloseTimeoutMs;
byungchul 2016/03/07 17:19:40 Is this a right indentation? Why isn't it: int de
jyw 2016/03/08 02:09:24 git cl format is a no-op.
259 GetSwitchValueAsNonNegativeInt(switches::kAlsaCheckCloseTimeout, 264 GetSwitchValueAsNonNegativeInt(switches::kAlsaCheckCloseTimeout,
260 kDefaultCheckCloseTimeoutMs, 265 default_close_timeout, &check_close_timeout_);
261 &check_close_timeout_);
262 } 266 }
263 267
264 int StreamMixerAlsa::SetAlsaPlaybackParams() { 268 int StreamMixerAlsa::SetAlsaPlaybackParams() {
265 int err = 0; 269 int err = 0;
266 // Set hardware parameters. 270 // Set hardware parameters.
267 DCHECK(pcm_); 271 DCHECK(pcm_);
268 DCHECK(!pcm_hw_params_); 272 DCHECK(!pcm_hw_params_);
269 RETURN_ERROR_CODE(PcmHwParamsMalloc, &pcm_hw_params_); 273 RETURN_ERROR_CODE(PcmHwParamsMalloc, &pcm_hw_params_);
270 RETURN_ERROR_CODE(PcmHwParamsAny, pcm_, pcm_hw_params_); 274 RETURN_ERROR_CODE(PcmHwParamsAny, pcm_, pcm_hw_params_);
271 RETURN_ERROR_CODE(PcmHwParamsSetAccess, pcm_, pcm_hw_params_, 275 RETURN_ERROR_CODE(PcmHwParamsSetAccess, pcm_, pcm_hw_params_,
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 rendering_delay_.timestamp_microseconds = 767 rendering_delay_.timestamp_microseconds =
764 TimespecToMicroseconds(status_timestamp); 768 TimespecToMicroseconds(status_timestamp);
765 snd_pcm_sframes_t delay_frames = alsa_->PcmStatusGetDelay(pcm_status_); 769 snd_pcm_sframes_t delay_frames = alsa_->PcmStatusGetDelay(pcm_status_);
766 rendering_delay_.delay_microseconds = static_cast<int64_t>(delay_frames) * 770 rendering_delay_.delay_microseconds = static_cast<int64_t>(delay_frames) *
767 base::Time::kMicrosecondsPerSecond / 771 base::Time::kMicrosecondsPerSecond /
768 output_samples_per_second_; 772 output_samples_per_second_;
769 } 773 }
770 774
771 } // namespace media 775 } // namespace media
772 } // namespace chromecast 776 } // namespace chromecast
OLDNEW
« chromecast/base/chromecast_switches.cc ('K') | « chromecast/base/chromecast_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698