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

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

Issue 2941773002: Added initial muted state to stream creation callback, to avoid races. (Closed)
Patch Set: Added mute information to DoCompleteCreation log message. Created 3 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
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_INPUT_CONTROLLER_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // Native input stream reports an error. Exact reason differs between 98 // Native input stream reports an error. Exact reason differs between
99 // platforms. 99 // platforms.
100 STREAM_ERROR, // = 3 100 STREAM_ERROR, // = 3
101 }; 101 };
102 102
103 // An event handler that receives events from the AudioInputController. The 103 // An event handler that receives events from the AudioInputController. The
104 // following methods are all called on the audio thread. 104 // following methods are all called on the audio thread.
105 class MEDIA_EXPORT EventHandler { 105 class MEDIA_EXPORT EventHandler {
106 public: 106 public:
107 virtual void OnCreated(AudioInputController* controller) = 0; 107 // The initial "muted" state of the underlying stream is sent along with the
108 // OnCreated callback, to avoid the stream being treated as unmuted until an
109 // OnMuted callback has had time to be processed.
110 virtual void OnCreated(AudioInputController* controller,
111 bool initially_muted) = 0;
108 virtual void OnError(AudioInputController* controller, 112 virtual void OnError(AudioInputController* controller,
109 ErrorCode error_code) = 0; 113 ErrorCode error_code) = 0;
110 virtual void OnLog(AudioInputController* controller, 114 virtual void OnLog(AudioInputController* controller,
111 const std::string& message) = 0; 115 const std::string& message) = 0;
112 // Initially, an AudioInputController is considered not muted. If the 116 // Called whenever the muted state of the underlying stream changes.
113 // underlying stream is actually muted, an OnMuted callback will follow
114 // shortly after OnCreated. It is also called whenever the muted state of
115 // the underlying stream changes.
116 virtual void OnMuted(AudioInputController* controller, bool is_muted) = 0; 117 virtual void OnMuted(AudioInputController* controller, bool is_muted) = 0;
117 118
118 protected: 119 protected:
119 virtual ~EventHandler() {} 120 virtual ~EventHandler() {}
120 }; 121 };
121 122
122 // A synchronous writer interface used by AudioInputController for 123 // A synchronous writer interface used by AudioInputController for
123 // synchronous writing. 124 // synchronous writing.
124 class MEDIA_EXPORT SyncWriter { 125 class MEDIA_EXPORT SyncWriter {
125 public: 126 public:
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 // The weak_ptr_factory_ and all outstanding weak pointers, are invalidated 407 // The weak_ptr_factory_ and all outstanding weak pointers, are invalidated
407 // at the end of DoClose. 408 // at the end of DoClose.
408 base::WeakPtrFactory<AudioInputController> weak_ptr_factory_; 409 base::WeakPtrFactory<AudioInputController> weak_ptr_factory_;
409 410
410 DISALLOW_COPY_AND_ASSIGN(AudioInputController); 411 DISALLOW_COPY_AND_ASSIGN(AudioInputController);
411 }; 412 };
412 413
413 } // namespace media 414 } // namespace media
414 415
415 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 416 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_platform_audio_input.cc ('k') | media/audio/audio_input_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698