Re: [webrtc-pc] Creation of MediaStreamTrack from raw PCM stream; Example 18 with a JSON file instead of messaging (#2570)

> Signaling is out of scope but there are other resources and tutorial in the web that could help you.

And yet there is a signaling example at the specification, yet the example is incomplete.

This is the precise case:

- Arbitrary web page passes message to Chromium extension
- Chromium extension connects to Native Messaging host to begin server which serves STDOUT of audio output device - not microphone, even though Chromium labels micrphone as `"audiooutput"`
- Extension has permission to `fetch()` localhost, where the raw PCM is the response that streams system audio output until the request is aborted

In order to avoid using JavaScript `TypedArray`, `ArrayBuffer`, `SharedArrayBuffer` it would be preferable to create a `MediaStreamTrack` at the OS and some how get that to JavaScript, though that is not possible.

Instead we should be able to create a `RTCPeerConnection()` with raw PCM (or Opus, AV1, etc.).

WebAudio has no standardized means to accept dynamic live streams of binary data, besides `AudioWorklet`, and `fetch()` is not defined in `AudioWorkletGlobalScope`, so we have to use `SharedArrayBuffer` or `TypedArray` and, or Transferable Streams to dynamically stream binary input data that is indeterminate, has no definitive end.

In this case the closest we can get is using `RTCPeerConnection` at extension, though we still have the deficit of trying to store the input stream binary data and keep the processing ahead of the 384 calls to `AudioWorkletProcessor.process()` per second. A challenge at 32-bit systems.

Thus, the three related issues where, with a common interest, it is certainly possible to write out a specification to convert raw audio binary data to a `MediaStreamTrack` that can be passed by reference, zero-copy transfered to different context or, kindly complete the signaling example to show how to exchange the SDP in the case above.

-- 
GitHub Notification of comment by guest271314
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2570#issuecomment-686812500 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 3 September 2020 23:21:01 UTC