diff options
Diffstat (limited to 'media/libstagefright')
48 files changed, 295 insertions, 207 deletions
diff --git a/media/libstagefright/AACExtractor.cpp b/media/libstagefright/AACExtractor.cpp index 33f22f2..4d1072f 100644 --- a/media/libstagefright/AACExtractor.cpp +++ b/media/libstagefright/AACExtractor.cpp @@ -23,9 +23,9 @@ #include <media/stagefright/foundation/ABuffer.h> #include <media/stagefright/foundation/AMessage.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaSource.h> diff --git a/media/libstagefright/AMRExtractor.cpp b/media/libstagefright/AMRExtractor.cpp index 5a28347..03dcbf9 100644 --- a/media/libstagefright/AMRExtractor.cpp +++ b/media/libstagefright/AMRExtractor.cpp @@ -20,9 +20,9 @@ #include "include/AMRExtractor.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaSource.h> diff --git a/media/libstagefright/AMRWriter.cpp b/media/libstagefright/AMRWriter.cpp index 59b4ca7..ca85640 100644 --- a/media/libstagefright/AMRWriter.cpp +++ b/media/libstagefright/AMRWriter.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/AMRWriter.h> #include <media/stagefright/MediaBuffer.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaSource.h> diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp index 9a9c3ef..df27566 100644 --- a/media/libstagefright/AudioPlayer.cpp +++ b/media/libstagefright/AudioPlayer.cpp @@ -268,6 +268,16 @@ bool AudioPlayer::reachedEOS(status_t *finalStatus) { return mReachedEOS; } +status_t AudioPlayer::setPlaybackRatePermille(int32_t ratePermille) { + if (mAudioSink.get() != NULL) { + return mAudioSink->setPlaybackRatePermille(ratePermille); + } else if (mAudioTrack != NULL){ + return mAudioTrack->setSampleRate(ratePermille * mSampleRate / 1000); + } else { + return NO_INIT; + } +} + // static size_t AudioPlayer::AudioSinkCallback( MediaPlayerBase::AudioSink *audioSink, diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 8073af8..70945e3 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -1360,7 +1360,7 @@ void AwesomePlayer::setAudioSource(sp<MediaSource> source) { mAudioTrack = source; } -void AwesomePlayer::addTextSource(sp<MediaSource> source) { +void AwesomePlayer::addTextSource(const sp<MediaSource>& source) { Mutex::Autolock autoLock(mTimedTextLock); CHECK(source != NULL); @@ -1609,7 +1609,7 @@ void AwesomePlayer::onVideoEvent() { mSeekTimeUs, mSeeking == SEEK_VIDEO_ONLY ? MediaSource::ReadOptions::SEEK_NEXT_SYNC - : MediaSource::ReadOptions::SEEK_CLOSEST_SYNC); + : MediaSource::ReadOptions::SEEK_CLOSEST); } for (;;) { status_t err = mVideoSource->read(&mVideoBuffer, &options); @@ -2251,6 +2251,14 @@ status_t AwesomePlayer::setParameter(int key, const Parcel &request) { { return setCacheStatCollectFreq(request); } + case KEY_PARAMETER_PLAYBACK_RATE_PERMILLE: + { + if (mAudioPlayer != NULL) { + return mAudioPlayer->setPlaybackRatePermille(request.readInt32()); + } else { + return NO_INIT; + } + } default: { return ERROR_UNSUPPORTED; diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index 228659c..ed1d5f4 100755 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -20,8 +20,8 @@ #include <OMX_Component.h> #include <binder/IPCThreadState.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/CameraSource.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MetaData.h> @@ -114,7 +114,7 @@ static int32_t getColorFormat(const char* colorFormat) { ALOGE("Uknown color format (%s), please add it to " "CameraSource::getColorFormat", colorFormat); - CHECK_EQ(0, "Unknown color format"); + CHECK(!"Unknown color format"); } CameraSource *CameraSource::Create() { @@ -517,7 +517,7 @@ status_t CameraSource::initWithCameraAccess( // This CHECK is good, since we just passed the lock/unlock // check earlier by calling mCamera->setParameters(). - CHECK_EQ(OK, mCamera->setPreviewDisplay(mSurface)); + CHECK_EQ((status_t)OK, mCamera->setPreviewDisplay(mSurface)); // By default, do not store metadata in video buffers mIsMetaDataStoredInVideoBuffers = false; @@ -566,7 +566,8 @@ void CameraSource::startCameraRecording() { if (mCameraFlags & FLAGS_HOT_CAMERA) { mCamera->unlock(); mCamera.clear(); - CHECK_EQ(OK, mCameraRecordingProxy->startRecording(new ProxyListener(this))); + CHECK_EQ((status_t)OK, + mCameraRecordingProxy->startRecording(new ProxyListener(this))); } else { mCamera->setListener(new CameraSourceListener(this)); mCamera->startRecording(); @@ -718,7 +719,7 @@ void CameraSource::signalBufferReturned(MediaBuffer *buffer) { return; } } - CHECK_EQ(0, "signalBufferReturned: bogus buffer"); + CHECK(!"signalBufferReturned: bogus buffer"); } status_t CameraSource::read( diff --git a/media/libstagefright/CameraSourceTimeLapse.cpp b/media/libstagefright/CameraSourceTimeLapse.cpp index 83d67b9..26ce7ae 100644 --- a/media/libstagefright/CameraSourceTimeLapse.cpp +++ b/media/libstagefright/CameraSourceTimeLapse.cpp @@ -20,9 +20,9 @@ #include <binder/IPCThreadState.h> #include <binder/MemoryBase.h> #include <binder/MemoryHeapBase.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/CameraSource.h> #include <media/stagefright/CameraSourceTimeLapse.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MetaData.h> #include <camera/Camera.h> #include <camera/CameraParameters.h> diff --git a/media/libstagefright/DRMExtractor.cpp b/media/libstagefright/DRMExtractor.cpp index afc4a80..524c3aa 100644 --- a/media/libstagefright/DRMExtractor.cpp +++ b/media/libstagefright/DRMExtractor.cpp @@ -23,6 +23,7 @@ #include <arpa/inet.h> #include <utils/String8.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/Utils.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/MediaSource.h> @@ -30,7 +31,6 @@ #include <media/stagefright/MetaData.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaBuffer.h> -#include <media/stagefright/MediaDebug.h> #include <drm/drm_framework_common.h> #include <utils/Errors.h> diff --git a/media/libstagefright/FileSource.cpp b/media/libstagefright/FileSource.cpp index 01f53e4..73c8d03 100644 --- a/media/libstagefright/FileSource.cpp +++ b/media/libstagefright/FileSource.cpp @@ -14,8 +14,8 @@ * limitations under the License. */ +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/FileSource.h> -#include <media/stagefright/MediaDebug.h> #include <sys/types.h> #include <unistd.h> #include <sys/types.h> diff --git a/media/libstagefright/JPEGSource.cpp b/media/libstagefright/JPEGSource.cpp index e818115..bafa4b2 100644 --- a/media/libstagefright/JPEGSource.cpp +++ b/media/libstagefright/JPEGSource.cpp @@ -18,10 +18,10 @@ #define LOG_TAG "JPEGSource" #include <utils/Log.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/JPEGSource.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MetaData.h> @@ -59,7 +59,7 @@ JPEGSource::JPEGSource(const sp<DataSource> &source) mWidth(0), mHeight(0), mOffset(0) { - CHECK_EQ(parseJPEG(), OK); + CHECK_EQ(parseJPEG(), (status_t)OK); CHECK(mSource->getSize(&mSize) == OK); } diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp index 068660b..7ebbe1d 100755 --- a/media/libstagefright/MPEG4Writer.cpp +++ b/media/libstagefright/MPEG4Writer.cpp @@ -23,10 +23,10 @@ #include <pthread.h> #include <sys/prctl.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MPEG4Writer.h> #include <media/stagefright/MediaBuffer.h> #include <media/stagefright/MetaData.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaSource.h> @@ -70,6 +70,10 @@ public: status_t dump(int fd, const Vector<String16>& args) const; private: + enum { + kMaxCttsOffsetTimeUs = 1000000LL, // 1 second + }; + MPEG4Writer *mOwner; sp<MetaData> mMeta; sp<MediaSource> mSource; @@ -137,11 +141,12 @@ private: : sampleCount(count), sampleDuration(timescaledDur) {} uint32_t sampleCount; - int32_t sampleDuration; // time scale based + uint32_t sampleDuration; // time scale based }; - bool mHasNegativeCttsDeltaDuration; size_t mNumCttsTableEntries; List<CttsTableEntry> mCttsTableEntries; + int64_t mMinCttsOffsetTimeUs; + int64_t mMaxCttsOffsetTimeUs; // Sequence parameter set or picture parameter set struct AVCParamSet { @@ -172,6 +177,8 @@ private: // Update the audio track's drift information. void updateDriftTime(const sp<MetaData>& meta); + int32_t getStartTimeOffsetScaledTime() const; + static void *ThreadWrapper(void *me); status_t threadEntry(); @@ -471,7 +478,7 @@ status_t MPEG4Writer::start(MetaData *param) { !param->findInt32(kKeyTimeScale, &mTimeScale)) { mTimeScale = 1000; } - CHECK(mTimeScale > 0); + CHECK_GT(mTimeScale, 0); ALOGV("movie time scale: %d", mTimeScale); mStreamableFile = true; @@ -490,7 +497,7 @@ status_t MPEG4Writer::start(MetaData *param) { } mEstimatedMoovBoxSize = estimateMoovBoxSize(bitRate); } - CHECK(mEstimatedMoovBoxSize >= 8); + CHECK_GE(mEstimatedMoovBoxSize, 8); lseek64(mFd, mFreeBoxOffset, SEEK_SET); writeInt32(mEstimatedMoovBoxSize); write("free", 4); @@ -684,7 +691,7 @@ status_t MPEG4Writer::reset() { mWriteMoovBoxToMemory = false; if (mStreamableFile) { - CHECK(mMoovBoxBufferOffset + 8 <= mEstimatedMoovBoxSize); + CHECK_LE(mMoovBoxBufferOffset + 8, mEstimatedMoovBoxSize); // Moov box lseek64(mFd, mFreeBoxOffset, SEEK_SET); @@ -856,7 +863,7 @@ off64_t MPEG4Writer::addLengthPrefixedSample_l(MediaBuffer *buffer) { mOffset += length + 4; } else { - CHECK(length < 65536); + CHECK_LT(length, 65536); uint8_t x = length >> 8; ::write(mFd, &x, 1); @@ -1085,7 +1092,7 @@ bool MPEG4Writer::reachedEOS() { void MPEG4Writer::setStartTimestampUs(int64_t timeUs) { ALOGI("setStartTimestampUs: %lld", timeUs); - CHECK(timeUs >= 0); + CHECK_GE(timeUs, 0ll); Mutex::Autolock autoLock(mLock); if (mStartTimestampUs < 0 || mStartTimestampUs > timeUs) { mStartTimestampUs = timeUs; @@ -1186,9 +1193,6 @@ void MPEG4Writer::Track::addOneCttsTableEntry( if (mIsAudio) { return; } - if (duration < 0 && !mHasNegativeCttsDeltaDuration) { - mHasNegativeCttsDeltaDuration = true; - } CttsTableEntry cttsEntry(sampleCount, duration); mCttsTableEntries.push_back(cttsEntry); ++mNumCttsTableEntries; @@ -1218,7 +1222,7 @@ void MPEG4Writer::Track::setTimeScale() { mTimeScale = timeScale; } - CHECK(mTimeScale > 0); + CHECK_GT(mTimeScale, 0); } void MPEG4Writer::Track::getCodecSpecificDataFromInputFormatIfPossible() { @@ -1299,7 +1303,7 @@ void MPEG4Writer::bufferChunk(const Chunk& chunk) { } } - CHECK("Received a chunk for a unknown track" == 0); + CHECK(!"Received a chunk for a unknown track"); } void MPEG4Writer::writeChunkToFile(Chunk* chunk) { @@ -1509,7 +1513,6 @@ status_t MPEG4Writer::Track::start(MetaData *params) { mMdatSizeBytes = 0; mMaxChunkDurationUs = 0; - mHasNegativeCttsDeltaDuration = false; pthread_create(&mThread, &attr, ThreadWrapper, this); pthread_attr_destroy(&attr); @@ -1833,29 +1836,18 @@ status_t MPEG4Writer::Track::threadEntry() { int32_t nChunks = 0; int32_t nZeroLengthFrames = 0; int64_t lastTimestampUs = 0; // Previous sample time stamp - int64_t lastCttsTimeUs = 0; // Previous sample time stamp int64_t lastDurationUs = 0; // Between the previous two samples int64_t currDurationTicks = 0; // Timescale based ticks int64_t lastDurationTicks = 0; // Timescale based ticks int32_t sampleCount = 1; // Sample count in the current stts table entry - int64_t currCttsDurTicks = 0; // Timescale based ticks - int64_t lastCttsDurTicks = 0; // Timescale based ticks - int32_t cttsSampleCount = 1; // Sample count in the current ctts table entry - uint32_t previousSampleSize = 0; // Size of the previous sample + uint32_t previousSampleSize = 0; // Size of the previous sample int64_t previousPausedDurationUs = 0; int64_t timestampUs = 0; - int64_t cttsDeltaTimeUs = 0; - bool hasBFrames = false; + int64_t cttsOffsetTimeUs = 0; + int64_t currCttsOffsetTimeTicks = 0; // Timescale based ticks + int64_t lastCttsOffsetTimeTicks = -1; // Timescale based ticks + int32_t cttsSampleCount = 0; // Sample count in the current ctts table entry -#if 1 - // XXX: Samsung's video encoder's output buffer timestamp - // is not correct. see bug 4724339 - char value[PROPERTY_VALUE_MAX]; - if (property_get("rw.media.record.hasb", value, NULL) && - (!strcasecmp(value, "true") || !strcasecmp(value, "1"))) { - hasBFrames = true; - } -#endif if (mIsAudio) { prctl(PR_SET_NAME, (unsigned long)"AudioTrackEncoding", 0, 0, 0); } else { @@ -1897,7 +1889,7 @@ status_t MPEG4Writer::Track::threadEntry() { (const uint8_t *)buffer->data() + buffer->range_offset(), buffer->range_length()); - CHECK_EQ(OK, err); + CHECK_EQ((status_t)OK, err); } else if (mIsMPEG4) { mCodecSpecificDataSize = buffer->range_length(); mCodecSpecificData = malloc(mCodecSpecificDataSize); @@ -1963,32 +1955,64 @@ status_t MPEG4Writer::Track::threadEntry() { if (mResumed) { int64_t durExcludingEarlierPausesUs = timestampUs - previousPausedDurationUs; - CHECK(durExcludingEarlierPausesUs >= 0); + CHECK_GE(durExcludingEarlierPausesUs, 0ll); int64_t pausedDurationUs = durExcludingEarlierPausesUs - mTrackDurationUs; - CHECK(pausedDurationUs >= lastDurationUs); + CHECK_GE(pausedDurationUs, lastDurationUs); previousPausedDurationUs += pausedDurationUs - lastDurationUs; mResumed = false; } timestampUs -= previousPausedDurationUs; - CHECK(timestampUs >= 0); - if (!mIsAudio && hasBFrames) { + CHECK_GE(timestampUs, 0ll); + if (!mIsAudio) { /* * Composition time: timestampUs * Decoding time: decodingTimeUs - * Composition time delta = composition time - decoding time - * - * We save picture decoding time stamp delta in stts table entries, - * and composition time delta duration in ctts table entries. + * Composition time offset = composition time - decoding time */ int64_t decodingTimeUs; CHECK(meta_data->findInt64(kKeyDecodingTime, &decodingTimeUs)); decodingTimeUs -= previousPausedDurationUs; - int64_t timeUs = decodingTimeUs; - cttsDeltaTimeUs = timestampUs - decodingTimeUs; + cttsOffsetTimeUs = + timestampUs + kMaxCttsOffsetTimeUs - decodingTimeUs; + CHECK_GE(cttsOffsetTimeUs, 0ll); timestampUs = decodingTimeUs; - ALOGV("decoding time: %lld and ctts delta time: %lld", - timestampUs, cttsDeltaTimeUs); + ALOGV("decoding time: %lld and ctts offset time: %lld", + timestampUs, cttsOffsetTimeUs); + + // Update ctts box table if necessary + currCttsOffsetTimeTicks = + (cttsOffsetTimeUs * mTimeScale + 500000LL) / 1000000LL; + CHECK_LE(currCttsOffsetTimeTicks, 0x0FFFFFFFFLL); + if (mNumSamples == 0) { + // Force the first ctts table entry to have one single entry + // so that we can do adjustment for the initial track start + // time offset easily in writeCttsBox(). + lastCttsOffsetTimeTicks = currCttsOffsetTimeTicks; + addOneCttsTableEntry(1, currCttsOffsetTimeTicks); + cttsSampleCount = 0; // No sample in ctts box is pending + } else { + if (currCttsOffsetTimeTicks != lastCttsOffsetTimeTicks) { + addOneCttsTableEntry(cttsSampleCount, lastCttsOffsetTimeTicks); + lastCttsOffsetTimeTicks = currCttsOffsetTimeTicks; + cttsSampleCount = 1; // One sample in ctts box is pending + } else { + ++cttsSampleCount; + } + } + + // Update ctts time offset range + if (mNumSamples == 0) { + mMinCttsOffsetTimeUs = currCttsOffsetTimeTicks; + mMaxCttsOffsetTimeUs = currCttsOffsetTimeTicks; + } else { + if (currCttsOffsetTimeTicks > mMaxCttsOffsetTimeUs) { + mMaxCttsOffsetTimeUs = currCttsOffsetTimeTicks; + } else if (currCttsOffsetTimeTicks < mMinCttsOffsetTimeUs) { + mMinCttsOffsetTimeUs = currCttsOffsetTimeTicks; + } + } + } if (mIsRealTimeRecording) { @@ -1997,7 +2021,7 @@ status_t MPEG4Writer::Track::threadEntry() { } } - CHECK(timestampUs >= 0); + CHECK_GE(timestampUs, 0ll); ALOGV("%s media time stamp: %lld and previous paused duration %lld", mIsAudio? "Audio": "Video", timestampUs, previousPausedDurationUs); if (timestampUs > mTrackDurationUs) { @@ -2012,6 +2036,7 @@ status_t MPEG4Writer::Track::threadEntry() { currDurationTicks = ((timestampUs * mTimeScale + 500000LL) / 1000000LL - (lastTimestampUs * mTimeScale + 500000LL) / 1000000LL); + CHECK_GE(currDurationTicks, 0ll); mSampleSizes.push_back(sampleSize); ++mNumSamples; @@ -2020,25 +2045,12 @@ status_t MPEG4Writer::Track::threadEntry() { // Force the first sample to have its own stts entry so that // we can adjust its value later to maintain the A/V sync. if (mNumSamples == 3 || currDurationTicks != lastDurationTicks) { - ALOGV("%s lastDurationUs: %lld us, currDurationTicks: %lld us", - mIsAudio? "Audio": "Video", lastDurationUs, currDurationTicks); addOneSttsTableEntry(sampleCount, lastDurationTicks); sampleCount = 1; } else { ++sampleCount; } - if (!mIsAudio) { - currCttsDurTicks = - ((cttsDeltaTimeUs * mTimeScale + 500000LL) / 1000000LL - - (lastCttsTimeUs * mTimeScale + 500000LL) / 1000000LL); - if (currCttsDurTicks != lastCttsDurTicks) { - addOneCttsTableEntry(cttsSampleCount, lastCttsDurTicks); - cttsSampleCount = 1; - } else { - ++cttsSampleCount; - } - } } if (mSamplesHaveSameSize) { if (mNumSamples >= 2 && previousSampleSize != sampleSize) { @@ -2052,11 +2064,6 @@ status_t MPEG4Writer::Track::threadEntry() { lastDurationTicks = currDurationTicks; lastTimestampUs = timestampUs; - if (!mIsAudio) { - lastCttsDurTicks = currCttsDurTicks; - lastCttsTimeUs = cttsDeltaTimeUs; - } - if (isSync != 0) { addOneStssTableEntry(mNumSamples); } @@ -2125,10 +2132,8 @@ status_t MPEG4Writer::Track::threadEntry() { if (mNumSamples == 1) { lastDurationUs = 0; // A single sample's duration lastDurationTicks = 0; - lastCttsDurTicks = 0; } else { ++sampleCount; // Count for the last sample - ++cttsSampleCount; } if (mNumSamples <= 2) { @@ -2140,7 +2145,14 @@ status_t MPEG4Writer::Track::threadEntry() { addOneSttsTableEntry(sampleCount, lastDurationTicks); } - addOneCttsTableEntry(cttsSampleCount, lastCttsDurTicks); + // The last ctts box may not have been written yet, and this + // is to make sure that we write out the last ctts box. + if (currCttsOffsetTimeTicks == lastCttsOffsetTimeTicks) { + if (cttsSampleCount > 0) { + addOneCttsTableEntry(cttsSampleCount, lastCttsOffsetTimeTicks); + } + } + mTrackDurationUs += lastDurationUs; mReachedEOS = true; @@ -2406,7 +2418,7 @@ void MPEG4Writer::Track::writeVideoFourCCBox() { mOwner->writeInt16(0x18); // depth mOwner->writeInt16(-1); // predefined - CHECK(23 + mCodecSpecificDataSize < 128); + CHECK_LT(23 + mCodecSpecificDataSize, 128); if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_MPEG4, mime)) { writeMp4vEsdsBox(); @@ -2465,10 +2477,10 @@ void MPEG4Writer::Track::writeAudioFourCCBox() { void MPEG4Writer::Track::writeMp4aEsdsBox() { mOwner->beginBox("esds"); CHECK(mCodecSpecificData); - CHECK(mCodecSpecificDataSize > 0); + CHECK_GT(mCodecSpecificDataSize, 0); // Make sure all sizes encode to a single byte. - CHECK(mCodecSpecificDataSize + 23 < 128); + CHECK_LT(mCodecSpecificDataSize + 23, 128); mOwner->writeInt32(0); // version=0, flags=0 mOwner->writeInt8(0x03); // ES_DescrTag @@ -2502,7 +2514,7 @@ void MPEG4Writer::Track::writeMp4aEsdsBox() { void MPEG4Writer::Track::writeMp4vEsdsBox() { CHECK(mCodecSpecificData); - CHECK(mCodecSpecificDataSize > 0); + CHECK_GT(mCodecSpecificDataSize, 0); mOwner->beginBox("esds"); mOwner->writeInt32(0); // version=0, flags=0 @@ -2662,7 +2674,7 @@ void MPEG4Writer::Track::writeDinfBox() { void MPEG4Writer::Track::writeAvccBox() { CHECK(mCodecSpecificData); - CHECK(mCodecSpecificDataSize >= 5); + CHECK_GE(mCodecSpecificDataSize, 5); // Patch avcc's lengthSize field to match the number // of bytes we use to indicate the size of a nal unit. @@ -2690,23 +2702,26 @@ void MPEG4Writer::Track::writePaspBox() { mOwner->endBox(); // pasp } +int32_t MPEG4Writer::Track::getStartTimeOffsetScaledTime() const { + int64_t trackStartTimeOffsetUs = 0; + int64_t moovStartTimeUs = mOwner->getStartTimestampUs(); + if (mStartTimestampUs != moovStartTimeUs) { + CHECK_GT(mStartTimestampUs, moovStartTimeUs); + trackStartTimeOffsetUs = mStartTimestampUs - moovStartTimeUs; + } + return (trackStartTimeOffsetUs * mTimeScale + 500000LL) / 1000000LL; +} + void MPEG4Writer::Track::writeSttsBox() { mOwner->beginBox("stts"); mOwner->writeInt32(0); // version=0, flags=0 mOwner->writeInt32(mNumSttsTableEntries); // Compensate for small start time difference from different media tracks - int64_t trackStartTimeOffsetUs = 0; - int64_t moovStartTimeUs = mOwner->getStartTimestampUs(); - if (mStartTimestampUs != moovStartTimeUs) { - CHECK(mStartTimestampUs > moovStartTimeUs); - trackStartTimeOffsetUs = mStartTimestampUs - moovStartTimeUs; - } List<SttsTableEntry>::iterator it = mSttsTableEntries.begin(); CHECK(it != mSttsTableEntries.end() && it->sampleCount == 1); mOwner->writeInt32(it->sampleCount); - int32_t dur = (trackStartTimeOffsetUs * mTimeScale + 500000LL) / 1000000LL; - mOwner->writeInt32(dur + it->sampleDuration); + mOwner->writeInt32(getStartTimeOffsetScaledTime() + it->sampleDuration); int64_t totalCount = 1; while (++it != mSttsTableEntries.end()) { @@ -2714,7 +2729,7 @@ void MPEG4Writer::Track::writeSttsBox() { mOwner->writeInt32(it->sampleDuration); totalCount += it->sampleCount; } - CHECK(totalCount == mNumSamples); + CHECK_EQ(totalCount, mNumSamples); mOwner->endBox(); // stts } @@ -2723,6 +2738,11 @@ void MPEG4Writer::Track::writeCttsBox() { return; } + // There is no B frame at all + if (mMinCttsOffsetTimeUs == mMaxCttsOffsetTimeUs) { + return; + } + // Do not write ctts box when there is no need to have it. if ((mNumCttsTableEntries == 1 && mCttsTableEntries.begin()->sampleDuration == 0) || @@ -2730,24 +2750,29 @@ void MPEG4Writer::Track::writeCttsBox() { return; } - ALOGV("ctts box has %d entries", mNumCttsTableEntries); + ALOGD("ctts box has %d entries with range [%lld, %lld]", + mNumCttsTableEntries, mMinCttsOffsetTimeUs, mMaxCttsOffsetTimeUs); mOwner->beginBox("ctts"); - if (mHasNegativeCttsDeltaDuration) { - mOwner->writeInt32(0x00010000); // version=1, flags=0 - } else { - mOwner->writeInt32(0); // version=0, flags=0 - } + // Version 1 allows to use negative offset time value, but + // we are sticking to version 0 for now. + mOwner->writeInt32(0); // version=0, flags=0 mOwner->writeInt32(mNumCttsTableEntries); - int64_t totalCount = 0; - for (List<CttsTableEntry>::iterator it = mCttsTableEntries.begin(); - it != mCttsTableEntries.end(); ++it) { + // Compensate for small start time difference from different media tracks + List<CttsTableEntry>::iterator it = mCttsTableEntries.begin(); + CHECK(it != mCttsTableEntries.end() && it->sampleCount == 1); + mOwner->writeInt32(it->sampleCount); + mOwner->writeInt32(getStartTimeOffsetScaledTime() + + it->sampleDuration - mMinCttsOffsetTimeUs); + + int64_t totalCount = 1; + while (++it != mCttsTableEntries.end()) { mOwner->writeInt32(it->sampleCount); - mOwner->writeInt32(it->sampleDuration); + mOwner->writeInt32(it->sampleDuration - mMinCttsOffsetTimeUs); totalCount += it->sampleCount; } - CHECK(totalCount == mNumSamples); + CHECK_EQ(totalCount, mNumSamples); mOwner->endBox(); // ctts } diff --git a/media/libstagefright/MediaBuffer.cpp b/media/libstagefright/MediaBuffer.cpp index 96271e4..11b80bf 100644 --- a/media/libstagefright/MediaBuffer.cpp +++ b/media/libstagefright/MediaBuffer.cpp @@ -22,8 +22,8 @@ #include <stdlib.h> #include <media/stagefright/foundation/ABuffer.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaBuffer.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MetaData.h> #include <ui/GraphicBuffer.h> @@ -157,7 +157,7 @@ void MediaBuffer::reset() { } MediaBuffer::~MediaBuffer() { - CHECK_EQ(mObserver, NULL); + CHECK(mObserver == NULL); if (mOwnsData && mData != NULL) { free(mData); @@ -188,7 +188,7 @@ int MediaBuffer::refcount() const { } MediaBuffer *MediaBuffer::clone() { - CHECK_EQ(mGraphicBuffer, NULL); + CHECK(mGraphicBuffer == NULL); MediaBuffer *buffer = new MediaBuffer(mData, mSize); buffer->set_range(mRangeOffset, mRangeLength); diff --git a/media/libstagefright/MediaBufferGroup.cpp b/media/libstagefright/MediaBufferGroup.cpp index c8d05f4..80aae51 100644 --- a/media/libstagefright/MediaBufferGroup.cpp +++ b/media/libstagefright/MediaBufferGroup.cpp @@ -17,9 +17,9 @@ #define LOG_TAG "MediaBufferGroup" #include <utils/Log.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaBuffer.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> namespace android { diff --git a/media/libstagefright/MediaSourceSplitter.cpp b/media/libstagefright/MediaSourceSplitter.cpp index 8af0694..3b64ded 100644 --- a/media/libstagefright/MediaSourceSplitter.cpp +++ b/media/libstagefright/MediaSourceSplitter.cpp @@ -18,8 +18,8 @@ #define LOG_TAG "MediaSourceSplitter" #include <utils/Log.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaSourceSplitter.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaBuffer.h> #include <media/stagefright/MetaData.h> diff --git a/media/libstagefright/MetaData.cpp b/media/libstagefright/MetaData.cpp index 884f3b4..66dec90 100644 --- a/media/libstagefright/MetaData.cpp +++ b/media/libstagefright/MetaData.cpp @@ -17,7 +17,7 @@ #include <stdlib.h> #include <string.h> -#include <media/stagefright/MediaDebug.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MetaData.h> namespace android { diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 381320b..470f750 100755 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -2187,7 +2187,7 @@ error: } } -int64_t OMXCodec::retrieveDecodingTimeUs(bool isCodecSpecific) { +int64_t OMXCodec::getDecodingTimeUs() { CHECK(mIsEncoder && mIsVideo); if (mDecodingTimeList.empty()) { @@ -2199,12 +2199,7 @@ int64_t OMXCodec::retrieveDecodingTimeUs(bool isCodecSpecific) { List<int64_t>::iterator it = mDecodingTimeList.begin(); int64_t timeUs = *it; - - // If the output buffer is codec specific configuration, - // do not remove the decoding time from the list. - if (!isCodecSpecific) { - mDecodingTimeList.erase(it); - } + mDecodingTimeList.erase(it); return timeUs; } @@ -2384,7 +2379,7 @@ void OMXCodec::on_message(const omx_message &msg) { } if (mIsEncoder && mIsVideo) { - int64_t decodingTimeUs = retrieveDecodingTimeUs(isCodecSpecific); + int64_t decodingTimeUs = isCodecSpecific? 0: getDecodingTimeUs(); buffer->meta_data()->setInt64(kKeyDecodingTime, decodingTimeUs); } diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp index 73efc27..5e79e78 100644 --- a/media/libstagefright/OggExtractor.cpp +++ b/media/libstagefright/OggExtractor.cpp @@ -21,10 +21,10 @@ #include "include/OggExtractor.h" #include <cutils/properties.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/MediaBuffer.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaSource.h> diff --git a/media/libstagefright/SampleIterator.cpp b/media/libstagefright/SampleIterator.cpp index 81ec5c1..eae721b 100644 --- a/media/libstagefright/SampleIterator.cpp +++ b/media/libstagefright/SampleIterator.cpp @@ -22,8 +22,8 @@ #include <arpa/inet.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/DataSource.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/Utils.h> #include "include/SampleTable.h" diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp index 43bfd9e..35f9c1f 100644 --- a/media/libstagefright/StagefrightMetadataRetriever.cpp +++ b/media/libstagefright/StagefrightMetadataRetriever.cpp @@ -20,10 +20,10 @@ #include "include/StagefrightMetadataRetriever.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/ColorConverter.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/FileSource.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaExtractor.h> #include <media/stagefright/MetaData.h> #include <media/stagefright/OMXCodec.h> @@ -37,7 +37,7 @@ StagefrightMetadataRetriever::StagefrightMetadataRetriever() ALOGV("StagefrightMetadataRetriever()"); DataSource::RegisterDefaultSniffers(); - CHECK_EQ(mClient.connect(), OK); + CHECK_EQ(mClient.connect(), (status_t)OK); } StagefrightMetadataRetriever::~StagefrightMetadataRetriever() { @@ -169,7 +169,7 @@ static VideoFrame *extractVideoFrameWithCodecFlags( || (buffer != NULL && buffer->range_length() == 0)); if (err != OK) { - CHECK_EQ(buffer, NULL); + CHECK(buffer == NULL); ALOGV("decoding frame failed."); decoder->stop(); diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp index d068381..aa047d6 100644 --- a/media/libstagefright/SurfaceMediaSource.cpp +++ b/media/libstagefright/SurfaceMediaSource.cpp @@ -16,14 +16,14 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "SurfaceMediaSource" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/SurfaceMediaSource.h> -#include <ui/GraphicBuffer.h> #include <media/stagefright/MetaData.h> #include <media/stagefright/MediaDefs.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/openmax/OMX_IVCommon.h> #include <media/stagefright/MetadataBufferType.h> +#include <ui/GraphicBuffer.h> #include <surfaceflinger/ISurfaceComposer.h> #include <surfaceflinger/SurfaceComposerClient.h> #include <surfaceflinger/IGraphicBufferAlloc.h> @@ -855,7 +855,7 @@ void SurfaceMediaSource::signalBufferReturned(MediaBuffer *buffer) { } if (!foundBuffer) { - CHECK_EQ(0, "signalBufferReturned: bogus buffer"); + CHECK(!"signalBufferReturned: bogus buffer"); } } diff --git a/media/libstagefright/ThrottledSource.cpp b/media/libstagefright/ThrottledSource.cpp index 88e07b0..b1fcafd 100644 --- a/media/libstagefright/ThrottledSource.cpp +++ b/media/libstagefright/ThrottledSource.cpp @@ -16,7 +16,7 @@ #include "include/ThrottledSource.h" -#include <media/stagefright/MediaDebug.h> +#include <media/stagefright/foundation/ADebug.h> namespace android { diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp index 12c9c36..f4b5d4f 100644 --- a/media/libstagefright/TimedEventQueue.cpp +++ b/media/libstagefright/TimedEventQueue.cpp @@ -31,7 +31,7 @@ #include <sys/prctl.h> #include <sys/time.h> -#include <media/stagefright/MediaDebug.h> +#include <media/stagefright/foundation/ADebug.h> #ifdef ANDROID_SIMULATOR #include <jni.h> diff --git a/media/libstagefright/VideoSourceDownSampler.cpp b/media/libstagefright/VideoSourceDownSampler.cpp index 1b66990..90a42c9 100644 --- a/media/libstagefright/VideoSourceDownSampler.cpp +++ b/media/libstagefright/VideoSourceDownSampler.cpp @@ -17,9 +17,9 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "VideoSourceDownSampler" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/VideoSourceDownSampler.h> #include <media/stagefright/MediaBuffer.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MetaData.h> #include <media/stagefright/YUVImage.h> #include <media/stagefright/YUVCanvas.h> diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp index 0bcaf08..501f480 100644 --- a/media/libstagefright/WAVExtractor.cpp +++ b/media/libstagefright/WAVExtractor.cpp @@ -20,9 +20,9 @@ #include "include/WAVExtractor.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaSource.h> @@ -217,7 +217,7 @@ status_t WAVExtractor::init() { kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_G711_ALAW); break; default: - CHECK_EQ(mWaveFormat, WAVE_FORMAT_MULAW); + CHECK_EQ(mWaveFormat, (uint16_t)WAVE_FORMAT_MULAW); mTrackMeta->setCString( kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_G711_MLAW); break; @@ -362,7 +362,7 @@ status_t WAVSource::read( // Convert 8-bit unsigned samples to 16-bit signed. MediaBuffer *tmp; - CHECK_EQ(mGroup->acquire_buffer(&tmp), OK); + CHECK_EQ(mGroup->acquire_buffer(&tmp), (status_t)OK); // The new buffer holds the sample number of samples, but each // one is 2 bytes wide. diff --git a/media/libstagefright/WVMExtractor.cpp b/media/libstagefright/WVMExtractor.cpp index 1e4e049..c7ad513 100644 --- a/media/libstagefright/WVMExtractor.cpp +++ b/media/libstagefright/WVMExtractor.cpp @@ -21,6 +21,7 @@ #include <arpa/inet.h> #include <utils/String8.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/Utils.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/MediaSource.h> @@ -28,7 +29,6 @@ #include <media/stagefright/MetaData.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaBuffer.h> -#include <media/stagefright/MediaDebug.h> #include <dlfcn.h> #include <utils/Errors.h> diff --git a/media/libstagefright/codecs/aacenc/AACEncoder.cpp b/media/libstagefright/codecs/aacenc/AACEncoder.cpp index 2b8633d..8b5007e 100644 --- a/media/libstagefright/codecs/aacenc/AACEncoder.cpp +++ b/media/libstagefright/codecs/aacenc/AACEncoder.cpp @@ -22,8 +22,8 @@ #include "voAAC.h" #include "cmnMemory.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MetaData.h> @@ -114,8 +114,8 @@ status_t AACEncoder::setAudioSpecificConfigData() { ALOGV("setAudioSpecificConfigData: %d hz, %d bps, and %d channels", mSampleRate, mBitRate, mChannels); - int32_t index; - CHECK_EQ(OK, getSampleRateTableIndex(mSampleRate, index)); + int32_t index = 0; + CHECK_EQ((status_t)OK, getSampleRateTableIndex(mSampleRate, index)); if (mChannels > 2 || mChannels <= 0) { ALOGE("Unsupported number of channels(%d)", mChannels); return UNKNOWN_ERROR; @@ -142,7 +142,7 @@ status_t AACEncoder::start(MetaData *params) { mBufferGroup = new MediaBufferGroup; mBufferGroup->add_buffer(new MediaBuffer(2048)); - CHECK_EQ(OK, initCheck()); + CHECK_EQ((status_t)OK, initCheck()); mNumInputSamples = 0; mAnchorTimeUs = 0; @@ -183,7 +183,7 @@ status_t AACEncoder::stop() { mSource->stop(); if (mEncoderHandle) { - CHECK_EQ(VO_ERR_NONE, mApiHandle->Uninit(mEncoderHandle)); + CHECK_EQ((VO_U32)VO_ERR_NONE, mApiHandle->Uninit(mEncoderHandle)); mEncoderHandle = NULL; } delete mApiHandle; @@ -223,7 +223,7 @@ status_t AACEncoder::read( CHECK(options == NULL || !options->getSeekTo(&seekTimeUs, &mode)); MediaBuffer *buffer; - CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), OK); + CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), (status_t)OK); uint8_t *outPtr = (uint8_t *)buffer->data(); bool readFromSource = false; int64_t wallClockTimeUs = -1; @@ -255,7 +255,7 @@ status_t AACEncoder::read( } size_t align = mInputBuffer->range_length() % sizeof(int16_t); - CHECK_EQ(align, 0); + CHECK_EQ(align, (size_t)0); int64_t timeUs; if (mInputBuffer->meta_data()->findInt64(kKeyDriftTime, &timeUs)) { diff --git a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp b/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp index 3afbc4f..27d7e4d 100644 --- a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp +++ b/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp @@ -18,8 +18,8 @@ #include "gsmamr_enc.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MetaData.h> @@ -210,7 +210,7 @@ status_t AMRNBEncoder::read( } MediaBuffer *buffer; - CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), OK); + CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), (status_t)OK); uint8_t *outPtr = (uint8_t *)buffer->data(); diff --git a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp b/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp index 60b1163..7fd3a95 100644 --- a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp +++ b/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp @@ -22,8 +22,8 @@ #include "voAMRWB.h" #include "cmnMemory.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MetaData.h> @@ -134,7 +134,7 @@ status_t AMRWBEncoder::start(MetaData *params) { // The largest buffer size is header + 477 bits mBufferGroup->add_buffer(new MediaBuffer(1024)); - CHECK_EQ(OK, initCheck()); + CHECK_EQ((status_t)OK, initCheck()); mNumFramesOutput = 0; @@ -163,7 +163,7 @@ status_t AMRWBEncoder::stop() { mBufferGroup = NULL; - CHECK_EQ(VO_ERR_NONE, mApiHandle->Uninit(mEncoderHandle)); + CHECK_EQ((VO_U32)VO_ERR_NONE, mApiHandle->Uninit(mEncoderHandle)); mEncoderHandle = NULL; delete mApiHandle; @@ -222,7 +222,7 @@ status_t AMRWBEncoder::read( } size_t align = mInputBuffer->range_length() % sizeof(int16_t); - CHECK_EQ(align, 0); + CHECK_EQ(align, (size_t)0); int64_t timeUs; if (mInputBuffer->meta_data()->findInt64(kKeyDriftTime, &timeUs)) { @@ -271,7 +271,7 @@ status_t AMRWBEncoder::read( CHECK(VO_ERR_NONE == mApiHandle->SetInputData(mEncoderHandle,&inputData)); MediaBuffer *buffer; - CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), OK); + CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), (status_t)OK); uint8_t *outPtr = (uint8_t *)buffer->data(); VO_CODECBUFFER outputData; diff --git a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp index e202a2b..7533f07 100644 --- a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp +++ b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp @@ -24,8 +24,8 @@ #include "avcenc_int.h" #include "OMX_Video.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MetaData.h> @@ -417,7 +417,7 @@ status_t AVCEncoder::read( *out = NULL; MediaBuffer *outputBuffer; - CHECK_EQ(OK, mGroup->acquire_buffer(&outputBuffer)); + CHECK_EQ((status_t)OK, mGroup->acquire_buffer(&outputBuffer)); uint8_t *outPtr = (uint8_t *) outputBuffer->data(); uint32_t dataLength = outputBuffer->size(); @@ -557,9 +557,9 @@ status_t AVCEncoder::read( encoderStatus = PVAVCEncodeNAL(mHandle, outPtr, &dataLength, &type); if (encoderStatus == AVCENC_SUCCESS) { outputBuffer->meta_data()->setInt32(kKeyIsSyncFrame, mIsIDRFrame); - CHECK_EQ(NULL, PVAVCEncGetOverrunBuffer(mHandle)); + CHECK(NULL == PVAVCEncGetOverrunBuffer(mHandle)); } else if (encoderStatus == AVCENC_PICTURE_READY) { - CHECK_EQ(NULL, PVAVCEncGetOverrunBuffer(mHandle)); + CHECK(NULL == PVAVCEncGetOverrunBuffer(mHandle)); if (mIsIDRFrame) { outputBuffer->meta_data()->setInt32(kKeyIsSyncFrame, mIsIDRFrame); mIsIDRFrame = 0; diff --git a/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp b/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp index d538603..20b0f8d 100644 --- a/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp +++ b/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp @@ -23,8 +23,8 @@ #include "mp4enc_api.h" #include "OMX_Video.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaBufferGroup.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MetaData.h> @@ -379,7 +379,7 @@ status_t M4vH263Encoder::read( *out = NULL; MediaBuffer *outputBuffer; - CHECK_EQ(OK, mGroup->acquire_buffer(&outputBuffer)); + CHECK_EQ((status_t)OK, mGroup->acquire_buffer(&outputBuffer)); uint8_t *outPtr = (uint8_t *) outputBuffer->data(); int32_t dataLength = outputBuffer->size(); @@ -467,7 +467,7 @@ status_t M4vH263Encoder::read( mInputBuffer = NULL; return UNKNOWN_ERROR; } - CHECK_EQ(NULL, PVGetOverrunBuffer(mHandle)); + CHECK(NULL == PVGetOverrunBuffer(mHandle)); if (hintTrack.CodeType == 0) { // I-frame serves as sync frame outputBuffer->meta_data()->setInt32(kKeyIsSyncFrame, 1); } diff --git a/media/libstagefright/colorconversion/ColorConverter.cpp b/media/libstagefright/colorconversion/ColorConverter.cpp index f3ef3de..597167f 100644 --- a/media/libstagefright/colorconversion/ColorConverter.cpp +++ b/media/libstagefright/colorconversion/ColorConverter.cpp @@ -18,8 +18,8 @@ #define LOG_TAG "ColorConverter" #include <utils/Log.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/ColorConverter.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaErrors.h> namespace android { diff --git a/media/libstagefright/id3/Android.mk b/media/libstagefright/id3/Android.mk index 23c8e44..ff35d4a 100644 --- a/media/libstagefright/id3/Android.mk +++ b/media/libstagefright/id3/Android.mk @@ -16,7 +16,7 @@ LOCAL_SRC_FILES := \ testid3.cpp LOCAL_SHARED_LIBRARIES := \ - libstagefright libutils libbinder + libstagefright libutils libbinder libstagefright_foundation LOCAL_STATIC_LIBRARIES := \ libstagefright_id3 diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp index 6dde9d8..2e92926 100644 --- a/media/libstagefright/id3/ID3.cpp +++ b/media/libstagefright/id3/ID3.cpp @@ -20,8 +20,8 @@ #include "../include/ID3.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/DataSource.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/Utils.h> #include <utils/String8.h> #include <byteswap.h> diff --git a/media/libstagefright/id3/testid3.cpp b/media/libstagefright/id3/testid3.cpp index 0741045..bc4572c 100644 --- a/media/libstagefright/id3/testid3.cpp +++ b/media/libstagefright/id3/testid3.cpp @@ -23,7 +23,7 @@ #include <binder/ProcessState.h> #include <media/stagefright/FileSource.h> -#include <media/stagefright/MediaDebug.h> +#include <media/stagefright/foundation/ADebug.h> #define MAXPATHLEN 256 @@ -70,7 +70,7 @@ static void hexdump(const void *_data, size_t size) { void scanFile(const char *path) { sp<FileSource> file = new FileSource(path); - CHECK_EQ(file->initCheck(), OK); + CHECK_EQ(file->initCheck(), (status_t)OK); ID3 tag(file); if (!tag.isValid()) { diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h index a7a3d47..4c7bfa6 100644 --- a/media/libstagefright/include/AwesomePlayer.h +++ b/media/libstagefright/include/AwesomePlayer.h @@ -258,7 +258,7 @@ private: void setVideoSource(sp<MediaSource> source); status_t initVideoDecoder(uint32_t flags = 0); - void addTextSource(sp<MediaSource> source); + void addTextSource(const sp<MediaSource>& source); void onStreamDone(); diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp index a1644d2..a0db719 100644 --- a/media/libstagefright/matroska/MatroskaExtractor.cpp +++ b/media/libstagefright/matroska/MatroskaExtractor.cpp @@ -93,7 +93,10 @@ struct BlockIterator { void advance(); void reset(); - void seek(int64_t seekTimeUs, bool seekToKeyFrame); + + void seek( + int64_t seekTimeUs, bool seekToKeyFrame, + int64_t *actualFrameTimeUs); const mkvparser::Block *block() const; int64_t blockTimeUs() const; @@ -303,23 +306,53 @@ void BlockIterator::reset() { } while (!eos() && block()->GetTrackNumber() != mTrackNum); } -void BlockIterator::seek(int64_t seekTimeUs, bool seekToKeyFrame) { +void BlockIterator::seek( + int64_t seekTimeUs, bool seekToKeyFrame, + int64_t *actualFrameTimeUs) { Mutex::Autolock autoLock(mExtractor->mLock); - mCluster = mExtractor->mSegment->FindCluster(seekTimeUs * 1000ll); + *actualFrameTimeUs = -1ll; + + int64_t seekTimeNs = seekTimeUs * 1000ll; + + mCluster = mExtractor->mSegment->FindCluster(seekTimeNs); mBlockEntry = NULL; mBlockEntryIndex = 0; - do { + long prevKeyFrameBlockEntryIndex = -1; + + for (;;) { advance_l(); - } - while (!eos() && block()->GetTrackNumber() != mTrackNum); - if (seekToKeyFrame) { - while (!eos() && !mBlockEntry->GetBlock()->IsKey()) { - advance_l(); + if (eos()) { + break; + } + + if (block()->GetTrackNumber() != mTrackNum) { + continue; + } + + if (block()->IsKey()) { + prevKeyFrameBlockEntryIndex = mBlockEntryIndex - 1; + } + + int64_t timeNs = block()->GetTime(mCluster); + + if (timeNs >= seekTimeNs) { + *actualFrameTimeUs = (timeNs + 500ll) / 1000ll; + break; } } + + if (eos()) { + return; + } + + if (seekToKeyFrame && !block()->IsKey()) { + CHECK_GE(prevKeyFrameBlockEntryIndex, 0); + mBlockEntryIndex = prevKeyFrameBlockEntryIndex; + advance_l(); + } } const mkvparser::Block *BlockIterator::block() const { @@ -397,6 +430,8 @@ status_t MatroskaSource::read( MediaBuffer **out, const ReadOptions *options) { *out = NULL; + int64_t targetSampleTimeUs = -1ll; + int64_t seekTimeUs; ReadOptions::SeekMode mode; if (options && options->getSeekTo(&seekTimeUs, &mode) @@ -406,10 +441,14 @@ status_t MatroskaSource::read( // Apparently keyframe indication in audio tracks is unreliable, // fortunately in all our currently supported audio encodings every // frame is effectively a keyframe. - mBlockIter.seek(seekTimeUs, !mIsAudio); + int64_t actualFrameTimeUs; + mBlockIter.seek(seekTimeUs, !mIsAudio, &actualFrameTimeUs); + + if (mode == ReadOptions::SEEK_CLOSEST) { + targetSampleTimeUs = actualFrameTimeUs; + } } -again: while (mPendingFrames.empty()) { status_t err = readBlock(); @@ -424,6 +463,11 @@ again: mPendingFrames.erase(mPendingFrames.begin()); if (mType != AVC) { + if (targetSampleTimeUs >= 0ll) { + frame->meta_data()->setInt64( + kKeyTargetTime, targetSampleTimeUs); + } + *out = frame; return OK; @@ -506,6 +550,11 @@ again: frame->release(); frame = NULL; + if (targetSampleTimeUs >= 0ll) { + buffer->meta_data()->setInt64( + kKeyTargetTime, targetSampleTimeUs); + } + *out = buffer; return OK; diff --git a/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp b/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp index 03033f5..e1589b4 100644 --- a/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp +++ b/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp @@ -22,8 +22,8 @@ #include "include/LiveSession.h" #include "include/NuCachedSource2.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/DataSource.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaSource.h> diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp index ace883c..f11fcd2 100644 --- a/media/libstagefright/omx/OMX.cpp +++ b/media/libstagefright/omx/OMX.cpp @@ -25,7 +25,7 @@ #include "../include/OMXNodeInstance.h" #include <binder/IMemory.h> -#include <media/stagefright/MediaDebug.h> +#include <media/stagefright/foundation/ADebug.h> #include <utils/threads.h> #include "OMXMaster.h" @@ -102,7 +102,7 @@ OMX::CallbackDispatcher::~CallbackDispatcher() { if (status != WOULD_BLOCK) { // Other than join to self, the only other error return codes are // whatever readyToRun() returns, and we don't override that - CHECK_EQ(status, NO_ERROR); + CHECK_EQ(status, (status_t)NO_ERROR); } } diff --git a/media/libstagefright/omx/OMXComponentBase.cpp b/media/libstagefright/omx/OMXComponentBase.cpp index 35227a0..7d11dce 100644 --- a/media/libstagefright/omx/OMXComponentBase.cpp +++ b/media/libstagefright/omx/OMXComponentBase.cpp @@ -18,7 +18,7 @@ #include <stdlib.h> -#include <media/stagefright/MediaDebug.h> +#include <media/stagefright/foundation/ADebug.h> namespace android { @@ -33,7 +33,7 @@ OMXComponentBase::OMXComponentBase( OMXComponentBase::~OMXComponentBase() {} void OMXComponentBase::setComponentHandle(OMX_COMPONENTTYPE *handle) { - CHECK_EQ(mComponentHandle, NULL); + CHECK(mComponentHandle == NULL); mComponentHandle = handle; } diff --git a/media/libstagefright/omx/OMXMaster.cpp b/media/libstagefright/omx/OMXMaster.cpp index d698939..6b6d0ab 100644 --- a/media/libstagefright/omx/OMXMaster.cpp +++ b/media/libstagefright/omx/OMXMaster.cpp @@ -24,7 +24,7 @@ #include <dlfcn.h> -#include <media/stagefright/MediaDebug.h> +#include <media/stagefright/foundation/ADebug.h> namespace android { diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp index 8938e33..099c4f5 100644 --- a/media/libstagefright/omx/OMXNodeInstance.cpp +++ b/media/libstagefright/omx/OMXNodeInstance.cpp @@ -24,8 +24,8 @@ #include <OMX_Component.h> #include <binder/IMemory.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/HardwareAPI.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaErrors.h> namespace android { @@ -91,11 +91,11 @@ OMXNodeInstance::OMXNodeInstance( } OMXNodeInstance::~OMXNodeInstance() { - CHECK_EQ(mHandle, NULL); + CHECK(mHandle == NULL); } void OMXNodeInstance::setHandle(OMX::node_id node_id, OMX_HANDLETYPE handle) { - CHECK_EQ(mHandle, NULL); + CHECK(mHandle == NULL); mNodeID = node_id; mHandle = handle; } diff --git a/media/libstagefright/omx/tests/Android.mk b/media/libstagefright/omx/tests/Android.mk index 41c08be..0c0a70c 100644 --- a/media/libstagefright/omx/tests/Android.mk +++ b/media/libstagefright/omx/tests/Android.mk @@ -5,7 +5,7 @@ LOCAL_SRC_FILES = \ OMXHarness.cpp \ LOCAL_SHARED_LIBRARIES := \ - libstagefright libbinder libmedia libutils + libstagefright libbinder libmedia libutils libstagefright_foundation LOCAL_C_INCLUDES := \ $(JNI_H_INCLUDE) \ diff --git a/media/libstagefright/omx/tests/OMXHarness.cpp b/media/libstagefright/omx/tests/OMXHarness.cpp index 8faf544..fab1771 100644 --- a/media/libstagefright/omx/tests/OMXHarness.cpp +++ b/media/libstagefright/omx/tests/OMXHarness.cpp @@ -26,9 +26,9 @@ #include <binder/IServiceManager.h> #include <binder/MemoryDealer.h> #include <media/IMediaPlayerService.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/MediaBuffer.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaExtractor.h> @@ -155,7 +155,7 @@ status_t Harness::dequeueMessageForNodeIgnoringBuffers( if (err == TIMED_OUT) { return err; } - CHECK_EQ(err, OK); + CHECK_EQ(err, (status_t)OK); } } @@ -317,7 +317,7 @@ status_t Harness::testStateTransitions( EXPECT_SUCCESS(err, "allocatePortBuffers(input)"); err = dequeueMessageForNode(node, &msg, DEFAULT_TIMEOUT); - CHECK_EQ(err, TIMED_OUT); + CHECK_EQ(err, (status_t)TIMED_OUT); Vector<Buffer> outputBuffers; err = allocatePortBuffers(dealer, node, 1, &outputBuffers); @@ -412,7 +412,7 @@ status_t Harness::testStateTransitions( // Make sure node doesn't just transition to loaded before we are done // freeing all input and output buffers. err = dequeueMessageForNode(node, &msg, DEFAULT_TIMEOUT); - CHECK_EQ(err, TIMED_OUT); + CHECK_EQ(err, (status_t)TIMED_OUT); for (size_t i = 0; i < inputBuffers.size(); ++i) { err = mOMX->freeBuffer(node, 0, inputBuffers[i].mID); @@ -420,7 +420,7 @@ status_t Harness::testStateTransitions( } err = dequeueMessageForNode(node, &msg, DEFAULT_TIMEOUT); - CHECK_EQ(err, TIMED_OUT); + CHECK_EQ(err, (status_t)TIMED_OUT); for (size_t i = 0; i < outputBuffers.size(); ++i) { err = mOMX->freeBuffer(node, 1, outputBuffers[i].mID); @@ -584,7 +584,7 @@ status_t Harness::testSeek( return UNKNOWN_ERROR; } - CHECK_EQ(seekSource->start(), OK); + CHECK_EQ(seekSource->start(), (status_t)OK); sp<MediaSource> codec = OMXCodec::Create( mOMX, source->getFormat(), false /* createEncoder */, @@ -592,7 +592,7 @@ status_t Harness::testSeek( CHECK(codec != NULL); - CHECK_EQ(codec->start(), OK); + CHECK_EQ(codec->start(), (status_t)OK); int64_t durationUs; CHECK(source->getFormat()->findInt64(kKeyDuration, &durationUs)); @@ -638,7 +638,7 @@ status_t Harness::testSeek( requestedSeekTimeUs, MediaSource::ReadOptions::SEEK_NEXT_SYNC); if (seekSource->read(&buffer, &options) != OK) { - CHECK_EQ(buffer, NULL); + CHECK(buffer == NULL); actualSeekTimeUs = -1; } else { CHECK(buffer != NULL); @@ -659,7 +659,7 @@ status_t Harness::testSeek( err = codec->read(&buffer, &options); options.clearSeekTo(); if (err == INFO_FORMAT_CHANGED) { - CHECK_EQ(buffer, NULL); + CHECK(buffer == NULL); continue; } if (err == OK) { @@ -670,7 +670,7 @@ status_t Harness::testSeek( continue; } } else { - CHECK_EQ(buffer, NULL); + CHECK(buffer == NULL); } break; @@ -679,7 +679,7 @@ status_t Harness::testSeek( if (requestedSeekTimeUs < 0) { // Linear read. if (err != OK) { - CHECK_EQ(buffer, NULL); + CHECK(buffer == NULL); } else { CHECK(buffer != NULL); buffer->release(); @@ -694,8 +694,8 @@ status_t Harness::testSeek( "We attempted to seek beyond EOS and expected " "ERROR_END_OF_STREAM to be returned, but instead " "we found some other error."); - CHECK_EQ(err, ERROR_END_OF_STREAM); - CHECK_EQ(buffer, NULL); + CHECK_EQ(err, (status_t)ERROR_END_OF_STREAM); + CHECK(buffer == NULL); } else { EXPECT(err == OK, "Expected a valid buffer to be returned from " @@ -715,7 +715,7 @@ status_t Harness::testSeek( buffer->release(); buffer = NULL; - CHECK_EQ(codec->stop(), OK); + CHECK_EQ(codec->stop(), (status_t)OK); return UNKNOWN_ERROR; } @@ -725,7 +725,7 @@ status_t Harness::testSeek( } } - CHECK_EQ(codec->stop(), OK); + CHECK_EQ(codec->stop(), (status_t)OK); return OK; } @@ -841,7 +841,7 @@ int main(int argc, char **argv) { srand(seed); sp<Harness> h = new Harness; - CHECK_EQ(h->initCheck(), OK); + CHECK_EQ(h->initCheck(), (status_t)OK); if (argc == 0) { h->testAll(); diff --git a/media/libstagefright/tests/SurfaceMediaSource_test.cpp b/media/libstagefright/tests/SurfaceMediaSource_test.cpp index 76b507f..d7cec04 100644 --- a/media/libstagefright/tests/SurfaceMediaSource_test.cpp +++ b/media/libstagefright/tests/SurfaceMediaSource_test.cpp @@ -35,7 +35,7 @@ #include <binder/ProcessState.h> #include <ui/FramebufferNativeWindow.h> -#include <media/stagefright/MediaDebug.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaBufferGroup.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MetaData.h> @@ -475,7 +475,7 @@ sp<MediaRecorder> SurfaceMediaSourceGLTest::setUpMediaRecorder(int fd, int video mr->setVideoFrameRate(fps); mr->prepare(); ALOGV("Starting MediaRecorder..."); - CHECK_EQ(OK, mr->start()); + CHECK_EQ((status_t)OK, mr->start()); return mr; } @@ -757,7 +757,7 @@ TEST_F(SurfaceMediaSourceTest, DISABLED_EncodingFromCpuYV12BufferNpotWriteMediaS ASSERT_EQ(NO_ERROR, native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU)); ALOGV("Stopping MediaRecorder..."); - CHECK_EQ(OK, mr->stop()); + CHECK_EQ((status_t)OK, mr->stop()); mr.clear(); close(fd); } @@ -886,7 +886,7 @@ TEST_F(SurfaceMediaSourceGLTest, EncodingFromGLRgbaSameImageEachBufNpotWrite) { mEglSurface = EGL_NO_SURFACE; ALOGV("Stopping MediaRecorder..."); - CHECK_EQ(OK, mr->stop()); + CHECK_EQ((status_t)OK, mr->stop()); mr.clear(); close(fd); } @@ -929,7 +929,7 @@ TEST_F(SurfaceMediaSourceGLTest, EncodingFromGLRgbaDiffImageEachBufNpotWrite) { mEglSurface = EGL_NO_SURFACE; ALOGV("Stopping MediaRecorder..."); - CHECK_EQ(OK, mr->stop()); + CHECK_EQ((status_t)OK, mr->stop()); mr.clear(); close(fd); } diff --git a/media/libstagefright/timedtext/TimedTextInBandSource.cpp b/media/libstagefright/timedtext/TimedTextInBandSource.cpp index f2c4d54..afb73fb 100644 --- a/media/libstagefright/timedtext/TimedTextInBandSource.cpp +++ b/media/libstagefright/timedtext/TimedTextInBandSource.cpp @@ -19,8 +19,8 @@ #include <utils/Log.h> #include <binder/Parcel.h> +#include <media/stagefright/foundation/ADebug.h> // CHECK_XX macro #include <media/stagefright/MediaBuffer.h> -#include <media/stagefright/MediaDebug.h> // CHECK_XX macro #include <media/stagefright/MediaDefs.h> // for MEDIA_MIMETYPE_xxx #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaSource.h> diff --git a/media/libstagefright/timedtext/TimedTextPlayer.cpp b/media/libstagefright/timedtext/TimedTextPlayer.cpp index 8c2df88..bf7cbf6 100644 --- a/media/libstagefright/timedtext/TimedTextPlayer.cpp +++ b/media/libstagefright/timedtext/TimedTextPlayer.cpp @@ -18,8 +18,8 @@ #define LOG_TAG "TimedTextPlayer" #include <utils/Log.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/foundation/AMessage.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaErrors.h> #include <media/MediaPlayerInterface.h> diff --git a/media/libstagefright/yuv/YUVCanvas.cpp b/media/libstagefright/yuv/YUVCanvas.cpp index 38aa779..4c9fee8 100644 --- a/media/libstagefright/yuv/YUVCanvas.cpp +++ b/media/libstagefright/yuv/YUVCanvas.cpp @@ -17,7 +17,7 @@ #define LOG_NDEBUG 0 #define LOG_TAG "YUVCanvas" -#include <media/stagefright/MediaDebug.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/YUVCanvas.h> #include <media/stagefright/YUVImage.h> #include <ui/Rect.h> diff --git a/media/libstagefright/yuv/YUVImage.cpp b/media/libstagefright/yuv/YUVImage.cpp index 0d67c96..7b9000b 100644 --- a/media/libstagefright/yuv/YUVImage.cpp +++ b/media/libstagefright/yuv/YUVImage.cpp @@ -17,9 +17,9 @@ #define LOG_NDEBUG 0 #define LOG_TAG "YUVImage" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/YUVImage.h> #include <ui/Rect.h> -#include <media/stagefright/MediaDebug.h> namespace android { |