[M120 Migration][MM] Framerate calculation
[platform/framework/web/chromium-efl.git] / media / mojo / mojom / audio_data_pipe.mojom
1 // Copyright 2018 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.
4
5 module media.mojom;
6
7 import "mojo/public/mojom/base/shared_memory.mojom";
8
9 // Used by audio streams for realtime-ish data transfer. ReadWriteAudioDataPipe
10 // is used for output streams and ReadOnlyAudioDataPipe is used for input
11 // streams, see AudioDeviceThread, AudioSyncReader, and AudioInputSyncWriter.
12 // |socket| is a base::SyncSocket used for signaling and |shared_memory| is used
13 // for the actual audio data.
14 //
15 // When using a pull model, the code pulling the data writes |n| (an unsigned
16 // 32 bit sequence number) to the socket, and the source from which data is
17 // pulled writes a buffer to |shared_memory| and writes |n| back to signal that
18 // it finished writing. Then the process continues with |n+1|. This model is
19 // used to get data for playout.
20 //
21 // When using a push model, the code pushing data writes a buffer to
22 // |shared_memory| and writes |n| to the socket. When the other side finished
23 // reading the buffer, it writes |n| to the socket to signal that the memory is
24 // safe to write to again. |shared_memory| may have room for several buffers,
25 // in which case the next buffer can be pushed without waiting for the previous
26 // one to be consumed. This model used is to deliver microphone data to a
27 // consumer.
28 struct ReadWriteAudioDataPipe {
29   mojo_base.mojom.UnsafeSharedMemoryRegion shared_memory;
30   handle<platform> socket;
31 };
32
33 struct ReadOnlyAudioDataPipe {
34   mojo_base.mojom.ReadOnlySharedMemoryRegion shared_memory;
35   handle<platform> socket;
36 };