Skip to content

Commit

Permalink
Bug 1843113 - Vendor libwebrtc from 9d99682446
Browse files Browse the repository at this point in the history
Upstream commit: https://webrtc.googlesource.com/src/+/9d996824465410b4f25cf1d20bdee01d7091533a
    [M114] Fix bug of messages being delivered before data channel is open

    If the caller calls RegisterObserver() on the network thread while the
    state is not kOpen but there are queued received data, those received
    data will be immediately delivered to the observer before the state is
    transitioned to kOpen, which may break the observer's assertions and
    cause problems.

    The problem turns out to be that, when SctpDataChannel::RegisterObserver
    calls DeliverQueuedReceivedData(), the data will be passed to the
    observer without checking the |state_| first, meanwhile
    SctpDataChannel::UpdateState does effectively check the state and
    null-check |observer_| before delivering the received data. This CL
    fixes this by simply making DeliverQueuedReceivedData() also check
    `state_ == kOpen`. In case the state transitions to kOpen after
    RegisterObserver() is called, the first DeliverQueuedReceivedData()
    call will be no-op, while the second DeliverQueuedReceivedData() call
    will do the work.

    (cherry picked from commit 20838941240536b52e24e47ce99ad6c2175dba1a)

    No-Try: True
    Bug: chromium:1442696
    Change-Id: If25ce6a038d704939b1a8ae73d7ced110448b050
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/304687
    Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
    Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
    Cr-Original-Commit-Position: refs/heads/main@{#40036}
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/305380
    Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
    Cr-Commit-Position: refs/branch-heads/5735@{#1}
    Cr-Branched-From: df7df199abd619e75b9f1d9a7e12fc3f3f748775-refs/heads/main@{#39949}
  • Loading branch information
mfromanmoz committed Jul 14, 2023
1 parent b871844 commit c2f3c89
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions third_party/libwebrtc/README.moz-ff-commit
Original file line number Diff line number Diff line change
Expand Up @@ -23490,3 +23490,6 @@ b035dcc0a2
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
df7df199ab
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
9d99682446
2 changes: 2 additions & 0 deletions third_party/libwebrtc/README.mozilla
Original file line number Diff line number Diff line change
Expand Up @@ -15682,3 +15682,5 @@ libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-07-14T20:56:52.434746.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-07-14T20:58:08.778095.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-07-14T20:59:06.341337.
2 changes: 1 addition & 1 deletion third_party/libwebrtc/pc/sctp_data_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ void SctpDataChannel::SetState(DataState state) {

// RTC_RUN_ON(network_thread_).
void SctpDataChannel::DeliverQueuedReceivedData() {
if (!observer_) {
if (!observer_ || state_ != kOpen) {
return;
}

Expand Down

0 comments on commit c2f3c89

Please sign in to comment.