Loading media/libeffects/visualizer/EffectVisualizer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ void Visualizer_reset(VisualizerContext *pContext) { pContext->mCaptureIdx = 0; pContext->mCurrentBuf = 0; memset(pContext->mCaptureBuf[0], 0, VISUALIZER_CAPTURE_SIZE_MAX); memset(pContext->mCaptureBuf[1], 0, VISUALIZER_CAPTURE_SIZE_MAX); memset(pContext->mCaptureBuf[0], 0x80, VISUALIZER_CAPTURE_SIZE_MAX); memset(pContext->mCaptureBuf[1], 0x80, VISUALIZER_CAPTURE_SIZE_MAX); } //---------------------------------------------------------------------------- Loading media/libmedia/AudioEffect.cpp +17 −9 Original line number Diff line number Diff line Loading @@ -228,24 +228,32 @@ status_t AudioEffect::command(uint32_t cmdCode, void *replyData) { if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) { LOGV("command() bad status %d", mStatus); return INVALID_OPERATION; } if ((cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) && (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL)) { return BAD_VALUE; } status_t status = mIEffect->command(cmdCode, cmdSize, cmdData, replySize, replyData); if (status != NO_ERROR) { return status; } if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { status = *(status_t *)replyData; if (status != NO_ERROR) { return status; } if (cmdCode == EFFECT_CMD_ENABLE) { android_atomic_or(1, &mEnabled); } if (cmdCode == EFFECT_CMD_DISABLE) { } else { android_atomic_and(~1, &mEnabled); } } return status; } Loading media/libmedia/Visualizer.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -169,11 +169,13 @@ status_t Visualizer::getWaveForm(uint8_t *waveform) status_t status = NO_ERROR; if (mEnabled) { uint32_t replySize = mCaptureSize; status_t status = command(VISU_CMD_CAPTURE, 0, NULL, &replySize, waveform); status = command(VISU_CMD_CAPTURE, 0, NULL, &replySize, waveform); LOGV("getWaveForm() command returned %d", status); if (replySize == 0) { status = NOT_ENOUGH_DATA; } } else { LOGV("getWaveForm() disabled"); memset(waveform, 0x80, mCaptureSize); } return status; Loading @@ -191,7 +193,7 @@ status_t Visualizer::getFft(uint8_t *fft) status_t status = NO_ERROR; if (mEnabled) { uint8_t buf[mCaptureSize]; status_t status = getWaveForm(buf); status = getWaveForm(buf); if (status == NO_ERROR) { status = doFft(fft, buf); } Loading media/libstagefright/MPEG4Writer.cpp +36 −3 Original line number Diff line number Diff line Loading @@ -1541,20 +1541,52 @@ status_t MPEG4Writer::Track::threadEntry() { int32_t isSync = false; meta_data->findInt32(kKeyIsSyncFrame, &isSync); /* * The original timestamp found in the data buffer will be modified as below: * * There is a playback offset into this track if the track's start time * is not the same as the movie start time, which will be recorded in edst * box of the output file. The playback offset is to make sure that the * starting time of the audio/video tracks are synchronized. Although the * track's media timestamp may be subject to various modifications * as outlined below, the track's playback offset time remains unchanged * once the first data buffer of the track is received. * * The media time stamp will be calculated by subtracting the playback offset * (and potential pause durations) from the original timestamp in the buffer. * * If this track is a video track for a real-time recording application with * both audio and video tracks, its media timestamp will subject to further * modification based on the media clock of the audio track. This modification * is needed for the purpose of maintaining good audio/video synchronization. * * If the recording session is paused and resumed multiple times, the track * media timestamp will be modified as if the recording session had never been * paused at all during playback of the recorded output file. In other words, * the output file will have no memory of pause/resume durations. * */ CHECK(meta_data->findInt64(kKeyTime, ×tampUs)); LOGV("%s timestampUs: %lld", mIsAudio? "Audio": "Video", timestampUs); //////////////////////////////////////////////////////////////////////////////// if (mSampleSizes.empty()) { mStartTimestampUs = timestampUs; mOwner->setStartTimestampUs(mStartTimestampUs); previousPausedDurationUs = mStartTimestampUs; } if (mResumed) { previousPausedDurationUs += (timestampUs - mTrackDurationUs - lastDurationUs); int64_t durExcludingEarlierPausesUs = timestampUs - previousPausedDurationUs; CHECK(durExcludingEarlierPausesUs >= 0); int64_t pausedDurationUs = durExcludingEarlierPausesUs - mTrackDurationUs; CHECK(pausedDurationUs >= lastDurationUs); previousPausedDurationUs += pausedDurationUs - lastDurationUs; mResumed = false; } timestampUs -= previousPausedDurationUs; CHECK(timestampUs >= 0); if (mIsRealTimeRecording && !mIsAudio) { // The minor adjustment on the timestamp is heuristic/experimental // We are adjusting the timestamp to reduce the fluctuation of the duration Loading Loading @@ -1590,8 +1622,8 @@ status_t MPEG4Writer::Track::threadEntry() { } } LOGV("time stamp: %lld and previous paused duration %lld", timestampUs, previousPausedDurationUs); LOGV("%s media time stamp: %lld and previous paused duration %lld", mIsAudio? "Audio": "Video", timestampUs, previousPausedDurationUs); if (timestampUs > mTrackDurationUs) { mTrackDurationUs = timestampUs; } Loading Loading @@ -1873,6 +1905,7 @@ void MPEG4Writer::Track::writeTrackHeader( // First elst entry: specify the starting time offset int64_t offsetUs = mStartTimestampUs - moovStartTimeUs; LOGV("OffsetUs: %lld", offsetUs); int32_t seg = (offsetUs * mvhdTimeScale + 5E5) / 1E6; mOwner->writeInt32(seg); // in mvhd timecale mOwner->writeInt32(-1); // starting time offset Loading media/libstagefright/NuHTTPDataSource.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -96,6 +96,11 @@ status_t NuHTTPDataSource::connect( return connect(host, port, path, headers, offset); } static bool IsRedirectStatusCode(int httpStatus) { return httpStatus == 301 || httpStatus == 302 || httpStatus == 303 || httpStatus == 307; } status_t NuHTTPDataSource::connect( const char *host, unsigned port, const char *path, const String8 &headers, Loading Loading @@ -161,7 +166,7 @@ status_t NuHTTPDataSource::connect( return err; } if (httpStatus == 302) { if (IsRedirectStatusCode(httpStatus)) { string value; CHECK(mHTTP.find_header_value("Location", &value)); Loading Loading
media/libeffects/visualizer/EffectVisualizer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ void Visualizer_reset(VisualizerContext *pContext) { pContext->mCaptureIdx = 0; pContext->mCurrentBuf = 0; memset(pContext->mCaptureBuf[0], 0, VISUALIZER_CAPTURE_SIZE_MAX); memset(pContext->mCaptureBuf[1], 0, VISUALIZER_CAPTURE_SIZE_MAX); memset(pContext->mCaptureBuf[0], 0x80, VISUALIZER_CAPTURE_SIZE_MAX); memset(pContext->mCaptureBuf[1], 0x80, VISUALIZER_CAPTURE_SIZE_MAX); } //---------------------------------------------------------------------------- Loading
media/libmedia/AudioEffect.cpp +17 −9 Original line number Diff line number Diff line Loading @@ -228,24 +228,32 @@ status_t AudioEffect::command(uint32_t cmdCode, void *replyData) { if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) { LOGV("command() bad status %d", mStatus); return INVALID_OPERATION; } if ((cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) && (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL)) { return BAD_VALUE; } status_t status = mIEffect->command(cmdCode, cmdSize, cmdData, replySize, replyData); if (status != NO_ERROR) { return status; } if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { status = *(status_t *)replyData; if (status != NO_ERROR) { return status; } if (cmdCode == EFFECT_CMD_ENABLE) { android_atomic_or(1, &mEnabled); } if (cmdCode == EFFECT_CMD_DISABLE) { } else { android_atomic_and(~1, &mEnabled); } } return status; } Loading
media/libmedia/Visualizer.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -169,11 +169,13 @@ status_t Visualizer::getWaveForm(uint8_t *waveform) status_t status = NO_ERROR; if (mEnabled) { uint32_t replySize = mCaptureSize; status_t status = command(VISU_CMD_CAPTURE, 0, NULL, &replySize, waveform); status = command(VISU_CMD_CAPTURE, 0, NULL, &replySize, waveform); LOGV("getWaveForm() command returned %d", status); if (replySize == 0) { status = NOT_ENOUGH_DATA; } } else { LOGV("getWaveForm() disabled"); memset(waveform, 0x80, mCaptureSize); } return status; Loading @@ -191,7 +193,7 @@ status_t Visualizer::getFft(uint8_t *fft) status_t status = NO_ERROR; if (mEnabled) { uint8_t buf[mCaptureSize]; status_t status = getWaveForm(buf); status = getWaveForm(buf); if (status == NO_ERROR) { status = doFft(fft, buf); } Loading
media/libstagefright/MPEG4Writer.cpp +36 −3 Original line number Diff line number Diff line Loading @@ -1541,20 +1541,52 @@ status_t MPEG4Writer::Track::threadEntry() { int32_t isSync = false; meta_data->findInt32(kKeyIsSyncFrame, &isSync); /* * The original timestamp found in the data buffer will be modified as below: * * There is a playback offset into this track if the track's start time * is not the same as the movie start time, which will be recorded in edst * box of the output file. The playback offset is to make sure that the * starting time of the audio/video tracks are synchronized. Although the * track's media timestamp may be subject to various modifications * as outlined below, the track's playback offset time remains unchanged * once the first data buffer of the track is received. * * The media time stamp will be calculated by subtracting the playback offset * (and potential pause durations) from the original timestamp in the buffer. * * If this track is a video track for a real-time recording application with * both audio and video tracks, its media timestamp will subject to further * modification based on the media clock of the audio track. This modification * is needed for the purpose of maintaining good audio/video synchronization. * * If the recording session is paused and resumed multiple times, the track * media timestamp will be modified as if the recording session had never been * paused at all during playback of the recorded output file. In other words, * the output file will have no memory of pause/resume durations. * */ CHECK(meta_data->findInt64(kKeyTime, ×tampUs)); LOGV("%s timestampUs: %lld", mIsAudio? "Audio": "Video", timestampUs); //////////////////////////////////////////////////////////////////////////////// if (mSampleSizes.empty()) { mStartTimestampUs = timestampUs; mOwner->setStartTimestampUs(mStartTimestampUs); previousPausedDurationUs = mStartTimestampUs; } if (mResumed) { previousPausedDurationUs += (timestampUs - mTrackDurationUs - lastDurationUs); int64_t durExcludingEarlierPausesUs = timestampUs - previousPausedDurationUs; CHECK(durExcludingEarlierPausesUs >= 0); int64_t pausedDurationUs = durExcludingEarlierPausesUs - mTrackDurationUs; CHECK(pausedDurationUs >= lastDurationUs); previousPausedDurationUs += pausedDurationUs - lastDurationUs; mResumed = false; } timestampUs -= previousPausedDurationUs; CHECK(timestampUs >= 0); if (mIsRealTimeRecording && !mIsAudio) { // The minor adjustment on the timestamp is heuristic/experimental // We are adjusting the timestamp to reduce the fluctuation of the duration Loading Loading @@ -1590,8 +1622,8 @@ status_t MPEG4Writer::Track::threadEntry() { } } LOGV("time stamp: %lld and previous paused duration %lld", timestampUs, previousPausedDurationUs); LOGV("%s media time stamp: %lld and previous paused duration %lld", mIsAudio? "Audio": "Video", timestampUs, previousPausedDurationUs); if (timestampUs > mTrackDurationUs) { mTrackDurationUs = timestampUs; } Loading Loading @@ -1873,6 +1905,7 @@ void MPEG4Writer::Track::writeTrackHeader( // First elst entry: specify the starting time offset int64_t offsetUs = mStartTimestampUs - moovStartTimeUs; LOGV("OffsetUs: %lld", offsetUs); int32_t seg = (offsetUs * mvhdTimeScale + 5E5) / 1E6; mOwner->writeInt32(seg); // in mvhd timecale mOwner->writeInt32(-1); // starting time offset Loading
media/libstagefright/NuHTTPDataSource.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -96,6 +96,11 @@ status_t NuHTTPDataSource::connect( return connect(host, port, path, headers, offset); } static bool IsRedirectStatusCode(int httpStatus) { return httpStatus == 301 || httpStatus == 302 || httpStatus == 303 || httpStatus == 307; } status_t NuHTTPDataSource::connect( const char *host, unsigned port, const char *path, const String8 &headers, Loading Loading @@ -161,7 +166,7 @@ status_t NuHTTPDataSource::connect( return err; } if (httpStatus == 302) { if (IsRedirectStatusCode(httpStatus)) { string value; CHECK(mHTTP.find_header_value("Location", &value)); Loading