1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 import "media/mojo/mojom/audio_parameters.mojom";
8 import "media/mojo/mojom/media_types.mojom";
10 // An interface for controlling an audio input stream.
11 // On error, the message pipe is closed.
12 // To close the stream, just close the message pipe.
13 interface AudioInputStream {
14 // Starts recording audio, can be called only once.
17 // Sets volume. Volume must be in the range [0, 1].
18 SetVolume(double volume);
21 // An interface for receiving notifications of state changes of an
23 interface AudioInputStreamClient {
24 OnError(InputStreamErrorCode code);
25 OnMutedStateChanged(bool is_muted);
27 [EnableIf=is_tizen_tv]
28 OnMediaStateChanged(uint32 previous, uint32 current);
31 // An AudioInputStreamObserver gets notifications about events related to an
32 // AudioInputStream. DidStartRecording() is invoked when the stream starts
33 // recording. Stream destruction is notified through binding connection error.
34 interface AudioInputStreamObserver {
35 // These values are persisted to logs. Entries should not be renumbered and
36 // numeric values should never be reused.
37 enum DisconnectReason {
38 // The Disconnect reason wasn't given explicitly. This probably means that
39 // the audio service crashed.
41 // This code is used as disconnect reason when stream ended or failed to
42 // start due to an unrecoverable platform error, e.g. the hardware device is
43 // busy or disconnected.
45 kTerminatedByClient = 2,
46 kStreamCreationFailed = 3,
47 kDocumentDestroyed = 4,
48 kSystemPermissions = 5,
52 // It will be called only once when input stream starts recording.