mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-28 08:16:09 +03:00
37 lines
1.6 KiB
Plaintext
37 lines
1.6 KiB
Plaintext
|
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a BSD-style license that can be
|
||
|
// found in the LICENSE file.
|
||
|
|
||
|
module media.mojom;
|
||
|
|
||
|
import "mojo/public/mojom/base/shared_memory.mojom";
|
||
|
|
||
|
// Used by audio streams for realtime-ish data transfer. ReadWriteAudioDataPipe
|
||
|
// is used for output streams and ReadOnlyAudioDataPipe is used for input
|
||
|
// streams, see AudioDeviceThread, AudioSyncReader, and AudioInputSyncWriter.
|
||
|
// |socket| is a base::SyncSocket used for signaling and |shared_memory| is used
|
||
|
// for the actual audio data.
|
||
|
//
|
||
|
// When using a pull model, the code pulling the data writes |n| (an unsigned
|
||
|
// 32 bit sequence number) to the socket, and the source from which data is
|
||
|
// pulled writes a buffer to |shared_memory| and writes |n| back to signal that
|
||
|
// it finished writing. Then the process continues with |n+1|. This model is
|
||
|
// used to get data for playout.
|
||
|
//
|
||
|
// When using a push model, the code pushing data writes a buffer to
|
||
|
// |shared_memory| and writes |n| to the socket. When the other side finished
|
||
|
// reading the buffer, it writes |n| to the socket to signal that the memory is
|
||
|
// safe to write to again. |shared_memory| may have room for several buffers,
|
||
|
// in which case the next buffer can be pushed without waiting for the previous
|
||
|
// one to be consumed. This model used is to deliver microphone data to a
|
||
|
// consumer.
|
||
|
struct ReadWriteAudioDataPipe {
|
||
|
mojo_base.mojom.UnsafeSharedMemoryRegion shared_memory;
|
||
|
handle socket;
|
||
|
};
|
||
|
|
||
|
struct ReadOnlyAudioDataPipe {
|
||
|
mojo_base.mojom.ReadOnlySharedMemoryRegion shared_memory;
|
||
|
handle socket;
|
||
|
};
|