Skip to content

Commit d3c53f2

Browse files
fix: don't set zero size if size is unknown (#1141)
Sending zero instead of null confuses other sdks (at least rust), e.g. [here](https://github.com/livekit/rust-sdks/blob/e37adc1dc4cb90322733fcb0fe1155262f309ff1/livekit-data-stream/src/incoming.rs#L325) --------- Co-authored-by: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com>
1 parent 8b00bb4 commit d3c53f2

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

.changes/fix-data-stream-size

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
patch type="fixed" "Omit data stream totalLength when size is unknown"

lib/src/participant/local.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ extension DataStreamParticipantMethods on LocalParticipant {
10621062
mimeType: info.mimeType,
10631063
topic: info.topic,
10641064
timestamp: Int64(timestamp),
1065-
totalLength: Int64(options?.totalSize ?? 0),
1065+
totalLength: options?.totalSize != null ? Int64(options!.totalSize!) : null,
10661066
attributes: options?.attributes.entries,
10671067
textHeader: lk_models.DataStream_TextHeader(
10681068
version: options?.version,
@@ -1150,7 +1150,7 @@ extension DataStreamParticipantMethods on LocalParticipant {
11501150
);
11511151

11521152
final header = lk_models.DataStream_Header(
1153-
totalLength: Int64(info.size),
1153+
totalLength: options?.totalSize != null ? Int64(options!.totalSize!) : null,
11541154
mimeType: info.mimeType,
11551155
streamId: streamId,
11561156
topic: options?.topic,

0 commit comments

Comments
 (0)