Loading media/libstagefright/httplive/LiveSession.cpp +19 −7 Original line number Diff line number Diff line Loading @@ -66,7 +66,8 @@ LiveSession::LiveSession( mRealTimeBaseUs(0ll), mReconfigurationInProgress(false), mSwitchInProgress(false), mDisconnectReplyID(0) { mDisconnectReplyID(0), mSeekReplyID(0) { mStreams[kAudioIndex] = StreamItem("audio"); mStreams[kVideoIndex] = StreamItem("video"); Loading Loading @@ -230,6 +231,10 @@ status_t LiveSession::seekTo(int64_t timeUs) { sp<AMessage> response; status_t err = msg->postAndAwaitResponse(&response); uint32_t replyID; CHECK(response == mSeekReply && 0 != mSeekReplyID); mSeekReply.clear(); mSeekReplyID = 0; return err; } Loading @@ -255,15 +260,12 @@ void LiveSession::onMessageReceived(const sp<AMessage> &msg) { case kWhatSeek: { uint32_t replyID; CHECK(msg->senderAwaitsResponse(&replyID)); CHECK(msg->senderAwaitsResponse(&mSeekReplyID)); status_t err = onSeek(msg); sp<AMessage> response = new AMessage; response->setInt32("err", err); response->postReply(replyID); mSeekReply = new AMessage; mSeekReply->setInt32("err", err); break; } Loading Loading @@ -293,6 +295,11 @@ void LiveSession::onMessageReceived(const sp<AMessage> &msg) { CHECK_GT(mContinuationCounter, 0); if (--mContinuationCounter == 0) { mContinuation->post(); if (mSeekReplyID != 0) { CHECK(mSeekReply != NULL); mSeekReply->postReply(mSeekReplyID); } } } break; Loading Loading @@ -1028,6 +1035,11 @@ void LiveSession::changeConfiguration( if (mContinuationCounter == 0) { msg->post(); if (mSeekReplyID != 0) { CHECK(mSeekReply != NULL); mSeekReply->postReply(mSeekReplyID); } } } Loading media/libstagefright/httplive/LiveSession.h +2 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ private: size_t mContinuationCounter; sp<AMessage> mContinuation; sp<AMessage> mSeekReply; int64_t mLastDequeuedTimeUs; int64_t mRealTimeBaseUs; Loading @@ -183,6 +184,7 @@ private: bool mReconfigurationInProgress; bool mSwitchInProgress; uint32_t mDisconnectReplyID; uint32_t mSeekReplyID; sp<PlaylistFetcher> addFetcher(const char *uri); Loading media/libstagefright/httplive/PlaylistFetcher.cpp +19 −6 Original line number Diff line number Diff line Loading @@ -364,8 +364,10 @@ void PlaylistFetcher::pauseAsync() { (new AMessage(kWhatPause, id()))->post(); } void PlaylistFetcher::stopAsync() { (new AMessage(kWhatStop, id()))->post(); void PlaylistFetcher::stopAsync(bool selfTriggered) { sp<AMessage> msg = new AMessage(kWhatStop, id()); msg->setInt32("selfTriggered", selfTriggered); msg->post(); } void PlaylistFetcher::resumeUntilAsync(const sp<AMessage> ¶ms) { Loading Loading @@ -399,7 +401,7 @@ void PlaylistFetcher::onMessageReceived(const sp<AMessage> &msg) { case kWhatStop: { onStop(); onStop(msg); sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", kWhatStopped); Loading Loading @@ -498,9 +500,20 @@ void PlaylistFetcher::onPause() { cancelMonitorQueue(); } void PlaylistFetcher::onStop() { void PlaylistFetcher::onStop(const sp<AMessage> &msg) { cancelMonitorQueue(); int32_t selfTriggered; CHECK(msg->findInt32("selfTriggered", &selfTriggered)); if (!selfTriggered) { // Self triggered stops only happen during switching, in which case we do not want // to clear the discontinuities queued at the end of packet sources. for (size_t i = 0; i < mPacketSources.size(); i++) { sp<AnotherPacketSource> packetSource = mPacketSources.valueAt(i); packetSource->clear(); } } mPacketSources.clear(); mStreamTypeMask = 0; } Loading Loading @@ -552,7 +565,7 @@ status_t PlaylistFetcher::onResumeUntil(const sp<AMessage> &msg) { for (size_t i = 0; i < mPacketSources.size(); i++) { mPacketSources.valueAt(i)->queueAccessUnit(mSession->createFormatChangeBuffer()); } stopAsync(); stopAsync(/* selfTriggered = */ true); return OK; } Loading Loading @@ -867,7 +880,7 @@ void PlaylistFetcher::onDownloadNext() { if (err == ERROR_OUT_OF_RANGE) { // reached stopping point stopAsync(); stopAsync(/* selfTriggered = */ true); return; } Loading media/libstagefright/httplive/PlaylistFetcher.h +2 −2 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ struct PlaylistFetcher : public AHandler { void pauseAsync(); void stopAsync(); void stopAsync(bool selfTriggered = false); void resumeUntilAsync(const sp<AMessage> ¶ms); Loading Loading @@ -162,7 +162,7 @@ private: status_t onStart(const sp<AMessage> &msg); void onPause(); void onStop(); void onStop(const sp<AMessage> &msg); void onMonitorQueue(); void onDownloadNext(); Loading Loading
media/libstagefright/httplive/LiveSession.cpp +19 −7 Original line number Diff line number Diff line Loading @@ -66,7 +66,8 @@ LiveSession::LiveSession( mRealTimeBaseUs(0ll), mReconfigurationInProgress(false), mSwitchInProgress(false), mDisconnectReplyID(0) { mDisconnectReplyID(0), mSeekReplyID(0) { mStreams[kAudioIndex] = StreamItem("audio"); mStreams[kVideoIndex] = StreamItem("video"); Loading Loading @@ -230,6 +231,10 @@ status_t LiveSession::seekTo(int64_t timeUs) { sp<AMessage> response; status_t err = msg->postAndAwaitResponse(&response); uint32_t replyID; CHECK(response == mSeekReply && 0 != mSeekReplyID); mSeekReply.clear(); mSeekReplyID = 0; return err; } Loading @@ -255,15 +260,12 @@ void LiveSession::onMessageReceived(const sp<AMessage> &msg) { case kWhatSeek: { uint32_t replyID; CHECK(msg->senderAwaitsResponse(&replyID)); CHECK(msg->senderAwaitsResponse(&mSeekReplyID)); status_t err = onSeek(msg); sp<AMessage> response = new AMessage; response->setInt32("err", err); response->postReply(replyID); mSeekReply = new AMessage; mSeekReply->setInt32("err", err); break; } Loading Loading @@ -293,6 +295,11 @@ void LiveSession::onMessageReceived(const sp<AMessage> &msg) { CHECK_GT(mContinuationCounter, 0); if (--mContinuationCounter == 0) { mContinuation->post(); if (mSeekReplyID != 0) { CHECK(mSeekReply != NULL); mSeekReply->postReply(mSeekReplyID); } } } break; Loading Loading @@ -1028,6 +1035,11 @@ void LiveSession::changeConfiguration( if (mContinuationCounter == 0) { msg->post(); if (mSeekReplyID != 0) { CHECK(mSeekReply != NULL); mSeekReply->postReply(mSeekReplyID); } } } Loading
media/libstagefright/httplive/LiveSession.h +2 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ private: size_t mContinuationCounter; sp<AMessage> mContinuation; sp<AMessage> mSeekReply; int64_t mLastDequeuedTimeUs; int64_t mRealTimeBaseUs; Loading @@ -183,6 +184,7 @@ private: bool mReconfigurationInProgress; bool mSwitchInProgress; uint32_t mDisconnectReplyID; uint32_t mSeekReplyID; sp<PlaylistFetcher> addFetcher(const char *uri); Loading
media/libstagefright/httplive/PlaylistFetcher.cpp +19 −6 Original line number Diff line number Diff line Loading @@ -364,8 +364,10 @@ void PlaylistFetcher::pauseAsync() { (new AMessage(kWhatPause, id()))->post(); } void PlaylistFetcher::stopAsync() { (new AMessage(kWhatStop, id()))->post(); void PlaylistFetcher::stopAsync(bool selfTriggered) { sp<AMessage> msg = new AMessage(kWhatStop, id()); msg->setInt32("selfTriggered", selfTriggered); msg->post(); } void PlaylistFetcher::resumeUntilAsync(const sp<AMessage> ¶ms) { Loading Loading @@ -399,7 +401,7 @@ void PlaylistFetcher::onMessageReceived(const sp<AMessage> &msg) { case kWhatStop: { onStop(); onStop(msg); sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", kWhatStopped); Loading Loading @@ -498,9 +500,20 @@ void PlaylistFetcher::onPause() { cancelMonitorQueue(); } void PlaylistFetcher::onStop() { void PlaylistFetcher::onStop(const sp<AMessage> &msg) { cancelMonitorQueue(); int32_t selfTriggered; CHECK(msg->findInt32("selfTriggered", &selfTriggered)); if (!selfTriggered) { // Self triggered stops only happen during switching, in which case we do not want // to clear the discontinuities queued at the end of packet sources. for (size_t i = 0; i < mPacketSources.size(); i++) { sp<AnotherPacketSource> packetSource = mPacketSources.valueAt(i); packetSource->clear(); } } mPacketSources.clear(); mStreamTypeMask = 0; } Loading Loading @@ -552,7 +565,7 @@ status_t PlaylistFetcher::onResumeUntil(const sp<AMessage> &msg) { for (size_t i = 0; i < mPacketSources.size(); i++) { mPacketSources.valueAt(i)->queueAccessUnit(mSession->createFormatChangeBuffer()); } stopAsync(); stopAsync(/* selfTriggered = */ true); return OK; } Loading Loading @@ -867,7 +880,7 @@ void PlaylistFetcher::onDownloadNext() { if (err == ERROR_OUT_OF_RANGE) { // reached stopping point stopAsync(); stopAsync(/* selfTriggered = */ true); return; } Loading
media/libstagefright/httplive/PlaylistFetcher.h +2 −2 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ struct PlaylistFetcher : public AHandler { void pauseAsync(); void stopAsync(); void stopAsync(bool selfTriggered = false); void resumeUntilAsync(const sp<AMessage> ¶ms); Loading Loading @@ -162,7 +162,7 @@ private: status_t onStart(const sp<AMessage> &msg); void onPause(); void onStop(); void onStop(const sp<AMessage> &msg); void onMonitorQueue(); void onDownloadNext(); Loading