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

Side by Side Diff: media/audio/audio_io.h

Issue 922663002: Moved the fake input stream's processing onto the audio worker thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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/BUILD.gn ('k') | media/audio/fake_audio_consumer.h » ('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_AUDIO_IO_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_IO_H_
6 #define MEDIA_AUDIO_AUDIO_IO_H_ 6 #define MEDIA_AUDIO_AUDIO_IO_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "media/base/audio_bus.h" 9 #include "media/base/audio_bus.h"
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 namespace media { 49 namespace media {
50 50
51 class MEDIA_EXPORT AudioOutputStream { 51 class MEDIA_EXPORT AudioOutputStream {
52 public: 52 public:
53 // Audio sources must implement AudioSourceCallback. This interface will be 53 // Audio sources must implement AudioSourceCallback. This interface will be
54 // called in a random thread which very likely is a high priority thread. Do 54 // called in a random thread which very likely is a high priority thread. Do
55 // not rely on using this thread TLS or make calls that alter the thread 55 // not rely on using this thread TLS or make calls that alter the thread
56 // itself such as creating Windows or initializing COM. 56 // itself such as creating Windows or initializing COM.
57 class MEDIA_EXPORT AudioSourceCallback { 57 class MEDIA_EXPORT AudioSourceCallback {
58 public: 58 public:
59 virtual ~AudioSourceCallback() {}
60
59 // Provide more data by fully filling |dest|. The source will return 61 // Provide more data by fully filling |dest|. The source will return
60 // the number of frames it filled. |total_bytes_delay| contains current 62 // the number of frames it filled. |total_bytes_delay| contains current
61 // number of bytes of delay buffered by the AudioOutputStream. 63 // number of bytes of delay buffered by the AudioOutputStream.
62 virtual int OnMoreData(AudioBus* dest, uint32 total_bytes_delay) = 0; 64 virtual int OnMoreData(AudioBus* dest, uint32 total_bytes_delay) = 0;
63 65
64 // There was an error while playing a buffer. Audio source cannot be 66 // There was an error while playing a buffer. Audio source cannot be
65 // destroyed yet. No direct action needed by the AudioStream, but it is 67 // destroyed yet. No direct action needed by the AudioStream, but it is
66 // a good place to stop accumulating sound data since is is likely that 68 // a good place to stop accumulating sound data since is is likely that
67 // playback will not continue. 69 // playback will not continue.
68 virtual void OnError(AudioOutputStream* stream) = 0; 70 virtual void OnError(AudioOutputStream* stream) = 0;
69
70 protected:
71 virtual ~AudioSourceCallback() {}
72 }; 71 };
73 72
74 virtual ~AudioOutputStream() {} 73 virtual ~AudioOutputStream() {}
75 74
76 // Open the stream. false is returned if the stream cannot be opened. Open() 75 // Open the stream. false is returned if the stream cannot be opened. Open()
77 // must always be followed by a call to Close() even if Open() fails. 76 // must always be followed by a call to Close() even if Open() fails.
78 virtual bool Open() = 0; 77 virtual bool Open() = 0;
79 78
80 // Starts playing audio and generating AudioSourceCallback::OnMoreData(). 79 // Starts playing audio and generating AudioSourceCallback::OnMoreData().
81 // Since implementor of AudioOutputStream may have internal buffers, right 80 // Since implementor of AudioOutputStream may have internal buffers, right
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // Returns the Automatic Gain Control (AGC) state. 164 // Returns the Automatic Gain Control (AGC) state.
166 virtual bool GetAutomaticGainControl() = 0; 165 virtual bool GetAutomaticGainControl() = 0;
167 166
168 // Returns the current muting state for the microphone. 167 // Returns the current muting state for the microphone.
169 virtual bool IsMuted() = 0; 168 virtual bool IsMuted() = 0;
170 }; 169 };
171 170
172 } // namespace media 171 } // namespace media
173 172
174 #endif // MEDIA_AUDIO_AUDIO_IO_H_ 173 #endif // MEDIA_AUDIO_AUDIO_IO_H_
OLDNEW
« no previous file with comments | « media/audio/BUILD.gn ('k') | media/audio/fake_audio_consumer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698