Skip to content

Commit 5d9ffb3

Browse files
authored
Update attributes set in trailer (#366)
1 parent c95d3ce commit 5d9ffb3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

livekit-rtc/livekit/rtc/data_stream.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ async def _on_chunk_update(self, chunk: proto_DataStream.Chunk):
7070
await self._queue.put(chunk)
7171

7272
async def _on_stream_close(self, trailer: proto_DataStream.Trailer):
73+
self.info.attributes = self.info.attributes or {}
74+
self.info.attributes.update(trailer.attributes)
7375
await self._queue.put(None)
7476

7577
def __aiter__(self) -> AsyncIterator[str]:
@@ -118,6 +120,8 @@ async def _on_chunk_update(self, chunk: proto_DataStream.Chunk):
118120
await self._queue.put(chunk)
119121

120122
async def _on_stream_close(self, trailer: proto_DataStream.Trailer):
123+
self.info.attributes = self.info.attributes or {}
124+
self.info.attributes.update(trailer.attributes)
121125
await self._queue.put(None)
122126

123127
def __aiter__(self) -> AsyncIterator[bytes]:

0 commit comments

Comments
 (0)