diff options
author | Andreas Huber <andih@google.com> | 2010-10-10 17:45:58 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-10 17:45:58 -0700 |
commit | e31aa743466972764f9db5a88a713621ff0a29ae (patch) | |
tree | 55e218856d9e5aede7ecb0eb790572be6441ac91 /media/libstagefright/rtsp | |
parent | 9086ce254ac8769dbe90afd5146fce509a86418f (diff) | |
parent | 3ec866c1ea1a9b254bb41383311887b53dc418d4 (diff) | |
download | frameworks_av-e31aa743466972764f9db5a88a713621ff0a29ae.zip frameworks_av-e31aa743466972764f9db5a88a713621ff0a29ae.tar.gz frameworks_av-e31aa743466972764f9db5a88a713621ff0a29ae.tar.bz2 |
am e0c8545a: am 0fd4e216: Merge "Refactor some more h.264 utility code out into avc_utils. Work around a hardware decoder issue by making sure the first access unit submitted to a decoder at startup or after seek is an IDR." into gingerbread
Merge commit 'e0c8545a2369881fe09582337a9de3db2db1a951'
* commit 'e0c8545a2369881fe09582337a9de3db2db1a951':
Refactor some more h.264 utility code out into avc_utils. Work around a hardware decoder issue by making sure the first access unit submitted to a decoder at startup or after seek is an IDR.
Diffstat (limited to 'media/libstagefright/rtsp')
-rw-r--r-- | media/libstagefright/rtsp/APacketSource.cpp | 20 | ||||
-rw-r--r-- | media/libstagefright/rtsp/APacketSource.h | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/media/libstagefright/rtsp/APacketSource.cpp b/media/libstagefright/rtsp/APacketSource.cpp index 78754e6..10cc88b 100644 --- a/media/libstagefright/rtsp/APacketSource.cpp +++ b/media/libstagefright/rtsp/APacketSource.cpp @@ -490,6 +490,8 @@ APacketSource::APacketSource( : mInitCheck(NO_INIT), mFormat(new MetaData), mEOSResult(OK), + mIsAVC(false), + mScanForIDR(true), mRTPTimeBase(0), mNormalPlayTimeBaseUs(0), mLastNormalPlayTimeUs(0) { @@ -509,6 +511,8 @@ APacketSource::APacketSource( mInitCheck = OK; if (!strncmp(desc.c_str(), "H264/", 5)) { + mIsAVC = true; + mFormat->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_AVC); int32_t width, height; @@ -719,6 +723,20 @@ void APacketSource::queueAccessUnit(const sp<ABuffer> &buffer) { return; } + if (mScanForIDR && mIsAVC) { + // This pretty piece of code ensures that the first access unit + // fed to the decoder after stream-start or seek is guaranteed to + // be an IDR frame. This is to workaround limitations of a certain + // hardware h.264 decoder that requires this to be the case. + + if (!IsIDR(buffer)) { + LOGV("skipping AU while scanning for next IDR frame."); + return; + } + + mScanForIDR = false; + } + Mutex::Autolock autoLock(mLock); mBuffers.push_back(buffer); mCondition.signal(); @@ -735,6 +753,8 @@ void APacketSource::signalEOS(status_t result) { void APacketSource::flushQueue() { Mutex::Autolock autoLock(mLock); mBuffers.clear(); + + mScanForIDR = true; } int64_t APacketSource::getNormalPlayTimeUs() { diff --git a/media/libstagefright/rtsp/APacketSource.h b/media/libstagefright/rtsp/APacketSource.h index 076ddc4..7a77fc6 100644 --- a/media/libstagefright/rtsp/APacketSource.h +++ b/media/libstagefright/rtsp/APacketSource.h @@ -65,6 +65,9 @@ private: List<sp<ABuffer> > mBuffers; status_t mEOSResult; + bool mIsAVC; + bool mScanForIDR; + uint32_t mClockRate; uint32_t mRTPTimeBase; |