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

Commit 9d7fc5c5 authored by Robert Shih's avatar Robert Shih
Browse files

HTTPLiveSource: check for NULL before getTrackCount/Info

The effect is MediaPlayer returns a 0-length array when getTrackInfo is
called before PREPARED state.

Bug: 12029173
Change-Id: Ib3a48525eac07b04a2ff88ce199d66dcc61c1641
parent c975c23b
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1019,12 +1019,20 @@ bool LiveSession::hasDynamicDuration() const {
}

size_t LiveSession::getTrackCount() const {
    if (mPlaylist == NULL) {
        return 0;
    } else {
        return mPlaylist->getTrackCount();
    }
}

sp<AMessage> LiveSession::getTrackInfo(size_t trackIndex) const {
    if (mPlaylist == NULL) {
        return NULL;
    } else {
        return mPlaylist->getTrackInfo(trackIndex);
    }
}

status_t LiveSession::selectTrack(size_t index, bool select) {
    status_t err = mPlaylist->selectTrack(index, select);