This commit is contained in:
yumoqing 2024-09-11 11:13:33 +08:00
parent 7199fcb0af
commit ebc27fc306

View File

@ -14,12 +14,11 @@ class MyAudioStreamTrack(AudioStreamTrack):
self.source = source
async def recv(self):
print('MyAudioTrack::recv(): called')
if self.source is None:
return None
f = await self.source.audio.recv()
while f is None:
print('MyAudioTrack::recv(): will reload source')
self.set_source(MyMediaPlayer(self.source._file_path))
f = await self.source.audio.recv()
return f
@ -33,11 +32,11 @@ class MyVideoStreamTrack(VideoStreamTrack):
self.source = source
async def recv(self):
print('MyVideoTrack::recv(): called')
if self.source is None:
return None
f = await self.source.video.recv()
while f is None:
print('MyVideoTrack::recv(): will reload source')
self.set_source(MyMediaPlayer(self.source._file_path))
f = await self.source.video.recv()
return f