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

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

Issue 10583009: Revert 142862 - Change the way we are stopping audio stream on Mac once again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_output_mixer.cc ('k') | media/audio/mac/audio_output_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 (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 #ifndef MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_ 5 #ifndef MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_
6 #define MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_ 6 #define MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_
7 7
8 #include <AudioToolbox/AudioFormat.h> 8 #include <AudioToolbox/AudioFormat.h>
9 #include <AudioToolbox/AudioQueue.h> 9 #include <AudioToolbox/AudioQueue.h>
10 #include <AudioUnit/AudioUnit.h> 10 #include <AudioUnit/AudioUnit.h>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // The audio is double buffered. 44 // The audio is double buffered.
45 static const uint32 kNumBuffers = 2; 45 static const uint32 kNumBuffers = 2;
46 static const int kEmptyChannel = -1; 46 static const int kEmptyChannel = -1;
47 47
48 // Reorder PCM from source layout to device layout found in Core Audio. 48 // Reorder PCM from source layout to device layout found in Core Audio.
49 template<class Format> 49 template<class Format>
50 void SwizzleLayout(Format* b, uint32 filled); 50 void SwizzleLayout(Format* b, uint32 filled);
51 // Check and move channels if surround sound layout needs adjusted. 51 // Check and move channels if surround sound layout needs adjusted.
52 bool CheckForAdjustedLayout(Channels input_channel, Channels output_channel); 52 bool CheckForAdjustedLayout(Channels input_channel, Channels output_channel);
53 53
54 // Callback we are installing to find out when the stream is stopped.
55 static void IsRunningCallback(void* p_this,
56 AudioQueueRef queue,
57 AudioQueuePropertyID inID);
58
59 // The OS calls back here when an audio buffer has been processed. 54 // The OS calls back here when an audio buffer has been processed.
60 static void RenderCallback(void* p_this, AudioQueueRef queue, 55 static void RenderCallback(void* p_this, AudioQueueRef queue,
61 AudioQueueBufferRef buffer); 56 AudioQueueBufferRef buffer);
62 // Called when an error occurs. 57 // Called when an error occurs.
63 void HandleError(OSStatus err); 58 void HandleError(OSStatus err);
64 59
65 // Atomic operations for setting/getting the source callback. 60 // Atomic operations for setting/getting the source callback.
66 void SetSource(AudioSourceCallback* source); 61 void SetSource(AudioSourceCallback* source);
67 AudioSourceCallback* GetSource(); 62 AudioSourceCallback* GetSource();
68 63
(...skipping 27 matching lines...) Expand all
96 // An array for remapping source to device channel layouts during a swizzle. 91 // An array for remapping source to device channel layouts during a swizzle.
97 int channel_remap_[CHANNELS_MAX]; 92 int channel_remap_[CHANNELS_MAX];
98 // Number of channels in device layout. 93 // Number of channels in device layout.
99 int num_core_channels_; 94 int num_core_channels_;
100 // A flag to determine if swizzle is needed from source to device layouts. 95 // A flag to determine if swizzle is needed from source to device layouts.
101 bool should_swizzle_; 96 bool should_swizzle_;
102 // A flag to determine if downmix is needed from source to device layouts. 97 // A flag to determine if downmix is needed from source to device layouts.
103 bool should_down_mix_; 98 bool should_down_mix_;
104 99
105 // Event used for synchronization when stopping the stream. 100 // Event used for synchronization when stopping the stream.
106 // Callback sets it after stream is fully stopped. 101 // Callback sets it after stream is stopped.
107 base::WaitableEvent stopped_event_; 102 base::WaitableEvent stopped_event_;
108 // Flag set by rendering callback when it asks OS to stop the stream. 103 // When stopping we keep track of number of buffers in flight and
109 // All subsequent renderer callbacks calls just exit immediately, they 104 // signal "stop completed" from the last buffer's callback.
110 // are called to release the buffer (and we do it when closing the stream, 105 int num_buffers_left_;
111 // not in the callback).
112 bool stop_requested_;
113 106
114 DISALLOW_COPY_AND_ASSIGN(PCMQueueOutAudioOutputStream); 107 DISALLOW_COPY_AND_ASSIGN(PCMQueueOutAudioOutputStream);
115 }; 108 };
116 109
117 } // namespace media 110 } // namespace media
118 111
119 #endif // MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_ 112 #endif // MEDIA_AUDIO_MAC_AUDIO_OUTPUT_MAC_H_
OLDNEW
« no previous file with comments | « media/audio/audio_output_mixer.cc ('k') | media/audio/mac/audio_output_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698