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

Side by Side Diff: media/audio/pulse/pulse_output.h

Issue 314713002: Modifies AudioInputCallback::OnData and use media::AudioBus instead of plain byte vector (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed SpeechRecognitionBrowserTest Created 6 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
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 // Creates an audio output stream based on the PulseAudio asynchronous API; 5 // Creates an audio output stream based on the PulseAudio asynchronous API;
6 // specifically using the pa_threaded_mainloop model. 6 // specifically using the pa_threaded_mainloop model.
7 // 7 //
8 // If the stream is successfully opened, Close() must be called before the 8 // If the stream is successfully opened, Close() must be called before the
9 // stream is deleted as Close() is responsible for ensuring resource cleanup 9 // stream is deleted as Close() is responsible for ensuring resource cleanup
10 // occurs. 10 // occurs.
11 // 11 //
12 // This object is designed so that all AudioOutputStream methods will be called 12 // This object is designed so that all AudioOutputStream methods will be called
13 // on the same thread that created the object. 13 // on the same thread that created the object.
14 // 14 //
15 // WARNING: This object blocks on internal PulseAudio calls in Open() while 15 // WARNING: This object blocks on internal PulseAudio calls in Open() while
16 // waiting for PulseAudio's context structure to be ready. It also blocks in 16 // waiting for PulseAudio's context structure to be ready. It also blocks in
17 // inside PulseAudio in Start() and repeated during playback, waiting for 17 // inside PulseAudio in Start() and repeated during playback, waiting for
18 // PulseAudio write callbacks to occur. 18 // PulseAudio write callbacks to occur.
19 19
20 #ifndef MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ 20 #ifndef MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_
21 #define MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ 21 #define MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_
22 22
23 #include <string> 23 #include <string>
24 24
25 #include "base/memory/scoped_ptr.h" 25 #include "base/memory/scoped_ptr.h"
26 #include "base/threading/thread_checker.h"
26 #include "media/audio/audio_io.h" 27 #include "media/audio/audio_io.h"
27 #include "media/audio/audio_parameters.h" 28 #include "media/audio/audio_parameters.h"
28 29
29 struct pa_context; 30 struct pa_context;
30 struct pa_operation; 31 struct pa_operation;
31 struct pa_stream; 32 struct pa_stream;
32 struct pa_threaded_mainloop; 33 struct pa_threaded_mainloop;
33 34
34 namespace media { 35 namespace media {
35 class AudioManagerBase; 36 class AudioManagerBase;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Float representation of volume from 0.0 to 1.0. 84 // Float representation of volume from 0.0 to 1.0.
84 float volume_; 85 float volume_;
85 86
86 // Callback to audio data source. Must only be modified while holding a lock 87 // Callback to audio data source. Must only be modified while holding a lock
87 // on |pa_mainloop_| via pa_threaded_mainloop_lock(). 88 // on |pa_mainloop_| via pa_threaded_mainloop_lock().
88 AudioSourceCallback* source_callback_; 89 AudioSourceCallback* source_callback_;
89 90
90 // Container for retrieving data from AudioSourceCallback::OnMoreData(). 91 // Container for retrieving data from AudioSourceCallback::OnMoreData().
91 scoped_ptr<AudioBus> audio_bus_; 92 scoped_ptr<AudioBus> audio_bus_;
92 93
94 base::ThreadChecker thread_checker_;
95
93 DISALLOW_COPY_AND_ASSIGN(PulseAudioOutputStream); 96 DISALLOW_COPY_AND_ASSIGN(PulseAudioOutputStream);
94 }; 97 };
95 98
96 } // namespace media 99 } // namespace media
97 100
98 #endif // MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ 101 #endif // MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698