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

Side by Side Diff: media/audio/audio_parameters.cc

Issue 638123004: Type conversion fixes, media/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile Created 6 years, 2 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 | media/base/sinc_resampler.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/audio/audio_parameters.h" 5 #include "media/audio/audio_parameters.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/limits.h" 8 #include "media/base/limits.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 int AudioParameters::GetBytesPerSecond() const { 94 int AudioParameters::GetBytesPerSecond() const {
95 return sample_rate_ * GetBytesPerFrame(); 95 return sample_rate_ * GetBytesPerFrame();
96 } 96 }
97 97
98 int AudioParameters::GetBytesPerFrame() const { 98 int AudioParameters::GetBytesPerFrame() const {
99 return channels_ * bits_per_sample_ / 8; 99 return channels_ * bits_per_sample_ / 8;
100 } 100 }
101 101
102 base::TimeDelta AudioParameters::GetBufferDuration() const { 102 base::TimeDelta AudioParameters::GetBufferDuration() const {
103 return base::TimeDelta::FromMicroseconds( 103 return base::TimeDelta::FromMicroseconds(static_cast<int64>(
104 frames_per_buffer_ * base::Time::kMicrosecondsPerSecond / 104 frames_per_buffer_ * base::Time::kMicrosecondsPerSecond /
105 static_cast<float>(sample_rate_)); 105 static_cast<float>(sample_rate_)));
106 } 106 }
107 107
108 bool AudioParameters::Equals(const AudioParameters& other) const { 108 bool AudioParameters::Equals(const AudioParameters& other) const {
109 return format_ == other.format() && 109 return format_ == other.format() &&
110 sample_rate_ == other.sample_rate() && 110 sample_rate_ == other.sample_rate() &&
111 channel_layout_ == other.channel_layout() && 111 channel_layout_ == other.channel_layout() &&
112 channels_ == other.channels() && 112 channels_ == other.channels() &&
113 bits_per_sample_ == other.bits_per_sample() && 113 bits_per_sample_ == other.bits_per_sample() &&
114 frames_per_buffer_ == other.frames_per_buffer() && 114 frames_per_buffer_ == other.frames_per_buffer() &&
115 effects_ == other.effects(); 115 effects_ == other.effects();
116 } 116 }
117 117
118 } // namespace media 118 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/sinc_resampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698