pion / example-webrtc-applications

Examples of WebRTC applications that are large, or use 3rd party libraries

Home Page:https://pion.ly/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Garbled/Corrupted audio when using a modified version of play-from-disk

e3ndr opened this issue · comments

commented

Your environment.

  • Version: v3.1.44
  • Browser: Chrome (105.0.5195.125)

What did you do? / What did you expect? / What happened?

I'm working on a screen sharing/voice chatting service and I've come across an issue when using a modified example of play-drom-disk. I'm trying to pipe in an OGG file and stream that to a receiver (here's the code) but the audio is garbled/corrupted.

garbled.mp4

For context, here's how the video is getting to the server:

  1. MediaRecorder records audio into a webm file (Opus, 510kbps, 48khz, 2 channel, 16bit).
  2. I grab a chunk every ~250ms and send that to my api via websocket (it's running on my local machine though).
  3. I then remux the data into a NUT container (for ease of data handling).

And here's how the media is getting to pion:

  1. I wait for the SDP to given to pion, since I need stdin for the OGG stream.
  2. I attach the output of the NUT feed to a OGG remuxer (here's the ffmpeg command I'm running).
  3. I dump the output of the OGG remuxer to a file.
  4. I pipe that output into the pion code via stdin.

Now the raw OGG does not exhibit the playback issues shown in the screen recording, leading me to believe that it's either a pion bug or, more likely, a bug in my code.

Thanks!