From f4d58e1468e4bb79ab5c9374cc4f800859643287 Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Tue, 15 Dec 2020 14:04:00 -0800 Subject: Fix Android senders by accepting 0 sequence number. This patch updates the libcast receiver to accept 0 as a valid sequence number. TBR=miu@chromium.org Bug: b/175720188 Change-Id: I17ff6f8390b76d22ed39d756ffc2143ac7a039e8 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2594152 Reviewed-by: Jordan Bayles Reviewed-by: Yuri Wiitala Commit-Queue: Jordan Bayles --- cast/protocol/castv2/streaming_examples/offer.json | 2 +- cast/streaming/receiver_session.cc | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'cast') diff --git a/cast/protocol/castv2/streaming_examples/offer.json b/cast/protocol/castv2/streaming_examples/offer.json index 7b0d1c6e..339b6d15 100644 --- a/cast/protocol/castv2/streaming_examples/offer.json +++ b/cast/protocol/castv2/streaming_examples/offer.json @@ -40,6 +40,6 @@ } ] }, - "seqNum": 820263768, + "seqNum": 0, "type": "OFFER" } \ No newline at end of file diff --git a/cast/streaming/receiver_session.cc b/cast/streaming/receiver_session.cc index edf685c2..7e4c70d3 100644 --- a/cast/streaming/receiver_session.cc +++ b/cast/streaming/receiver_session.cc @@ -98,8 +98,10 @@ ReceiverSession::~ReceiverSession() { } void ReceiverSession::OnOffer(SenderMessage message) { - // We just drop offers we can't respond to. - if (message.sequence_number <= 0) { + // We just drop offers we can't respond to. Note that libcast senders will + // always send a strictly positive sequence numbers, but zero is permitted + // by the spec. + if (message.sequence_number < 0) { OSP_DLOG_WARN << "Dropping offer with missing sequence number, can't respond"; return; -- cgit v1.2.3