mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 18:09:23 +08:00
feat: Add optional startup function to ReplyOnPause (#170)
* feat: Add optional startup function to ReplyOnPause * feat: Implement startup_fn in ReplyOnStopWords * refactor: Remove redundant startup_fn implementation in ReplyOnStopWords * tweaks * revert --------- Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
This commit is contained in:
@@ -156,6 +156,11 @@ async def player_worker_decode(
|
||||
break
|
||||
continue
|
||||
|
||||
if not isinstance(frame, tuple) and not isinstance(frame[1], np.ndarray):
|
||||
raise WebRTCError(
|
||||
"The frame must be a tuple containing a sample rate and a numpy array."
|
||||
)
|
||||
|
||||
if len(frame) == 2:
|
||||
sample_rate, audio_array = frame
|
||||
layout = "mono"
|
||||
@@ -199,7 +204,10 @@ async def player_worker_decode(
|
||||
exec = traceback.format_exc()
|
||||
print("traceback %s", exec)
|
||||
print("Error processing frame: %s", str(e))
|
||||
continue
|
||||
if isinstance(e, WebRTCError):
|
||||
raise e
|
||||
else:
|
||||
continue
|
||||
|
||||
|
||||
def audio_to_bytes(audio: tuple[int, NDArray[np.int16 | np.float32]]) -> bytes:
|
||||
|
||||
Reference in New Issue
Block a user