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

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

Issue 1171953002: Add IPC interface for switching the audio output device for a given audio stream in the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reviewers' comments Created 5 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_OUTPUT_IPC_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_
6 #define MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_
7 7
8 #include <string>
9
8 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
9 #include "base/sync_socket.h" 11 #include "base/sync_socket.h"
10 #include "media/audio/audio_parameters.h" 12 #include "media/audio/audio_parameters.h"
11 #include "media/base/media_export.h" 13 #include "media/base/media_export.h"
14 #include "url/gurl.h"
12 15
13 namespace media { 16 namespace media {
14 17
15 // Contains IPC notifications for the state of the server side 18 // Contains IPC notifications for the state of the server side
16 // (AudioOutputController) audio state changes and when an AudioOutputController 19 // (AudioOutputController) audio state changes and when an AudioOutputController
17 // has been created. Implemented by AudioOutputDevice. 20 // has been created. Implemented by AudioOutputDevice.
18 class MEDIA_EXPORT AudioOutputIPCDelegate { 21 class MEDIA_EXPORT AudioOutputIPCDelegate {
19 public: 22 public:
20 // Current status of the audio output stream in the browser process. Browser 23 // Current status of the audio output stream in the browser process. Browser
21 // sends information about the current playback state and error to the 24 // sends information about the current playback state and error to the
22 // renderer process using this type. 25 // renderer process using this type.
23 enum State { 26 enum State {
24 kPlaying, 27 kPlaying,
25 kPaused, 28 kPaused,
26 kError, 29 kError,
27 kStateLast = kError 30 kStateLast = kError
28 }; 31 };
29 32
33 // Result of an audio output device switch operation
34 enum SwitchOutputDeviceResult {
35 kSuccess = 0,
36 kNotFoundError,
37 kSecurityError,
38 kObsoleteError,
39 kNotSupportedError,
40 kSwitchOutputDeviceResultLast = kNotSupportedError
ncarter (slow) 2015/06/10 18:10:48 "Though the Google C++ Style Guide now says to use
ncarter (slow) 2015/06/10 18:13:03 Also: "enum values should start with the name of t
Guido Urdaneta 2015/06/10 18:23:05 I'm using kStyle here because the file contains a
ncarter (slow) 2015/06/10 19:14:20 Tell you what: if you do 3, I'll send you a patch
Guido Urdaneta 2015/06/11 00:51:57 Done.
41 };
42
30 // Called when state of an audio stream has changed. 43 // Called when state of an audio stream has changed.
31 virtual void OnStateChanged(State state) = 0; 44 virtual void OnStateChanged(State state) = 0;
32 45
33 // Called when an audio stream has been created. 46 // Called when an audio stream has been created.
34 // The shared memory |handle| points to a memory section that's used to 47 // The shared memory |handle| points to a memory section that's used to
35 // transfer audio buffers from the AudioOutputIPCDelegate back to the 48 // transfer audio buffers from the AudioOutputIPCDelegate back to the
36 // AudioRendererHost. The implementation of OnStreamCreated takes ownership. 49 // AudioRendererHost. The implementation of OnStreamCreated takes ownership.
37 // The |socket_handle| is used by AudioRendererHost to signal requests for 50 // The |socket_handle| is used by AudioRendererHost to signal requests for
38 // audio data to be written into the shared memory. The AudioOutputIPCDelegate 51 // audio data to be written into the shared memory. The AudioOutputIPCDelegate
39 // must read from this socket and provide audio whenever data (search for 52 // must read from this socket and provide audio whenever data (search for
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // AudioOutputController in the peer process. 95 // AudioOutputController in the peer process.
83 virtual void CloseStream() = 0; 96 virtual void CloseStream() = 0;
84 97
85 // Sets the volume of the audio stream. 98 // Sets the volume of the audio stream.
86 virtual void SetVolume(double volume) = 0; 99 virtual void SetVolume(double volume) = 0;
87 }; 100 };
88 101
89 } // namespace media 102 } // namespace media
90 103
91 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ 104 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698