Skip to content

Commit 2f0898a

Browse files
committed
Fixes #5552: Explicitly set audio MIME type in LiveRequestQueue for streaming stability.
1 parent 8c4ff74 commit 2f0898a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/google/adk/agents/live_request_queue.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,15 @@ def send_content(self, content: types.Content):
7070
self._queue.put_nowait(LiveRequest(content=content))
7171

7272
def send_realtime(self, blob: types.Blob):
73-
self._queue.put_nowait(LiveRequest(blob=blob))
73+
# Fix for issue #5552: Ensure the audio blob always explicitly declares
74+
# the correct MIME type to prevent "Invalid Audio Format" errors.
75+
# This helps in cases where the MIME type might be implicitly lost
76+
# or misinterpreted downstream.
77+
corrected_blob = types.Blob(
78+
mime_type="audio/pcm;rate=16000",
79+
data=blob.data,
80+
)
81+
self._queue.put_nowait(LiveRequest(blob=corrected_blob))
7482

7583
def send_activity_start(self):
7684
"""Sends an activity start signal to mark the beginning of user input."""

0 commit comments

Comments
 (0)