Loading media/libstagefright/httplive/LiveSession.cpp +35 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ LiveSession::LiveSession( mDiscontinuities.add(indexToType(i), new AnotherPacketSource(NULL /* meta */)); mPacketSources.add(indexToType(i), new AnotherPacketSource(NULL /* meta */)); mPacketSources2.add(indexToType(i), new AnotherPacketSource(NULL /* meta */)); mBuffering[i] = false; } } Loading Loading @@ -133,8 +134,26 @@ status_t LiveSession::dequeueAccessUnit( sp<AnotherPacketSource> packetSource = mPacketSources.valueFor(stream); ssize_t idx = typeToIndex(stream); if (!packetSource->hasBufferAvailable(&finalResult)) { return finalResult == OK ? -EAGAIN : finalResult; if (finalResult == OK) { mBuffering[idx] = true; return -EAGAIN; } else { return finalResult; } } if (mBuffering[idx]) { if (mSwitchInProgress || packetSource->isFinished(0) || packetSource->getEstimatedDurationUs() > 10000000ll) { mBuffering[idx] = false; } } if (mBuffering[idx]) { return -EAGAIN; } // wait for counterpart Loading Loading @@ -567,6 +586,21 @@ LiveSession::StreamType LiveSession::indexToType(int idx) { return (StreamType)(1 << idx); } // static ssize_t LiveSession::typeToIndex(int32_t type) { switch (type) { case STREAMTYPE_AUDIO: return 0; case STREAMTYPE_VIDEO: return 1; case STREAMTYPE_SUBTITLES: return 2; default: return -1; }; return -1; } void LiveSession::onConnect(const sp<AMessage> &msg) { AString url; CHECK(msg->findString("url", &url)); Loading media/libstagefright/httplive/LiveSession.h +2 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ private: sp<IMediaHTTPService> mHTTPService; bool mInPreparationPhase; bool mBuffering[kMaxStreams]; sp<HTTPBase> mHTTPDataSource; KeyedVector<String8, String8> mExtraHeaders; Loading Loading @@ -242,6 +243,7 @@ private: static int SortByBandwidth(const BandwidthItem *, const BandwidthItem *); static StreamType indexToType(int idx); static ssize_t typeToIndex(int32_t type); void changeConfiguration( int64_t timeUs, size_t bandwidthIndex, bool pickTrack = false); Loading Loading
media/libstagefright/httplive/LiveSession.cpp +35 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ LiveSession::LiveSession( mDiscontinuities.add(indexToType(i), new AnotherPacketSource(NULL /* meta */)); mPacketSources.add(indexToType(i), new AnotherPacketSource(NULL /* meta */)); mPacketSources2.add(indexToType(i), new AnotherPacketSource(NULL /* meta */)); mBuffering[i] = false; } } Loading Loading @@ -133,8 +134,26 @@ status_t LiveSession::dequeueAccessUnit( sp<AnotherPacketSource> packetSource = mPacketSources.valueFor(stream); ssize_t idx = typeToIndex(stream); if (!packetSource->hasBufferAvailable(&finalResult)) { return finalResult == OK ? -EAGAIN : finalResult; if (finalResult == OK) { mBuffering[idx] = true; return -EAGAIN; } else { return finalResult; } } if (mBuffering[idx]) { if (mSwitchInProgress || packetSource->isFinished(0) || packetSource->getEstimatedDurationUs() > 10000000ll) { mBuffering[idx] = false; } } if (mBuffering[idx]) { return -EAGAIN; } // wait for counterpart Loading Loading @@ -567,6 +586,21 @@ LiveSession::StreamType LiveSession::indexToType(int idx) { return (StreamType)(1 << idx); } // static ssize_t LiveSession::typeToIndex(int32_t type) { switch (type) { case STREAMTYPE_AUDIO: return 0; case STREAMTYPE_VIDEO: return 1; case STREAMTYPE_SUBTITLES: return 2; default: return -1; }; return -1; } void LiveSession::onConnect(const sp<AMessage> &msg) { AString url; CHECK(msg->findString("url", &url)); Loading
media/libstagefright/httplive/LiveSession.h +2 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ private: sp<IMediaHTTPService> mHTTPService; bool mInPreparationPhase; bool mBuffering[kMaxStreams]; sp<HTTPBase> mHTTPDataSource; KeyedVector<String8, String8> mExtraHeaders; Loading Loading @@ -242,6 +243,7 @@ private: static int SortByBandwidth(const BandwidthItem *, const BandwidthItem *); static StreamType indexToType(int idx); static ssize_t typeToIndex(int32_t type); void changeConfiguration( int64_t timeUs, size_t bandwidthIndex, bool pickTrack = false); Loading