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

Commit 4ae6a2ab authored by mtk08122's avatar mtk08122 Committed by Dongwon Kang
Browse files

Fix abnormal consumption of mobile data

Problem: When user is watching http live streaming video, user does some
operation to let browser run in the background, but mobile data is still
consumed abnormally.

Root cause: When browser runs in the background, browser will call
mediaplayer pause function, which would pause video renderer. But if network
speed is fast and buffered data is more than PlaylistFecher::
kMinBufferedDurationUs, data can't be consumed and it will call
postMonitorQueue() frequently after delayUS time's up. At this time, if http
server returns error when refreshPlaylist, delayUs will be 0 because
mLastPlaylistFetchTimeUs is not updated, which will cause postMonitorQueue
and refreshPlaylist more frequently, and consumes more mobile data.

Solution: On PlaylistFetcher::onMonitorQueue(), if refreshPlaylist returns
error, it calls notifyError and then end this playback.

Bug: 123665682
Test: play http live streaming video, pause this playback, then close Wi-Fi
to simulate accessing http server error

Change-Id: Ic30d446d1ab6e34ac3e5ef414c2e71a09c296f92
parent c70268aa
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ PlaylistFetcher::PlaylistFetcher(
      mPlaylistTimeUs(-1LL),
      mSeqNumber(-1),
      mNumRetries(0),
      mNumRetriesForMonitorQueue(0),
      mStartup(true),
      mIDRFound(false),
      mSeekMode(LiveSession::kSeekModeExactPosition),
@@ -849,7 +850,17 @@ void PlaylistFetcher::onMonitorQueue() {
    // in the middle of an unfinished download, delay
    // playlist refresh as it'll change seq numbers
    if (!mDownloadState->hasSavedState()) {
        refreshPlaylist();
        status_t err = refreshPlaylist();
        if (err != OK) {
            if (mNumRetriesForMonitorQueue < kMaxNumRetries) {
                ++mNumRetriesForMonitorQueue;
            } else {
                notifyError(err);
            }
            return;
        } else {
            mNumRetriesForMonitorQueue = 0;
        }
    }

    int64_t targetDurationUs = kMinBufferedDurationUs;
+1 −0
Original line number Diff line number Diff line
@@ -145,6 +145,7 @@ private:
    sp<M3UParser> mPlaylist;
    int32_t mSeqNumber;
    int32_t mNumRetries;
    int32_t mNumRetriesForMonitorQueue;
    bool mStartup;
    bool mIDRFound;
    int32_t mSeekMode;