Loading media/libstagefright/httplive/PlaylistFetcher.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -963,8 +963,8 @@ void PlaylistFetcher::onDownloadNext() { } while (bytesRead != 0); if (bufferStartsWithTsSyncByte(buffer)) { // If we still don't see a stream after fetching a full ts segment mark it as // nonexistent. // If we don't see a stream in the program table after fetching a full ts segment // mark it as nonexistent. const size_t kNumTypes = ATSParser::NUM_SOURCE_TYPES; ATSParser::SourceType srcTypes[kNumTypes] = { ATSParser::VIDEO, ATSParser::AUDIO }; Loading @@ -979,7 +979,7 @@ void PlaylistFetcher::onDownloadNext() { static_cast<AnotherPacketSource *>( mTSParser->getSource(srcType).get()); if (source == NULL) { if (!mTSParser->hasSource(srcType)) { ALOGW("MPEG2 Transport stream does not contain %s data.", srcType == ATSParser::VIDEO ? "video" : "audio"); Loading media/libstagefright/mpeg2ts/ATSParser.cpp +28 −3 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ struct ATSParser::Program : public RefBase { void signalEOS(status_t finalResult); sp<MediaSource> getSource(SourceType type); bool hasSource(SourceType type) const; int64_t convertPTSToTimestamp(uint64_t PTS); Loading Loading @@ -119,6 +120,9 @@ struct ATSParser::Stream : public RefBase { sp<MediaSource> getSource(SourceType type); bool isAudio() const; bool isVideo() const; protected: virtual ~Stream(); Loading Loading @@ -146,9 +150,6 @@ private: void extractAACFrames(const sp<ABuffer> &buffer); bool isAudio() const; bool isVideo() const; DISALLOW_EVIL_CONSTRUCTORS(Stream); }; Loading Loading @@ -440,6 +441,19 @@ sp<MediaSource> ATSParser::Program::getSource(SourceType type) { return NULL; } bool ATSParser::Program::hasSource(SourceType type) const { for (size_t i = 0; i < mStreams.size(); ++i) { const sp<Stream> &stream = mStreams.valueAt(i); if (type == AUDIO && stream->isAudio()) { return true; } else if (type == VIDEO && stream->isVideo()) { return true; } } return false; } int64_t ATSParser::Program::convertPTSToTimestamp(uint64_t PTS) { if (!(mParser->mFlags & TS_TIMESTAMPS_ARE_ABSOLUTE)) { if (!mFirstPTSValid) { Loading Loading @@ -1278,6 +1292,17 @@ sp<MediaSource> ATSParser::getSource(SourceType type) { return NULL; } bool ATSParser::hasSource(SourceType type) const { for (size_t i = 0; i < mPrograms.size(); ++i) { const sp<Program> &program = mPrograms.itemAt(i); if (program->hasSource(type)) { return true; } } return false; } bool ATSParser::PTSTimeDeltaEstablished() { if (mPrograms.isEmpty()) { return false; Loading media/libstagefright/mpeg2ts/ATSParser.h +1 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ struct ATSParser : public RefBase { NUM_SOURCE_TYPES = 2 }; sp<MediaSource> getSource(SourceType type); bool hasSource(SourceType type) const; bool PTSTimeDeltaEstablished(); Loading Loading
media/libstagefright/httplive/PlaylistFetcher.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -963,8 +963,8 @@ void PlaylistFetcher::onDownloadNext() { } while (bytesRead != 0); if (bufferStartsWithTsSyncByte(buffer)) { // If we still don't see a stream after fetching a full ts segment mark it as // nonexistent. // If we don't see a stream in the program table after fetching a full ts segment // mark it as nonexistent. const size_t kNumTypes = ATSParser::NUM_SOURCE_TYPES; ATSParser::SourceType srcTypes[kNumTypes] = { ATSParser::VIDEO, ATSParser::AUDIO }; Loading @@ -979,7 +979,7 @@ void PlaylistFetcher::onDownloadNext() { static_cast<AnotherPacketSource *>( mTSParser->getSource(srcType).get()); if (source == NULL) { if (!mTSParser->hasSource(srcType)) { ALOGW("MPEG2 Transport stream does not contain %s data.", srcType == ATSParser::VIDEO ? "video" : "audio"); Loading
media/libstagefright/mpeg2ts/ATSParser.cpp +28 −3 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ struct ATSParser::Program : public RefBase { void signalEOS(status_t finalResult); sp<MediaSource> getSource(SourceType type); bool hasSource(SourceType type) const; int64_t convertPTSToTimestamp(uint64_t PTS); Loading Loading @@ -119,6 +120,9 @@ struct ATSParser::Stream : public RefBase { sp<MediaSource> getSource(SourceType type); bool isAudio() const; bool isVideo() const; protected: virtual ~Stream(); Loading Loading @@ -146,9 +150,6 @@ private: void extractAACFrames(const sp<ABuffer> &buffer); bool isAudio() const; bool isVideo() const; DISALLOW_EVIL_CONSTRUCTORS(Stream); }; Loading Loading @@ -440,6 +441,19 @@ sp<MediaSource> ATSParser::Program::getSource(SourceType type) { return NULL; } bool ATSParser::Program::hasSource(SourceType type) const { for (size_t i = 0; i < mStreams.size(); ++i) { const sp<Stream> &stream = mStreams.valueAt(i); if (type == AUDIO && stream->isAudio()) { return true; } else if (type == VIDEO && stream->isVideo()) { return true; } } return false; } int64_t ATSParser::Program::convertPTSToTimestamp(uint64_t PTS) { if (!(mParser->mFlags & TS_TIMESTAMPS_ARE_ABSOLUTE)) { if (!mFirstPTSValid) { Loading Loading @@ -1278,6 +1292,17 @@ sp<MediaSource> ATSParser::getSource(SourceType type) { return NULL; } bool ATSParser::hasSource(SourceType type) const { for (size_t i = 0; i < mPrograms.size(); ++i) { const sp<Program> &program = mPrograms.itemAt(i); if (program->hasSource(type)) { return true; } } return false; } bool ATSParser::PTSTimeDeltaEstablished() { if (mPrograms.isEmpty()) { return false; Loading
media/libstagefright/mpeg2ts/ATSParser.h +1 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ struct ATSParser : public RefBase { NUM_SOURCE_TYPES = 2 }; sp<MediaSource> getSource(SourceType type); bool hasSource(SourceType type) const; bool PTSTimeDeltaEstablished(); Loading