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

Side by Side Diff: media/audio/mac/audio_auhal_mac.h

Issue 1864483002: Forward output glitch information from stream WebRTC log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 6 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 | « media/audio/fake_audio_manager.cc ('k') | media/audio/mac/audio_auhal_mac.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // Implementation notes: 5 // Implementation notes:
6 // 6 //
7 // - It is recommended to first acquire the native sample rate of the default 7 // - It is recommended to first acquire the native sample rate of the default
8 // output device and then use the same rate when creating this object. 8 // output device and then use the same rate when creating this object.
9 // Use AudioManagerMac::HardwareSampleRate() to retrieve the sample rate. 9 // Use AudioManagerMac::HardwareSampleRate() to retrieve the sample rate.
10 // - Calling Close() also leads to self destruction. 10 // - Calling Close() also leads to self destruction.
(...skipping 12 matching lines...) Expand all
23 #include <stdint.h> 23 #include <stdint.h>
24 24
25 #include <memory> 25 #include <memory>
26 26
27 #include "base/cancelable_callback.h" 27 #include "base/cancelable_callback.h"
28 #include "base/compiler_specific.h" 28 #include "base/compiler_specific.h"
29 #include "base/macros.h" 29 #include "base/macros.h"
30 #include "base/synchronization/lock.h" 30 #include "base/synchronization/lock.h"
31 #include "base/threading/thread_checker.h" 31 #include "base/threading/thread_checker.h"
32 #include "media/audio/audio_io.h" 32 #include "media/audio/audio_io.h"
33 #include "media/audio/audio_manager.h"
33 #include "media/base/audio_parameters.h" 34 #include "media/base/audio_parameters.h"
34 35
35 namespace media { 36 namespace media {
36 37
37 class AudioManagerMac; 38 class AudioManagerMac;
38 class AudioPullFifo; 39 class AudioPullFifo;
39 40
40 // Implementation of AudioOuputStream for Mac OS X using the 41 // Implementation of AudioOuputStream for Mac OS X using the
41 // AUHAL Audio Unit present in OS 10.4 and later. 42 // AUHAL Audio Unit present in OS 10.4 and later.
42 // It is useful for low-latency output. 43 // It is useful for low-latency output.
(...skipping 23 matching lines...) Expand all
66 // between the browser and render process in AudioSyncReader. 67 // between the browser and render process in AudioSyncReader.
67 // We need to fix this. 68 // We need to fix this.
68 69
69 class AUHALStream : public AudioOutputStream { 70 class AUHALStream : public AudioOutputStream {
70 public: 71 public:
71 // |manager| creates this object. 72 // |manager| creates this object.
72 // |device| is the CoreAudio device to use for the stream. 73 // |device| is the CoreAudio device to use for the stream.
73 // It will often be the default output device. 74 // It will often be the default output device.
74 AUHALStream(AudioManagerMac* manager, 75 AUHALStream(AudioManagerMac* manager,
75 const AudioParameters& params, 76 const AudioParameters& params,
76 AudioDeviceID device); 77 AudioDeviceID device,
78 const AudioManager::LogCallback& log_callback);
77 // The dtor is typically called by the AudioManager only and it is usually 79 // The dtor is typically called by the AudioManager only and it is usually
78 // triggered by calling AudioOutputStream::Close(). 80 // triggered by calling AudioOutputStream::Close().
79 ~AUHALStream() override; 81 ~AUHALStream() override;
80 82
81 // Implementation of AudioOutputStream. 83 // Implementation of AudioOutputStream.
82 bool Open() override; 84 bool Open() override;
83 void Close() override; 85 void Close() override;
84 void Start(AudioSourceCallback* callback) override; 86 void Start(AudioSourceCallback* callback) override;
85 void Stop() override; 87 void Stop() override;
86 void SetVolume(double volume) override; 88 void SetVolume(double volume) override;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // NOTE: Float64 and UInt32 types are used for native API compatibility. 209 // NOTE: Float64 and UInt32 types are used for native API compatibility.
208 Float64 last_sample_time_; 210 Float64 last_sample_time_;
209 UInt32 last_number_of_frames_; 211 UInt32 last_number_of_frames_;
210 UInt32 total_lost_frames_; 212 UInt32 total_lost_frames_;
211 UInt32 largest_glitch_frames_; 213 UInt32 largest_glitch_frames_;
212 int glitches_detected_; 214 int glitches_detected_;
213 215
214 // Used to defer Start() to workaround http://crbug.com/160920. 216 // Used to defer Start() to workaround http://crbug.com/160920.
215 base::CancelableClosure deferred_start_cb_; 217 base::CancelableClosure deferred_start_cb_;
216 218
219 // Callback to send statistics info.
220 AudioManager::LogCallback log_callback_;
221
217 // Used to make sure control functions (Start(), Stop() etc) are called on the 222 // Used to make sure control functions (Start(), Stop() etc) are called on the
218 // right thread. 223 // right thread.
219 base::ThreadChecker thread_checker_; 224 base::ThreadChecker thread_checker_;
220 225
221 DISALLOW_COPY_AND_ASSIGN(AUHALStream); 226 DISALLOW_COPY_AND_ASSIGN(AUHALStream);
222 }; 227 };
223 228
224 } // namespace media 229 } // namespace media
225 230
226 #endif // MEDIA_AUDIO_MAC_AUDIO_AUHAL_MAC_H_ 231 #endif // MEDIA_AUDIO_MAC_AUDIO_AUHAL_MAC_H_
OLDNEW
« no previous file with comments | « media/audio/fake_audio_manager.cc ('k') | media/audio/mac/audio_auhal_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698