Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 678bcdc8 authored by Apurupa Pattapu's avatar Apurupa Pattapu Committed by Robert Shih
Browse files

httplive: Defer switch down if a switch is in progress

Bandwidth switch down is triggered if the buffered duration in
any of the current packet sources is below a threshold. When a
switch is in progress, all the packet sources are drained until
they are empty or until stop time is dequeued. Hence buffered
duration keeps going down during switch. Defering check switch
down will avoid unnecessary switches.

Do not switch down if estimated bandwidth index is more than
the current one.

Bug: 18821145
Change-Id: I655a308462503cf9df10672ecd904a51b2cba691
parent 1bf8a210
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1628,6 +1628,12 @@ void LiveSession::onCheckSwitchDown() {
        return;
    }

    if (mSwitchInProgress || mReconfigurationInProgress) {
        ALOGV("Switch/Reconfig in progress, defer switch down");
        mSwitchDownMonitor->post(1000000ll);
        return;
    }

    for (size_t i = 0; i < kMaxStreams; ++i) {
        int32_t targetDuration;
        sp<AnotherPacketSource> packetSource = mPacketSources.valueFor(indexToType(i));
@@ -1658,7 +1664,6 @@ void LiveSession::onSwitchDown() {
        return;
    }

    changeConfiguration(-1, mCurBandwidthIndex - 1, false);
}

// Mark switch done when: