Loading media/libmediaplayerservice/StagefrightRecorder.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -2009,6 +2009,9 @@ void StagefrightRecorder::setupMPEG4orWEBMMetaData(sp<MetaData> *meta) { (*meta)->setInt32(kKeyRotation, mRotationDegrees); } } if (mOutputFormat == OUTPUT_FORMAT_MPEG_4 || mOutputFormat == OUTPUT_FORMAT_THREE_GPP) { (*meta)->setInt32(kKeyEmptyTrackMalFormed, true); } } status_t StagefrightRecorder::pause() { Loading media/libstagefright/MPEG4Writer.cpp +85 −67 Original line number Diff line number Diff line Loading @@ -1131,8 +1131,8 @@ status_t MPEG4Writer::reset(bool stopSource) { err = writerErr; } // Do not write out movie header on error. if (err != OK) { // Do not write out movie header on error except malformed track. if (err != OK && err != ERROR_MALFORMED) { release(); return err; } Loading Loading @@ -2687,7 +2687,7 @@ status_t MPEG4Writer::Track::pause() { status_t MPEG4Writer::Track::stop(bool stopSource) { ALOGD("%s track stopping. %s source", getTrackType(), stopSource ? "Stop" : "Not Stop"); if (!mStarted) { ALOGE("Stop() called but track is not started"); ALOGE("Stop() called but track is not started or stopped"); return ERROR_END_OF_STREAM; } Loading @@ -2711,6 +2711,7 @@ status_t MPEG4Writer::Track::stop(bool stopSource) { err = static_cast<status_t>(reinterpret_cast<uintptr_t>(dummy)); WARN_UNLESS(err == 0, "%s track stopped. Status :%d. %s source", getTrackType(), err, stopSource ? "Stop" : "Not Stop"); mStarted = false; return err; } Loading Loading @@ -3586,12 +3587,15 @@ status_t MPEG4Writer::Track::threadEntry() { } } if (isTrackMalFormed()) { mIsMalformed = true; dumpTimeStamps(); err = ERROR_MALFORMED; } mOwner->trackProgressStatus(mTrackId, -1, err); // Add final entries only for non-empty tracks. if (mStszTableEntries->count() > 0) { if (mIsHeic) { if (!mChunkSamples.empty()) { bufferChunk(0); Loading Loading @@ -3638,6 +3642,7 @@ status_t MPEG4Writer::Track::threadEntry() { mTrackDurationUs += lastDurationUs; } } } mReachedEOS = true; sendTrackSummary(hasMultipleTracks); Loading @@ -3659,15 +3664,25 @@ bool MPEG4Writer::Track::isTrackMalFormed() const { return true; } int32_t emptyTrackMalformed = false; if (mOwner->mStartMeta && mOwner->mStartMeta->findInt32(kKeyEmptyTrackMalFormed, &emptyTrackMalformed) && emptyTrackMalformed) { if (!mIsHeic && mStszTableEntries->count() == 0) { // no samples written ALOGE("The number of recorded samples is 0"); return true; } if (mIsVideo && mStssTableEntries->count() == 0) { // no sync frames for video ALOGE("There are no sync frames for video track"); return true; } } else { // No sync frames for video. if (mIsVideo && mStszTableEntries->count() > 0 && mStssTableEntries->count() == 0) { ALOGE("There are no sync frames for video track"); return true; } } if (OK != checkCodecSpecificData()) { // no codec specific data return true; Loading Loading @@ -3915,6 +3930,8 @@ int64_t MPEG4Writer::Track::getMinCttsOffsetTimeUs() { void MPEG4Writer::Track::writeStblBox() { mOwner->beginBox("stbl"); // Add subboxes only for non-empty tracks. if (mStszTableEntries->count() > 0) { mOwner->beginBox("stsd"); mOwner->writeInt32(0); // version=0, flags=0 mOwner->writeInt32(1); // entry count Loading @@ -3934,6 +3951,7 @@ void MPEG4Writer::Track::writeStblBox() { writeStszBox(); writeStscBox(); writeCo64Box(); } mOwner->endBox(); // stbl } Loading media/libstagefright/MediaMuxer.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,6 @@ status_t MediaMuxer::start() { status_t MediaMuxer::stop() { Mutex::Autolock autoLock(mMuxerLock); if (mState == STARTED || mState == ERROR) { mState = STOPPED; for (size_t i = 0; i < mTrackList.size(); i++) { Loading @@ -165,7 +164,10 @@ status_t MediaMuxer::stop() { return INVALID_OPERATION; } } // Unlock this mutex to allow notify to be called during stop process. mMuxerLock.unlock(); status_t err = mWriter->stop(); mMuxerLock.lock(); if (err != OK || mError != OK) { ALOGE("stop err: %d, mError:%d", err, mError); } Loading media/libstagefright/include/media/stagefright/MetaDataBase.h +3 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,9 @@ enum { kKeyOpaqueCSD2 = 'csd2', kKeyHapticChannelCount = 'hapC', // Treat empty track as malformed for MediaRecorder. kKeyEmptyTrackMalFormed = 'nemt', // bool (int32_t) }; enum { Loading Loading
media/libmediaplayerservice/StagefrightRecorder.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -2009,6 +2009,9 @@ void StagefrightRecorder::setupMPEG4orWEBMMetaData(sp<MetaData> *meta) { (*meta)->setInt32(kKeyRotation, mRotationDegrees); } } if (mOutputFormat == OUTPUT_FORMAT_MPEG_4 || mOutputFormat == OUTPUT_FORMAT_THREE_GPP) { (*meta)->setInt32(kKeyEmptyTrackMalFormed, true); } } status_t StagefrightRecorder::pause() { Loading
media/libstagefright/MPEG4Writer.cpp +85 −67 Original line number Diff line number Diff line Loading @@ -1131,8 +1131,8 @@ status_t MPEG4Writer::reset(bool stopSource) { err = writerErr; } // Do not write out movie header on error. if (err != OK) { // Do not write out movie header on error except malformed track. if (err != OK && err != ERROR_MALFORMED) { release(); return err; } Loading Loading @@ -2687,7 +2687,7 @@ status_t MPEG4Writer::Track::pause() { status_t MPEG4Writer::Track::stop(bool stopSource) { ALOGD("%s track stopping. %s source", getTrackType(), stopSource ? "Stop" : "Not Stop"); if (!mStarted) { ALOGE("Stop() called but track is not started"); ALOGE("Stop() called but track is not started or stopped"); return ERROR_END_OF_STREAM; } Loading @@ -2711,6 +2711,7 @@ status_t MPEG4Writer::Track::stop(bool stopSource) { err = static_cast<status_t>(reinterpret_cast<uintptr_t>(dummy)); WARN_UNLESS(err == 0, "%s track stopped. Status :%d. %s source", getTrackType(), err, stopSource ? "Stop" : "Not Stop"); mStarted = false; return err; } Loading Loading @@ -3586,12 +3587,15 @@ status_t MPEG4Writer::Track::threadEntry() { } } if (isTrackMalFormed()) { mIsMalformed = true; dumpTimeStamps(); err = ERROR_MALFORMED; } mOwner->trackProgressStatus(mTrackId, -1, err); // Add final entries only for non-empty tracks. if (mStszTableEntries->count() > 0) { if (mIsHeic) { if (!mChunkSamples.empty()) { bufferChunk(0); Loading Loading @@ -3638,6 +3642,7 @@ status_t MPEG4Writer::Track::threadEntry() { mTrackDurationUs += lastDurationUs; } } } mReachedEOS = true; sendTrackSummary(hasMultipleTracks); Loading @@ -3659,15 +3664,25 @@ bool MPEG4Writer::Track::isTrackMalFormed() const { return true; } int32_t emptyTrackMalformed = false; if (mOwner->mStartMeta && mOwner->mStartMeta->findInt32(kKeyEmptyTrackMalFormed, &emptyTrackMalformed) && emptyTrackMalformed) { if (!mIsHeic && mStszTableEntries->count() == 0) { // no samples written ALOGE("The number of recorded samples is 0"); return true; } if (mIsVideo && mStssTableEntries->count() == 0) { // no sync frames for video ALOGE("There are no sync frames for video track"); return true; } } else { // No sync frames for video. if (mIsVideo && mStszTableEntries->count() > 0 && mStssTableEntries->count() == 0) { ALOGE("There are no sync frames for video track"); return true; } } if (OK != checkCodecSpecificData()) { // no codec specific data return true; Loading Loading @@ -3915,6 +3930,8 @@ int64_t MPEG4Writer::Track::getMinCttsOffsetTimeUs() { void MPEG4Writer::Track::writeStblBox() { mOwner->beginBox("stbl"); // Add subboxes only for non-empty tracks. if (mStszTableEntries->count() > 0) { mOwner->beginBox("stsd"); mOwner->writeInt32(0); // version=0, flags=0 mOwner->writeInt32(1); // entry count Loading @@ -3934,6 +3951,7 @@ void MPEG4Writer::Track::writeStblBox() { writeStszBox(); writeStscBox(); writeCo64Box(); } mOwner->endBox(); // stbl } Loading
media/libstagefright/MediaMuxer.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,6 @@ status_t MediaMuxer::start() { status_t MediaMuxer::stop() { Mutex::Autolock autoLock(mMuxerLock); if (mState == STARTED || mState == ERROR) { mState = STOPPED; for (size_t i = 0; i < mTrackList.size(); i++) { Loading @@ -165,7 +164,10 @@ status_t MediaMuxer::stop() { return INVALID_OPERATION; } } // Unlock this mutex to allow notify to be called during stop process. mMuxerLock.unlock(); status_t err = mWriter->stop(); mMuxerLock.lock(); if (err != OK || mError != OK) { ALOGE("stop err: %d, mError:%d", err, mError); } Loading
media/libstagefright/include/media/stagefright/MetaDataBase.h +3 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,9 @@ enum { kKeyOpaqueCSD2 = 'csd2', kKeyHapticChannelCount = 'hapC', // Treat empty track as malformed for MediaRecorder. kKeyEmptyTrackMalFormed = 'nemt', // bool (int32_t) }; enum { Loading