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

Commit ffd5687c authored by Chong Zhang's avatar Chong Zhang
Browse files

Send kWhatConnected in onTimeUpdate() before first access unit

Bug: 10642588
Change-Id: If2b4fbbf250d5307e304f31c7aa4ac480e279484
parent 4b701cc0
Loading
Loading
Loading
Loading
+23 −17
Original line number Original line Diff line number Diff line
@@ -1681,6 +1681,26 @@ private:
        return true;
        return true;
    }
    }


    void handleFirstAccessUnit() {
        if (mFirstAccessUnit) {
            sp<AMessage> msg = mNotify->dup();
            msg->setInt32("what", kWhatConnected);
            msg->post();

            if (mSeekable) {
                for (size_t i = 0; i < mTracks.size(); ++i) {
                    TrackInfo *info = &mTracks.editItemAt(i);

                    postNormalPlayTimeMapping(
                            i,
                            info->mNormalPlayTimeRTP, info->mNormalPlayTimeUs);
                }
            }

            mFirstAccessUnit = false;
        }
    }

    void onTimeUpdate(int32_t trackIndex, uint32_t rtpTime, uint64_t ntpTime) {
    void onTimeUpdate(int32_t trackIndex, uint32_t rtpTime, uint64_t ntpTime) {
        ALOGV("onTimeUpdate track %d, rtpTime = 0x%08x, ntpTime = 0x%016llx",
        ALOGV("onTimeUpdate track %d, rtpTime = 0x%08x, ntpTime = 0x%016llx",
             trackIndex, rtpTime, ntpTime);
             trackIndex, rtpTime, ntpTime);
@@ -1712,6 +1732,8 @@ private:
            }
            }
        }
        }
        if (mAllTracksHaveTime && dataReceivedOnAllChannels()) {
        if (mAllTracksHaveTime && dataReceivedOnAllChannels()) {
            handleFirstAccessUnit();

            // Time is now established, lets start timestamping immediately
            // Time is now established, lets start timestamping immediately
            for (size_t i = 0; i < mTracks.size(); ++i) {
            for (size_t i = 0; i < mTracks.size(); ++i) {
                TrackInfo *trackInfo = &mTracks.editItemAt(i);
                TrackInfo *trackInfo = &mTracks.editItemAt(i);
@@ -1745,23 +1767,7 @@ private:
            return;
            return;
        }
        }


        if (mFirstAccessUnit) {
        handleFirstAccessUnit();
            sp<AMessage> msg = mNotify->dup();
            msg->setInt32("what", kWhatConnected);
            msg->post();

            if (mSeekable) {
                for (size_t i = 0; i < mTracks.size(); ++i) {
                    TrackInfo *info = &mTracks.editItemAt(i);

                    postNormalPlayTimeMapping(
                            i,
                            info->mNormalPlayTimeRTP, info->mNormalPlayTimeUs);
                }
            }

            mFirstAccessUnit = false;
        }


        TrackInfo *track = &mTracks.editItemAt(trackIndex);
        TrackInfo *track = &mTracks.editItemAt(trackIndex);