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

Commit eee7f9dd authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Make timed text source type explicit in TimedTextDriver"

parents fd9e14bc 692ac36c
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -68,6 +68,11 @@ private:
        PAUSED,
    };

    enum TextSourceType {
        TEXT_SOURCE_TYPE_IN_BAND = 0,
        TEXT_SOURCE_TYPE_OUT_OF_BAND,
    };

    sp<ALooper> mLooper;
    sp<TimedTextPlayer> mPlayer;
    wp<MediaPlayerBase> mListener;
@@ -76,7 +81,7 @@ private:
    State mState;
    size_t mCurrentTrackIndex;
    KeyedVector<size_t, sp<TimedTextSource> > mTextSourceVector;
    Vector<bool> mTextSourceTypeVector;
    Vector<TextSourceType> mTextSourceTypeVector;

    // -- End of variables to be guarded by mLock

+4 −4
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ status_t TimedTextDriver::addInBandTextSource(
    }
    Mutex::Autolock autoLock(mLock);
    mTextSourceVector.add(trackIndex, source);
    mTextSourceTypeVector.add(true);
    mTextSourceTypeVector.add(TEXT_SOURCE_TYPE_IN_BAND);
    return OK;
}

@@ -206,14 +206,14 @@ status_t TimedTextDriver::createOutOfBandTextSource(

    Mutex::Autolock autoLock(mLock);
    mTextSourceVector.add(trackIndex, source);
    mTextSourceTypeVector.add(false);
    mTextSourceTypeVector.add(TEXT_SOURCE_TYPE_OUT_OF_BAND);
    return OK;
}

size_t TimedTextDriver::countExternalTracks() const {
    size_t nTracks = 0;
    for (size_t i = 0, n = mTextSourceTypeVector.size(); i < n; ++i) {
        if (!mTextSourceTypeVector[i]) {
        if (mTextSourceTypeVector[i] == TEXT_SOURCE_TYPE_OUT_OF_BAND) {
            ++nTracks;
        }
    }
@@ -223,7 +223,7 @@ size_t TimedTextDriver::countExternalTracks() const {
void TimedTextDriver::getExternalTrackInfo(Parcel *parcel) {
    Mutex::Autolock autoLock(mLock);
    for (size_t i = 0, n = mTextSourceTypeVector.size(); i < n; ++i) {
        if (mTextSourceTypeVector[i]) {
        if (mTextSourceTypeVector[i] == TEXT_SOURCE_TYPE_IN_BAND) {
            continue;
        }