Loading media/libstagefright/webm/WebmFrame.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,14 @@ sp<WebmElement> WebmFrame::SimpleBlock(uint64_t baseTimecode) const { mData); } uint64_t WebmFrame::getAbsTimecode() { return mAbsTimecode; } void WebmFrame::updateAbsTimecode(uint64_t newAbsTimecode) { mAbsTimecode = newAbsTimecode; } bool WebmFrame::operator<(const WebmFrame &other) const { if (this->mEos) { return false; Loading media/libstagefright/webm/WebmFrame.h +3 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ struct WebmFrame : LightRefBase<WebmFrame> { public: const int mType; const bool mKey; const uint64_t mAbsTimecode; uint64_t mAbsTimecode; const sp<ABuffer> mData; const bool mEos; Loading @@ -33,6 +33,8 @@ public: WebmFrame(int type, bool key, uint64_t absTimecode, MediaBufferBase *buf); ~WebmFrame() {} uint64_t getAbsTimecode(); void updateAbsTimecode(uint64_t newAbsTimecode); sp<WebmElement> SimpleBlock(uint64_t baseTimecode) const; bool operator<(const WebmFrame &other) const; Loading media/libstagefright/webm/WebmFrameThread.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ WebmFrameSinkThread::WebmFrameSinkThread( mVideoFrames(videoThread->mSink), mAudioFrames(audioThread->mSink), mCues(cues), mStartOffsetTimecode(UINT64_MAX), mDone(true) { } Loading @@ -92,6 +93,7 @@ WebmFrameSinkThread::WebmFrameSinkThread( mVideoFrames(videoSource), mAudioFrames(audioSource), mCues(cues), mStartOffsetTimecode(UINT64_MAX), mDone(true) { } Loading Loading @@ -213,6 +215,11 @@ void WebmFrameSinkThread::run() { const sp<WebmFrame> audioFrame = mAudioFrames.peek(); ALOGV("a frame: %p", audioFrame.get()); if (mStartOffsetTimecode == UINT64_MAX) { mStartOffsetTimecode = std::min(audioFrame->getAbsTimecode(), videoFrame->getAbsTimecode()); } if (videoFrame->mEos && audioFrame->mEos) { break; } Loading @@ -220,10 +227,12 @@ void WebmFrameSinkThread::run() { if (*audioFrame < *videoFrame) { ALOGV("take a frame"); mAudioFrames.take(); audioFrame->updateAbsTimecode(audioFrame->getAbsTimecode() - mStartOffsetTimecode); outstandingFrames.push_back(audioFrame); } else { ALOGV("take v frame"); mVideoFrames.take(); videoFrame->updateAbsTimecode(videoFrame->getAbsTimecode() - mStartOffsetTimecode); outstandingFrames.push_back(videoFrame); if (videoFrame->mKey) numVideoKeyFrames++; Loading Loading @@ -350,7 +359,6 @@ void WebmFrameMediaSourceThread::run() { if (mStartTimeUs == kUninitialized) { mStartTimeUs = timestampUs; } timestampUs -= mStartTimeUs; if (mPaused && !mResumed) { lastDurationUs = timestampUs - lastTimestampUs; Loading media/libstagefright/webm/WebmFrameThread.h +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ private: LinkedBlockingQueue<const sp<WebmFrame> >& mVideoFrames; LinkedBlockingQueue<const sp<WebmFrame> >& mAudioFrames; List<sp<WebmElement> >& mCues; uint64_t mStartOffsetTimecode; volatile bool mDone; Loading Loading
media/libstagefright/webm/WebmFrame.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,14 @@ sp<WebmElement> WebmFrame::SimpleBlock(uint64_t baseTimecode) const { mData); } uint64_t WebmFrame::getAbsTimecode() { return mAbsTimecode; } void WebmFrame::updateAbsTimecode(uint64_t newAbsTimecode) { mAbsTimecode = newAbsTimecode; } bool WebmFrame::operator<(const WebmFrame &other) const { if (this->mEos) { return false; Loading
media/libstagefright/webm/WebmFrame.h +3 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ struct WebmFrame : LightRefBase<WebmFrame> { public: const int mType; const bool mKey; const uint64_t mAbsTimecode; uint64_t mAbsTimecode; const sp<ABuffer> mData; const bool mEos; Loading @@ -33,6 +33,8 @@ public: WebmFrame(int type, bool key, uint64_t absTimecode, MediaBufferBase *buf); ~WebmFrame() {} uint64_t getAbsTimecode(); void updateAbsTimecode(uint64_t newAbsTimecode); sp<WebmElement> SimpleBlock(uint64_t baseTimecode) const; bool operator<(const WebmFrame &other) const; Loading
media/libstagefright/webm/WebmFrameThread.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ WebmFrameSinkThread::WebmFrameSinkThread( mVideoFrames(videoThread->mSink), mAudioFrames(audioThread->mSink), mCues(cues), mStartOffsetTimecode(UINT64_MAX), mDone(true) { } Loading @@ -92,6 +93,7 @@ WebmFrameSinkThread::WebmFrameSinkThread( mVideoFrames(videoSource), mAudioFrames(audioSource), mCues(cues), mStartOffsetTimecode(UINT64_MAX), mDone(true) { } Loading Loading @@ -213,6 +215,11 @@ void WebmFrameSinkThread::run() { const sp<WebmFrame> audioFrame = mAudioFrames.peek(); ALOGV("a frame: %p", audioFrame.get()); if (mStartOffsetTimecode == UINT64_MAX) { mStartOffsetTimecode = std::min(audioFrame->getAbsTimecode(), videoFrame->getAbsTimecode()); } if (videoFrame->mEos && audioFrame->mEos) { break; } Loading @@ -220,10 +227,12 @@ void WebmFrameSinkThread::run() { if (*audioFrame < *videoFrame) { ALOGV("take a frame"); mAudioFrames.take(); audioFrame->updateAbsTimecode(audioFrame->getAbsTimecode() - mStartOffsetTimecode); outstandingFrames.push_back(audioFrame); } else { ALOGV("take v frame"); mVideoFrames.take(); videoFrame->updateAbsTimecode(videoFrame->getAbsTimecode() - mStartOffsetTimecode); outstandingFrames.push_back(videoFrame); if (videoFrame->mKey) numVideoKeyFrames++; Loading Loading @@ -350,7 +359,6 @@ void WebmFrameMediaSourceThread::run() { if (mStartTimeUs == kUninitialized) { mStartTimeUs = timestampUs; } timestampUs -= mStartTimeUs; if (mPaused && !mResumed) { lastDurationUs = timestampUs - lastTimestampUs; Loading
media/libstagefright/webm/WebmFrameThread.h +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ private: LinkedBlockingQueue<const sp<WebmFrame> >& mVideoFrames; LinkedBlockingQueue<const sp<WebmFrame> >& mAudioFrames; List<sp<WebmElement> >& mCues; uint64_t mStartOffsetTimecode; volatile bool mDone; Loading