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

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

Issue 2582533002: Simplify AudioInputRendererHost IPC interface. (Closed)
Patch Set: Rebase. Created 3 years, 11 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_IPC_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_INPUT_IPC_H_
6 #define MEDIA_AUDIO_AUDIO_INPUT_IPC_H_ 6 #define MEDIA_AUDIO_AUDIO_INPUT_IPC_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/sync_socket.h" 11 #include "base/sync_socket.h"
12 #include "media/base/audio_parameters.h" 12 #include "media/base/audio_parameters.h"
13 #include "media/base/media_export.h" 13 #include "media/base/media_export.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 enum AudioInputIPCDelegateState {
18 AUDIO_INPUT_IPC_DELEGATE_STATE_RECORDING,
19 AUDIO_INPUT_IPC_DELEGATE_STATE_STOPPED,
20 AUDIO_INPUT_IPC_DELEGATE_STATE_ERROR,
21 AUDIO_INPUT_IPC_DELEGATE_STATE_LAST = AUDIO_INPUT_IPC_DELEGATE_STATE_ERROR,
22 };
23
24 // Contains IPC notifications for the state of the server side 17 // Contains IPC notifications for the state of the server side
25 // (AudioInputController) audio state changes and when an AudioInputController 18 // (AudioInputController) audio state changes and when an AudioInputController
26 // has been created. Implemented by AudioInputDevice. 19 // has been created. Implemented by AudioInputDevice.
27 class MEDIA_EXPORT AudioInputIPCDelegate { 20 class MEDIA_EXPORT AudioInputIPCDelegate {
28 public: 21 public:
29 // Called when an AudioInputController has been created. 22 // Called when an AudioInputController has been created.
30 // The shared memory |handle| points to a memory section that's used to 23 // The shared memory |handle| points to a memory section that's used to
31 // transfer data between the AudioInputDevice and AudioInputController 24 // transfer data between the AudioInputDevice and AudioInputController
32 // objects. The implementation of OnStreamCreated takes ownership. 25 // objects. The implementation of OnStreamCreated takes ownership.
33 // The |socket_handle| is used by the AudioInputController to signal 26 // The |socket_handle| is used by the AudioInputController to signal
34 // notifications that more data is available and can optionally provide 27 // notifications that more data is available and can optionally provide
35 // parameter changes back. The AudioInputDevice must read from this socket 28 // parameter changes back. The AudioInputDevice must read from this socket
36 // and process the shared memory whenever data is read from the socket. 29 // and process the shared memory whenever data is read from the socket.
37 virtual void OnStreamCreated(base::SharedMemoryHandle handle, 30 virtual void OnStreamCreated(base::SharedMemoryHandle handle,
38 base::SyncSocket::Handle socket_handle, 31 base::SyncSocket::Handle socket_handle,
39 int length, 32 int length,
40 int total_segments) = 0; 33 int total_segments) = 0;
41 34
42 // Called when state of an audio stream has changed. 35 // Called when state of an audio stream has changed.
43 virtual void OnStateChanged(AudioInputIPCDelegateState state) = 0; 36 virtual void OnError() = 0;
44
45 // Called when the input stream volume has changed.
46 virtual void OnVolume(double volume) = 0;
47 37
48 // Called when the AudioInputIPC object is going away and/or when the 38 // Called when the AudioInputIPC object is going away and/or when the
49 // IPC channel has been closed and no more IPC requests can be made. 39 // IPC channel has been closed and no more IPC requests can be made.
50 // Implementations should delete their owned AudioInputIPC instance 40 // Implementations should delete their owned AudioInputIPC instance
51 // immediately. 41 // immediately.
52 virtual void OnIPCClosed() = 0; 42 virtual void OnIPCClosed() = 0;
53 43
54 protected: 44 protected:
55 virtual ~AudioInputIPCDelegate(); 45 virtual ~AudioInputIPCDelegate();
56 }; 46 };
(...skipping 24 matching lines...) Expand all
81 virtual void SetVolume(double volume) = 0; 71 virtual void SetVolume(double volume) = 0;
82 72
83 // Closes the audio stream, which should shut down the corresponding 73 // Closes the audio stream, which should shut down the corresponding
84 // AudioInputController in the peer process. 74 // AudioInputController in the peer process.
85 virtual void CloseStream() = 0; 75 virtual void CloseStream() = 0;
86 }; 76 };
87 77
88 } // namespace media 78 } // namespace media
89 79
90 #endif // MEDIA_AUDIO_AUDIO_INPUT_IPC_H_ 80 #endif // MEDIA_AUDIO_AUDIO_INPUT_IPC_H_
OLDNEW
« media/audio/audio_input_device.cc ('K') | « media/audio/audio_input_device_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698