Fix LC3 file reading to return individual frames instead of concatenated stream

Modifies read_lc3_file to collect LC3 frames in a list before joining, and updates multicast streamer to write each LC3 frame to all BIS queues in the BIG. Previously the entire LC3 file was concatenated into a single byte string without frame boundaries.
This commit is contained in:
2026-04-09 14:05:46 +02:00
parent f82de89ce3
commit 5f7fd1c0ff
2 changed files with 6 additions and 3 deletions
+3
View File
@@ -836,6 +836,9 @@ class Streamer():
if lc3_frame == b'': # Not all streams may stop at the same time
stream_finished[i] = True
continue
for q_idx in range(big.get('num_bis', 1)):
await big['iso_queues'][q_idx].write(lc3_frame)
else: # code lc3 on the fly with perf counters
# Ensure frames generator exists (so we can aclose() on stop)
frames_gen = big.get('frames_gen')
+3 -3
View File
@@ -21,12 +21,12 @@ def read_lc3_file(filepath):
logging.info('frame_duration %s', frame_duration)
logging.info('stream_length %s', stream_length)
lc3_bytes= b''
chunks = []
while True:
b = f_lc3.read(2)
if b == b'':
break
lc3_frame_size = struct.unpack('=H', b)[0]
lc3_bytes += f_lc3.read(lc3_frame_size)
chunks.append(f_lc3.read(lc3_frame_size))
return lc3_bytes
return b''.join(chunks)