diff options
author | Andreas Huber <andih@google.com> | 2012-01-20 13:43:39 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-01-20 13:43:39 -0800 |
commit | e8bb6fef58dfa94346d8a72c1eb9046d5d1f2da1 (patch) | |
tree | 3f9ae03755058fa7404e02ec978aff8f8e474d72 /media | |
parent | c79e413911d48ebf14621304655029f6cd2c7959 (diff) | |
parent | 475334f7bd190127fce5141960bf141f2e59e7df (diff) | |
download | frameworks_base-e8bb6fef58dfa94346d8a72c1eb9046d5d1f2da1.zip frameworks_base-e8bb6fef58dfa94346d8a72c1eb9046d5d1f2da1.tar.gz frameworks_base-e8bb6fef58dfa94346d8a72c1eb9046d5d1f2da1.tar.bz2 |
Merge "Starhub RTSP apparently does not establish time on all tracks"
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/rtsp/MyHandler.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h index 2391c5c..9a7dd70 100644 --- a/media/libstagefright/rtsp/MyHandler.h +++ b/media/libstagefright/rtsp/MyHandler.h @@ -122,6 +122,7 @@ struct MyHandler : public AHandler { mSetupTracksSuccessful(false), mSeekPending(false), mFirstAccessUnit(true), + mAllTracksHaveTime(false), mNTPAnchorUs(-1), mMediaAnchorUs(-1), mLastMediaTimeUs(0), @@ -723,6 +724,7 @@ struct MyHandler : public AHandler { mSetupTracksSuccessful = false; mSeekPending = false; mFirstAccessUnit = true; + mAllTracksHaveTime = false; mNTPAnchorUs = -1; mMediaAnchorUs = -1; mNumAccessUnitsReceived = 0; @@ -930,6 +932,7 @@ struct MyHandler : public AHandler { info->mNTPAnchorUs = -1; } + mAllTracksHaveTime = false; mNTPAnchorUs = -1; int64_t timeUs; @@ -1037,6 +1040,14 @@ struct MyHandler : public AHandler { ALOGW("Never received any data, disconnecting."); (new AMessage('abor', id()))->post(); } + } else { + if (!mAllTracksHaveTime) { + ALOGW("We received some RTCP packets, but time " + "could not be established on all tracks, now " + "using fake timestamps"); + + fakeTimestamps(); + } } break; } @@ -1211,6 +1222,7 @@ private: bool mSeekPending; bool mFirstAccessUnit; + bool mAllTracksHaveTime; int64_t mNTPAnchorUs; int64_t mMediaAnchorUs; int64_t mLastMediaTimeUs; @@ -1357,6 +1369,7 @@ private: } void fakeTimestamps() { + mNTPAnchorUs = -1ll; for (size_t i = 0; i < mTracks.size(); ++i) { onTimeUpdate(i, 0, 0ll); } @@ -1377,6 +1390,21 @@ private: mNTPAnchorUs = ntpTimeUs; mMediaAnchorUs = mLastMediaTimeUs; } + + if (!mAllTracksHaveTime) { + bool allTracksHaveTime = true; + for (size_t i = 0; i < mTracks.size(); ++i) { + TrackInfo *track = &mTracks.editItemAt(i); + if (track->mNTPAnchorUs < 0) { + allTracksHaveTime = false; + break; + } + } + if (allTracksHaveTime) { + mAllTracksHaveTime = true; + ALOGI("Time now established for all tracks."); + } + } } void onAccessUnitComplete( @@ -1403,7 +1431,7 @@ private: TrackInfo *track = &mTracks.editItemAt(trackIndex); - if (mNTPAnchorUs < 0 || mMediaAnchorUs < 0 || track->mNTPAnchorUs < 0) { + if (!mAllTracksHaveTime) { ALOGV("storing accessUnit, no time established yet"); track->mPackets.push_back(accessUnit); return; |