slightly better drop handling on the serverside
This commit is contained in:
parent
35b4dd9b1f
commit
3ec6b9b25c
1 changed files with 6 additions and 2 deletions
|
@ -5,6 +5,7 @@ import uuid
|
||||||
import av # type: ignore
|
import av # type: ignore
|
||||||
import struct
|
import struct
|
||||||
from aiortc import MediaStreamTrack, RTCPeerConnection, RTCSessionDescription # type: ignore
|
from aiortc import MediaStreamTrack, RTCPeerConnection, RTCSessionDescription # type: ignore
|
||||||
|
from aiortc.mediastreams import MediaStreamError # type: ignore
|
||||||
from aiortc.contrib.media import MediaBlackhole, MediaPlayer # type: ignore
|
from aiortc.contrib.media import MediaBlackhole, MediaPlayer # type: ignore
|
||||||
import jack as Jack # type: ignore
|
import jack as Jack # type: ignore
|
||||||
import os
|
import os
|
||||||
|
@ -226,12 +227,15 @@ class Session(object):
|
||||||
@track.on("ended") # type: ignore
|
@track.on("ended") # type: ignore
|
||||||
async def on_ended() -> None:
|
async def on_ended() -> None:
|
||||||
print(self.connection_id, "Track {} ended".format(track.kind))
|
print(self.connection_id, "Track {} ended".format(track.kind))
|
||||||
# TODO: this doesn't exactly handle reconnecting gracefully
|
|
||||||
await self.end()
|
await self.end()
|
||||||
|
|
||||||
write_ob_status(True)
|
write_ob_status(True)
|
||||||
while True:
|
while True:
|
||||||
frame = await track.recv()
|
try:
|
||||||
|
frame = await track.recv()
|
||||||
|
except MediaStreamError as e:
|
||||||
|
print(self.connection_id, e)
|
||||||
|
await self.end()
|
||||||
if self.running:
|
if self.running:
|
||||||
# Right, depending on the format, we may need to do some fuckery.
|
# Right, depending on the format, we may need to do some fuckery.
|
||||||
# Jack expects all audio to be 32 bit floating point
|
# Jack expects all audio to be 32 bit floating point
|
||||||
|
|
Loading…
Reference in a new issue