Skip to content

Commit ab6c85b

Browse files
committed
moq-transport: Add GroupOrder to SubscribeOk
Just parsing/encoding for now. Still punting on making this change the actual delivery order. Addresses #12
1 parent 652191b commit ab6c85b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

moq-transport/src/message/subscribe_ok.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::coding::{Decode, DecodeError, Encode, EncodeError};
2+
use crate::message::GroupOrder;
23

34
/// Sent by the publisher to accept a Subscribe.
45
#[derive(Clone, Debug)]
@@ -9,6 +10,9 @@ pub struct SubscribeOk {
910
/// The subscription will expire in this many milliseconds.
1011
pub expires: Option<u64>,
1112

13+
// Order groups will be delivered in
14+
pub group_order: GroupOrder,
15+
1216
/// The latest group and object for the track.
1317
pub latest: Option<(u64, u64)>,
1418
}
@@ -21,6 +25,8 @@ impl Decode for SubscribeOk {
2125
expires => Some(expires),
2226
};
2327

28+
let group_order = GroupOrder::decode(r)?;
29+
2430
Self::decode_remaining(r, 1)?;
2531

2632
let latest = match r.get_u8() {
@@ -29,7 +35,12 @@ impl Decode for SubscribeOk {
2935
_ => return Err(DecodeError::InvalidValue),
3036
};
3137

32-
Ok(Self { id, expires, latest })
38+
Ok(Self {
39+
id,
40+
expires,
41+
group_order,
42+
latest,
43+
})
3344
}
3445
}
3546

@@ -38,6 +49,8 @@ impl Encode for SubscribeOk {
3849
self.id.encode(w)?;
3950
self.expires.unwrap_or(0).encode(w)?;
4051

52+
self.group_order.encode(w)?;
53+
4154
Self::encode_remaining(w, 1)?;
4255

4356
match self.latest {

moq-transport/src/session/subscribed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ impl Subscribed {
8484
self.publisher.send_message(message::SubscribeOk {
8585
id: self.msg.id,
8686
expires: None,
87+
group_order: message::GroupOrder::Descending, // TODO: resolve correct value from publisher / subscriber prefs
8788
latest,
8889
});
8990

0 commit comments

Comments
 (0)