Bug 1860685 - Vendor libwebrtc from 7349579c42

Upstream commit: https://webrtc.googlesource.com/src/+/7349579c4272d22b88c7dbb497b9bc2acfc5a26f
    [M118] FrameCadenceAdapter: stop delayed refresh frame calls on dtor.

    The FrameCadenceAdapter starts a delayed task to request a
    new refresh frame on receiving frame drop. However, the
    resulting RepeatingTaskHandle was not Stop()ed on destruction,
    leading to UAF.

    (cherry picked from commit fb98b01061e7eec51a800b53d4346827f89336a5)

    Fixed: chromium:1478944
    Change-Id: Iba441420953e989cfc7fcfd2f358b5b30f375786
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/320200
    Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
    Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
    Cr-Original-Commit-Position: refs/heads/main@{#40747}
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/320420
    Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
    Cr-Commit-Position: refs/branch-heads/5993@{#1}
    Cr-Branched-From: 5afcec093c1403fe9e3872706d04671cbc6d2983-refs/heads/main@{#40703}
This commit is contained in:
Byron Campen 2023-10-27 16:11:44 -05:00
parent 884e4def14
commit 553777d97c
4 changed files with 29 additions and 0 deletions

View File

@ -25818,3 +25818,6 @@ ff281aa328
# MOZ_LIBWEBRTC_SRC=/home/bcampen/checkouts/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
5afcec093c
# MOZ_LIBWEBRTC_SRC=/home/bcampen/checkouts/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
7349579c42

View File

@ -17236,3 +17236,5 @@ libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebr
libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T21:09:50.991340.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T21:10:43.186110.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T21:11:33.670827.

View File

@ -102,6 +102,7 @@ class ZeroHertzAdapterMode : public AdapterMode {
Clock* clock,
FrameCadenceAdapterInterface::Callback* callback,
double max_fps);
~ZeroHertzAdapterMode() { refresh_frame_requester_.Stop(); }
// Reconfigures according to parameters.
// All spatial layer trackers are initialized as unconverged by this method.

View File

@ -563,6 +563,29 @@ TEST(FrameCadenceAdapterTest, AcceptsUnconfiguredLayerFeedback) {
adapter->UpdateLayerStatus(2, false);
}
TEST(FrameCadenceAdapterTest, IgnoresDropInducedCallbacksPostDestruction) {
ZeroHertzFieldTrialEnabler enabler;
auto callback = std::make_unique<MockCallback>();
GlobalSimulatedTimeController time_controller(Timestamp::Zero());
auto queue = time_controller.GetTaskQueueFactory()->CreateTaskQueue(
"queue", TaskQueueFactory::Priority::NORMAL);
auto adapter = FrameCadenceAdapterInterface::Create(
time_controller.GetClock(), queue.get(), enabler);
queue->PostTask([&adapter, &callback] {
adapter->Initialize(callback.get());
adapter->SetZeroHertzModeEnabled(
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
});
time_controller.AdvanceTime(TimeDelta::Zero());
constexpr int kMaxFps = 10;
adapter->OnConstraintsChanged(VideoTrackSourceConstraints{0, kMaxFps});
adapter->OnDiscardedFrame();
time_controller.AdvanceTime(TimeDelta::Zero());
callback = nullptr;
queue->PostTask([adapter = std::move(adapter)]() mutable {});
time_controller.AdvanceTime(3 * TimeDelta::Seconds(1) / kMaxFps);
}
class FrameCadenceAdapterSimulcastLayersParamTest
: public ::testing::TestWithParam<int> {
public: