Loading include/media/stagefright/MPEG4Writer.h +3 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,8 @@ public: int32_t getTimeScale() const { return mTimeScale; } status_t setGeoData(int latitudex10000, int longitudex10000); void setStartTimeOffsetMs(int ms) { mStartTimeOffsetMs = ms; } int32_t getStartTimeOffsetMs() const { return mStartTimeOffsetMs; } protected: virtual ~MPEG4Writer(); Loading Loading @@ -84,6 +86,7 @@ private: int mLatitudex10000; int mLongitudex10000; bool mAreGeoTagsAvailable; int32_t mStartTimeOffsetMs; Mutex mLock; Loading media/libmediaplayerservice/StagefrightRecorder.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -1453,6 +1453,12 @@ status_t StagefrightRecorder::setupMPEG4Recording( writer->setMaxFileSize(mMaxFileSizeBytes); } mStartTimeOffsetMs = mEncoderProfiles->getStartTimeOffsetMs(mCameraId); if (mStartTimeOffsetMs > 0) { reinterpret_cast<MPEG4Writer *>(writer.get())-> setStartTimeOffsetMs(mStartTimeOffsetMs); } writer->setListener(mListener); *mediaWriter = writer; return OK; Loading Loading @@ -1659,6 +1665,7 @@ status_t StagefrightRecorder::reset() { mAudioTimeScale = -1; mVideoTimeScale = -1; mCameraId = 0; mStartTimeOffsetMs = -1; mVideoEncoderProfile = -1; mVideoEncoderLevel = -1; mMaxFileDurationUs = 0; Loading Loading @@ -1747,6 +1754,8 @@ status_t StagefrightRecorder::dump( result.append(buffer); snprintf(buffer, SIZE, " Camera Id: %d\n", mCameraId); result.append(buffer); snprintf(buffer, SIZE, " Start time offset (ms): %d\n", mStartTimeOffsetMs); result.append(buffer); snprintf(buffer, SIZE, " Encoder: %d\n", mVideoEncoder); result.append(buffer); snprintf(buffer, SIZE, " Encoder profile: %d\n", mVideoEncoderProfile); Loading media/libmediaplayerservice/StagefrightRecorder.h +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ private: int32_t mRotationDegrees; // Clockwise int32_t mLatitudex10000; int32_t mLongitudex10000; int32_t mStartTimeOffsetMs; bool mCaptureTimeLapse; int64_t mTimeBetweenTimeLapseFrameCaptureUs; Loading media/libstagefright/MPEG4Writer.cpp +24 −10 Original line number Diff line number Diff line Loading @@ -260,7 +260,8 @@ MPEG4Writer::MPEG4Writer(const char *filename) mInterleaveDurationUs(1000000), mLatitudex10000(0), mLongitudex10000(0), mAreGeoTagsAvailable(false) { mAreGeoTagsAvailable(false), mStartTimeOffsetMs(-1) { mFd = open(filename, O_CREAT | O_LARGEFILE | O_TRUNC | O_RDWR); if (mFd >= 0) { Loading @@ -282,7 +283,8 @@ MPEG4Writer::MPEG4Writer(int fd) mInterleaveDurationUs(1000000), mLatitudex10000(0), mLongitudex10000(0), mAreGeoTagsAvailable(false) { mAreGeoTagsAvailable(false), mStartTimeOffsetMs(-1) { } MPEG4Writer::~MPEG4Writer() { Loading Loading @@ -1425,10 +1427,15 @@ status_t MPEG4Writer::Track::start(MetaData *params) { * session, and it also helps eliminate the "recording" sound for * camcorder applications. * * Ideally, this platform-specific value should be defined * in media_profiles.xml file * If client does not set the start time offset, we fall back to * use the default initial delay value. */ startTimeUs += kInitialDelayTimeUs; int64_t startTimeOffsetUs = mOwner->getStartTimeOffsetMs() * 1000LL; if (startTimeOffsetUs < 0) { // Start time offset was not set startTimeOffsetUs = kInitialDelayTimeUs; } startTimeUs += startTimeOffsetUs; LOGI("Start time offset: %lld us", startTimeOffsetUs); } meta->setInt64(kKeyTime, startTimeUs); Loading Loading @@ -2234,13 +2241,20 @@ void MPEG4Writer::Track::sendTrackSummary(bool hasMultipleTracks) { trackNum | MEDIA_RECORDER_TRACK_INFO_ENCODED_FRAMES, mNumSamples); { // The system delay time excluding the requested initial delay that // is used to eliminate the recording sound. int64_t startTimeOffsetUs = mOwner->getStartTimeOffsetMs() * 1000LL; if (startTimeOffsetUs < 0) { // Start time offset was not set startTimeOffsetUs = kInitialDelayTimeUs; } int64_t initialDelayUs = mFirstSampleTimeRealUs - mStartTimeRealUs - kInitialDelayTimeUs; mFirstSampleTimeRealUs - mStartTimeRealUs - startTimeOffsetUs; mOwner->notify(MEDIA_RECORDER_TRACK_EVENT_INFO, trackNum | MEDIA_RECORDER_TRACK_INFO_INITIAL_DELAY_MS, (initialDelayUs) / 1000); } if (hasMultipleTracks) { mOwner->notify(MEDIA_RECORDER_TRACK_EVENT_INFO, Loading Loading
include/media/stagefright/MPEG4Writer.h +3 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,8 @@ public: int32_t getTimeScale() const { return mTimeScale; } status_t setGeoData(int latitudex10000, int longitudex10000); void setStartTimeOffsetMs(int ms) { mStartTimeOffsetMs = ms; } int32_t getStartTimeOffsetMs() const { return mStartTimeOffsetMs; } protected: virtual ~MPEG4Writer(); Loading Loading @@ -84,6 +86,7 @@ private: int mLatitudex10000; int mLongitudex10000; bool mAreGeoTagsAvailable; int32_t mStartTimeOffsetMs; Mutex mLock; Loading
media/libmediaplayerservice/StagefrightRecorder.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -1453,6 +1453,12 @@ status_t StagefrightRecorder::setupMPEG4Recording( writer->setMaxFileSize(mMaxFileSizeBytes); } mStartTimeOffsetMs = mEncoderProfiles->getStartTimeOffsetMs(mCameraId); if (mStartTimeOffsetMs > 0) { reinterpret_cast<MPEG4Writer *>(writer.get())-> setStartTimeOffsetMs(mStartTimeOffsetMs); } writer->setListener(mListener); *mediaWriter = writer; return OK; Loading Loading @@ -1659,6 +1665,7 @@ status_t StagefrightRecorder::reset() { mAudioTimeScale = -1; mVideoTimeScale = -1; mCameraId = 0; mStartTimeOffsetMs = -1; mVideoEncoderProfile = -1; mVideoEncoderLevel = -1; mMaxFileDurationUs = 0; Loading Loading @@ -1747,6 +1754,8 @@ status_t StagefrightRecorder::dump( result.append(buffer); snprintf(buffer, SIZE, " Camera Id: %d\n", mCameraId); result.append(buffer); snprintf(buffer, SIZE, " Start time offset (ms): %d\n", mStartTimeOffsetMs); result.append(buffer); snprintf(buffer, SIZE, " Encoder: %d\n", mVideoEncoder); result.append(buffer); snprintf(buffer, SIZE, " Encoder profile: %d\n", mVideoEncoderProfile); Loading
media/libmediaplayerservice/StagefrightRecorder.h +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ private: int32_t mRotationDegrees; // Clockwise int32_t mLatitudex10000; int32_t mLongitudex10000; int32_t mStartTimeOffsetMs; bool mCaptureTimeLapse; int64_t mTimeBetweenTimeLapseFrameCaptureUs; Loading
media/libstagefright/MPEG4Writer.cpp +24 −10 Original line number Diff line number Diff line Loading @@ -260,7 +260,8 @@ MPEG4Writer::MPEG4Writer(const char *filename) mInterleaveDurationUs(1000000), mLatitudex10000(0), mLongitudex10000(0), mAreGeoTagsAvailable(false) { mAreGeoTagsAvailable(false), mStartTimeOffsetMs(-1) { mFd = open(filename, O_CREAT | O_LARGEFILE | O_TRUNC | O_RDWR); if (mFd >= 0) { Loading @@ -282,7 +283,8 @@ MPEG4Writer::MPEG4Writer(int fd) mInterleaveDurationUs(1000000), mLatitudex10000(0), mLongitudex10000(0), mAreGeoTagsAvailable(false) { mAreGeoTagsAvailable(false), mStartTimeOffsetMs(-1) { } MPEG4Writer::~MPEG4Writer() { Loading Loading @@ -1425,10 +1427,15 @@ status_t MPEG4Writer::Track::start(MetaData *params) { * session, and it also helps eliminate the "recording" sound for * camcorder applications. * * Ideally, this platform-specific value should be defined * in media_profiles.xml file * If client does not set the start time offset, we fall back to * use the default initial delay value. */ startTimeUs += kInitialDelayTimeUs; int64_t startTimeOffsetUs = mOwner->getStartTimeOffsetMs() * 1000LL; if (startTimeOffsetUs < 0) { // Start time offset was not set startTimeOffsetUs = kInitialDelayTimeUs; } startTimeUs += startTimeOffsetUs; LOGI("Start time offset: %lld us", startTimeOffsetUs); } meta->setInt64(kKeyTime, startTimeUs); Loading Loading @@ -2234,13 +2241,20 @@ void MPEG4Writer::Track::sendTrackSummary(bool hasMultipleTracks) { trackNum | MEDIA_RECORDER_TRACK_INFO_ENCODED_FRAMES, mNumSamples); { // The system delay time excluding the requested initial delay that // is used to eliminate the recording sound. int64_t startTimeOffsetUs = mOwner->getStartTimeOffsetMs() * 1000LL; if (startTimeOffsetUs < 0) { // Start time offset was not set startTimeOffsetUs = kInitialDelayTimeUs; } int64_t initialDelayUs = mFirstSampleTimeRealUs - mStartTimeRealUs - kInitialDelayTimeUs; mFirstSampleTimeRealUs - mStartTimeRealUs - startTimeOffsetUs; mOwner->notify(MEDIA_RECORDER_TRACK_EVENT_INFO, trackNum | MEDIA_RECORDER_TRACK_INFO_INITIAL_DELAY_MS, (initialDelayUs) / 1000); } if (hasMultipleTracks) { mOwner->notify(MEDIA_RECORDER_TRACK_EVENT_INFO, Loading