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

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

Issue 10914203: Add UMA reporting for audio hardware parameters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style! Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/audio/sample_rates.h » ('j') | media/audio/sample_rates.h » ('J')
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_output_resampler.h" 5 #include "media/audio/audio_output_resampler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/metrics/histogram.h"
11 #include "base/time.h" 12 #include "base/time.h"
12 #include "media/audio/audio_io.h" 13 #include "media/audio/audio_io.h"
13 #include "media/audio/audio_output_dispatcher_impl.h" 14 #include "media/audio/audio_output_dispatcher_impl.h"
14 #include "media/audio/audio_output_proxy.h" 15 #include "media/audio/audio_output_proxy.h"
15 #include "media/audio/audio_util.h" 16 #include "media/audio/audio_util.h"
17 #include "media/audio/sample_rates.h"
16 #include "media/base/audio_pull_fifo.h" 18 #include "media/base/audio_pull_fifo.h"
17 #include "media/base/multi_channel_resampler.h" 19 #include "media/base/multi_channel_resampler.h"
18 20
19 namespace media { 21 namespace media {
20 22
21 AudioOutputResampler::AudioOutputResampler(AudioManager* audio_manager, 23 AudioOutputResampler::AudioOutputResampler(AudioManager* audio_manager,
22 const AudioParameters& input_params, 24 const AudioParameters& input_params,
23 const AudioParameters& output_params, 25 const AudioParameters& output_params,
24 const base::TimeDelta& close_delay) 26 const base::TimeDelta& close_delay)
25 : AudioOutputDispatcher(audio_manager, input_params), 27 : AudioOutputDispatcher(audio_manager, input_params),
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 base::Unretained(this)))); 72 base::Unretained(this))));
71 } 73 }
72 74
73 DVLOG(1) << "I/O ratio is " << io_ratio_; 75 DVLOG(1) << "I/O ratio is " << io_ratio_;
74 } 76 }
75 77
76 // TODO(dalecurtis): All this code should be merged into AudioOutputMixer once 78 // TODO(dalecurtis): All this code should be merged into AudioOutputMixer once
77 // we've stabilized the issues there. 79 // we've stabilized the issues there.
78 dispatcher_ = new AudioOutputDispatcherImpl( 80 dispatcher_ = new AudioOutputDispatcherImpl(
79 audio_manager, output_params, close_delay); 81 audio_manager, output_params, close_delay);
82
83 // Fake enum histogram to get exact integral buckets. Expect to never see
84 // any values over 32 and even that is huge.
85 UMA_HISTOGRAM_ENUMERATION(
86 "Media.HardwareAudioBitsPerChannel", output_params.bits_per_sample(),
87 40);
scherkus (not reviewing) 2012/09/11 16:53:31 not worth enumifying a la sample rate?
DaleCurtis 2012/09/11 17:35:59 Copy/pasted from AudioDecoderConfig. You tell me.
88 UMA_HISTOGRAM_ENUMERATION(
89 "Media.HardwareAudioChannelLayout", output_params.channel_layout(),
scherkus (not reviewing) 2012/09/11 16:53:31 I thought we only got hardware channel *count* and
DaleCurtis 2012/09/11 17:35:59 This is all a copy paste of what's in AudioDecoder
DaleCurtis 2012/09/12 09:50:57 Done. I'm now pulling the actual hardware channel
90 CHANNEL_LAYOUT_MAX);
91 AudioSampleRate asr = media::AsAudioSampleRate(output_params.sample_rate());
92 if (asr != kUnexpectedAudioSampleRate) {
93 UMA_HISTOGRAM_ENUMERATION(
94 "Media.HardwareAudioSamplesPerSecond", asr, kUnexpectedAudioSampleRate);
95 } else {
96 UMA_HISTOGRAM_COUNTS(
97 "Media.HardwareAudioSamplesPerSecondUnexpected",
98 output_params.sample_rate());
99 }
80 } 100 }
81 101
82 AudioOutputResampler::~AudioOutputResampler() {} 102 AudioOutputResampler::~AudioOutputResampler() {}
83 103
84 bool AudioOutputResampler::OpenStream() { 104 bool AudioOutputResampler::OpenStream() {
85 // TODO(dalecurtis): Automatically revert to high latency path if OpenStream() 105 // TODO(dalecurtis): Automatically revert to high latency path if OpenStream()
86 // fails; use default high latency output values + rebuffering / resampling. 106 // fails; use default high latency output values + rebuffering / resampling.
87 return dispatcher_->OpenStream(); 107 return dispatcher_->OpenStream();
88 } 108 }
89 109
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 source_callback_->OnError(stream, code); 216 source_callback_->OnError(stream, code);
197 } 217 }
198 218
199 void AudioOutputResampler::WaitTillDataReady() { 219 void AudioOutputResampler::WaitTillDataReady() {
200 base::AutoLock auto_lock(source_lock_); 220 base::AutoLock auto_lock(source_lock_);
201 if (source_callback_ && !outstanding_audio_bytes_) 221 if (source_callback_ && !outstanding_audio_bytes_)
202 source_callback_->WaitTillDataReady(); 222 source_callback_->WaitTillDataReady();
203 } 223 }
204 224
205 } // namespace media 225 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/audio/sample_rates.h » ('j') | media/audio/sample_rates.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698