Loading apex/testing/test_manifest.json +1 −1 Original line number Original line Diff line number Diff line { { "name": "com.android.media", "name": "com.android.media", "version": 300000000 "version": 2147483647 } } media/codec2/components/aac/C2SoftAacEnc.cpp +25 −3 Original line number Original line Diff line number Diff line Loading @@ -293,6 +293,30 @@ status_t C2SoftAacEnc::setAudioParams() { return OK; return OK; } } static void MaybeLogTimestampWarning( long long lastFrameEndTimestampUs, long long inputTimestampUs) { using Clock = std::chrono::steady_clock; thread_local Clock::time_point sLastLogTimestamp{}; thread_local int32_t sOverlapCount = -1; if (Clock::now() - sLastLogTimestamp > std::chrono::minutes(1) || sOverlapCount < 0) { AString countMessage = ""; if (sOverlapCount > 0) { countMessage = AStringPrintf( "(%d overlapping timestamp detected since last log)", sOverlapCount); } ALOGI("Correcting overlapping timestamp: last frame ended at %lldus but " "current frame is starting at %lldus. Using the last frame's end timestamp %s", lastFrameEndTimestampUs, inputTimestampUs, countMessage.c_str()); sLastLogTimestamp = Clock::now(); sOverlapCount = 0; } else { ALOGV("Correcting overlapping timestamp: last frame ended at %lldus but " "current frame is starting at %lldus. Using the last frame's end timestamp", lastFrameEndTimestampUs, inputTimestampUs); ++sOverlapCount; } } void C2SoftAacEnc::process( void C2SoftAacEnc::process( const std::unique_ptr<C2Work> &work, const std::unique_ptr<C2Work> &work, const std::shared_ptr<C2BlockPool> &pool) { const std::shared_ptr<C2BlockPool> &pool) { Loading Loading @@ -366,9 +390,7 @@ void C2SoftAacEnc::process( } } c2_cntr64_t inputTimestampUs = work->input.ordinal.timestamp; c2_cntr64_t inputTimestampUs = work->input.ordinal.timestamp; if (inputTimestampUs < mLastFrameEndTimestampUs.value_or(inputTimestampUs)) { if (inputTimestampUs < mLastFrameEndTimestampUs.value_or(inputTimestampUs)) { ALOGW("Correcting overlapping timestamp: last frame ended at %lldus but " MaybeLogTimestampWarning(mLastFrameEndTimestampUs->peekll(), inputTimestampUs.peekll()); "current frame is starting at %lldus. Using the last frame's end timestamp", mLastFrameEndTimestampUs->peekll(), inputTimestampUs.peekll()); inputTimestampUs = *mLastFrameEndTimestampUs; inputTimestampUs = *mLastFrameEndTimestampUs; } } if (capacity > 0) { if (capacity > 0) { Loading media/libstagefright/MPEG4Writer.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -566,7 +566,7 @@ void MPEG4Writer::initInternal(int fd, bool isFirstSession) { release(); release(); } } if (fallocate(mFd, FALLOC_FL_KEEP_SIZE, 0, 1) == 0) { if (fallocate64(mFd, FALLOC_FL_KEEP_SIZE, 0, 1) == 0) { ALOGD("PreAllocation enabled"); ALOGD("PreAllocation enabled"); mPreAllocationEnabled = true; mPreAllocationEnabled = true; } else { } else { Loading Loading @@ -1862,7 +1862,7 @@ bool MPEG4Writer::preAllocate(uint64_t wantSize) { ALOGV("preAllocateSize :%" PRIu64 " lastFileEndOffset:%" PRIu64, preAllocateSize, ALOGV("preAllocateSize :%" PRIu64 " lastFileEndOffset:%" PRIu64, preAllocateSize, lastFileEndOffset); lastFileEndOffset); int res = fallocate(mFd, FALLOC_FL_KEEP_SIZE, lastFileEndOffset, preAllocateSize); int res = fallocate64(mFd, FALLOC_FL_KEEP_SIZE, lastFileEndOffset, preAllocateSize); if (res == -1) { if (res == -1) { ALOGE("fallocate err:%s, %d, fd:%d", strerror(errno), errno, mFd); ALOGE("fallocate err:%s, %d, fd:%d", strerror(errno), errno, mFd); sp<AMessage> msg = new AMessage(kWhatFallocateError, mReflector); sp<AMessage> msg = new AMessage(kWhatFallocateError, mReflector); Loading @@ -1889,7 +1889,7 @@ bool MPEG4Writer::truncatePreAllocation() { ALOGD("ftruncate mPreAllocateFileEndOffset:%" PRId64 " mOffset:%" PRIu64 ALOGD("ftruncate mPreAllocateFileEndOffset:%" PRId64 " mOffset:%" PRIu64 " mMdatEndOffset:%" PRIu64 " diff:%" PRId64, mPreAllocateFileEndOffset, mOffset, " mMdatEndOffset:%" PRIu64 " diff:%" PRId64, mPreAllocateFileEndOffset, mOffset, mMdatEndOffset, mPreAllocateFileEndOffset - endOffset); mMdatEndOffset, mPreAllocateFileEndOffset - endOffset); if(ftruncate(mFd, endOffset) == -1) { if (ftruncate64(mFd, endOffset) == -1) { ALOGE("ftruncate err:%s, %d, fd:%d", strerror(errno), errno, mFd); ALOGE("ftruncate err:%s, %d, fd:%d", strerror(errno), errno, mFd); status = false; status = false; /* No need to post and handle(stop & notify client) error like it's done in preAllocate(), /* No need to post and handle(stop & notify client) error like it's done in preAllocate(), Loading services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp +8 −2 Original line number Original line Diff line number Diff line Loading @@ -690,7 +690,9 @@ bool SwAudioOutputCollection::isActiveLocally(VolumeSource volumeSource, uint32_ const sp<SwAudioOutputDescriptor> outputDesc = this->valueAt(i); const sp<SwAudioOutputDescriptor> outputDesc = this->valueAt(i); if (outputDesc->isActive(volumeSource, inPastMs, sysTime) if (outputDesc->isActive(volumeSource, inPastMs, sysTime) && (!(outputDesc->devices() && (!(outputDesc->devices() .containsDeviceAmongTypes(getAllOutRemoteDevices())))) { .containsDeviceAmongTypes(getAllOutRemoteDevices()) || outputDesc->devices() .onlyContainsDevicesWithType(AUDIO_DEVICE_OUT_TELEPHONY_TX)))) { return true; return true; } } } } Loading Loading @@ -722,9 +724,13 @@ bool SwAudioOutputCollection::isStrategyActiveOnSameModule(product_strategy_t ps const sp<SwAudioOutputDescriptor> otherDesc = valueAt(i); const sp<SwAudioOutputDescriptor> otherDesc = valueAt(i); if (desc->sharesHwModuleWith(otherDesc) && if (desc->sharesHwModuleWith(otherDesc) && otherDesc->isStrategyActive(ps, inPastMs, sysTime)) { otherDesc->isStrategyActive(ps, inPastMs, sysTime)) { if (desc == otherDesc || !otherDesc->devices() .onlyContainsDevicesWithType(AUDIO_DEVICE_OUT_TELEPHONY_TX)) { return true; return true; } } } } } return false; return false; } } Loading Loading
apex/testing/test_manifest.json +1 −1 Original line number Original line Diff line number Diff line { { "name": "com.android.media", "name": "com.android.media", "version": 300000000 "version": 2147483647 } }
media/codec2/components/aac/C2SoftAacEnc.cpp +25 −3 Original line number Original line Diff line number Diff line Loading @@ -293,6 +293,30 @@ status_t C2SoftAacEnc::setAudioParams() { return OK; return OK; } } static void MaybeLogTimestampWarning( long long lastFrameEndTimestampUs, long long inputTimestampUs) { using Clock = std::chrono::steady_clock; thread_local Clock::time_point sLastLogTimestamp{}; thread_local int32_t sOverlapCount = -1; if (Clock::now() - sLastLogTimestamp > std::chrono::minutes(1) || sOverlapCount < 0) { AString countMessage = ""; if (sOverlapCount > 0) { countMessage = AStringPrintf( "(%d overlapping timestamp detected since last log)", sOverlapCount); } ALOGI("Correcting overlapping timestamp: last frame ended at %lldus but " "current frame is starting at %lldus. Using the last frame's end timestamp %s", lastFrameEndTimestampUs, inputTimestampUs, countMessage.c_str()); sLastLogTimestamp = Clock::now(); sOverlapCount = 0; } else { ALOGV("Correcting overlapping timestamp: last frame ended at %lldus but " "current frame is starting at %lldus. Using the last frame's end timestamp", lastFrameEndTimestampUs, inputTimestampUs); ++sOverlapCount; } } void C2SoftAacEnc::process( void C2SoftAacEnc::process( const std::unique_ptr<C2Work> &work, const std::unique_ptr<C2Work> &work, const std::shared_ptr<C2BlockPool> &pool) { const std::shared_ptr<C2BlockPool> &pool) { Loading Loading @@ -366,9 +390,7 @@ void C2SoftAacEnc::process( } } c2_cntr64_t inputTimestampUs = work->input.ordinal.timestamp; c2_cntr64_t inputTimestampUs = work->input.ordinal.timestamp; if (inputTimestampUs < mLastFrameEndTimestampUs.value_or(inputTimestampUs)) { if (inputTimestampUs < mLastFrameEndTimestampUs.value_or(inputTimestampUs)) { ALOGW("Correcting overlapping timestamp: last frame ended at %lldus but " MaybeLogTimestampWarning(mLastFrameEndTimestampUs->peekll(), inputTimestampUs.peekll()); "current frame is starting at %lldus. Using the last frame's end timestamp", mLastFrameEndTimestampUs->peekll(), inputTimestampUs.peekll()); inputTimestampUs = *mLastFrameEndTimestampUs; inputTimestampUs = *mLastFrameEndTimestampUs; } } if (capacity > 0) { if (capacity > 0) { Loading
media/libstagefright/MPEG4Writer.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -566,7 +566,7 @@ void MPEG4Writer::initInternal(int fd, bool isFirstSession) { release(); release(); } } if (fallocate(mFd, FALLOC_FL_KEEP_SIZE, 0, 1) == 0) { if (fallocate64(mFd, FALLOC_FL_KEEP_SIZE, 0, 1) == 0) { ALOGD("PreAllocation enabled"); ALOGD("PreAllocation enabled"); mPreAllocationEnabled = true; mPreAllocationEnabled = true; } else { } else { Loading Loading @@ -1862,7 +1862,7 @@ bool MPEG4Writer::preAllocate(uint64_t wantSize) { ALOGV("preAllocateSize :%" PRIu64 " lastFileEndOffset:%" PRIu64, preAllocateSize, ALOGV("preAllocateSize :%" PRIu64 " lastFileEndOffset:%" PRIu64, preAllocateSize, lastFileEndOffset); lastFileEndOffset); int res = fallocate(mFd, FALLOC_FL_KEEP_SIZE, lastFileEndOffset, preAllocateSize); int res = fallocate64(mFd, FALLOC_FL_KEEP_SIZE, lastFileEndOffset, preAllocateSize); if (res == -1) { if (res == -1) { ALOGE("fallocate err:%s, %d, fd:%d", strerror(errno), errno, mFd); ALOGE("fallocate err:%s, %d, fd:%d", strerror(errno), errno, mFd); sp<AMessage> msg = new AMessage(kWhatFallocateError, mReflector); sp<AMessage> msg = new AMessage(kWhatFallocateError, mReflector); Loading @@ -1889,7 +1889,7 @@ bool MPEG4Writer::truncatePreAllocation() { ALOGD("ftruncate mPreAllocateFileEndOffset:%" PRId64 " mOffset:%" PRIu64 ALOGD("ftruncate mPreAllocateFileEndOffset:%" PRId64 " mOffset:%" PRIu64 " mMdatEndOffset:%" PRIu64 " diff:%" PRId64, mPreAllocateFileEndOffset, mOffset, " mMdatEndOffset:%" PRIu64 " diff:%" PRId64, mPreAllocateFileEndOffset, mOffset, mMdatEndOffset, mPreAllocateFileEndOffset - endOffset); mMdatEndOffset, mPreAllocateFileEndOffset - endOffset); if(ftruncate(mFd, endOffset) == -1) { if (ftruncate64(mFd, endOffset) == -1) { ALOGE("ftruncate err:%s, %d, fd:%d", strerror(errno), errno, mFd); ALOGE("ftruncate err:%s, %d, fd:%d", strerror(errno), errno, mFd); status = false; status = false; /* No need to post and handle(stop & notify client) error like it's done in preAllocate(), /* No need to post and handle(stop & notify client) error like it's done in preAllocate(), Loading
services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp +8 −2 Original line number Original line Diff line number Diff line Loading @@ -690,7 +690,9 @@ bool SwAudioOutputCollection::isActiveLocally(VolumeSource volumeSource, uint32_ const sp<SwAudioOutputDescriptor> outputDesc = this->valueAt(i); const sp<SwAudioOutputDescriptor> outputDesc = this->valueAt(i); if (outputDesc->isActive(volumeSource, inPastMs, sysTime) if (outputDesc->isActive(volumeSource, inPastMs, sysTime) && (!(outputDesc->devices() && (!(outputDesc->devices() .containsDeviceAmongTypes(getAllOutRemoteDevices())))) { .containsDeviceAmongTypes(getAllOutRemoteDevices()) || outputDesc->devices() .onlyContainsDevicesWithType(AUDIO_DEVICE_OUT_TELEPHONY_TX)))) { return true; return true; } } } } Loading Loading @@ -722,9 +724,13 @@ bool SwAudioOutputCollection::isStrategyActiveOnSameModule(product_strategy_t ps const sp<SwAudioOutputDescriptor> otherDesc = valueAt(i); const sp<SwAudioOutputDescriptor> otherDesc = valueAt(i); if (desc->sharesHwModuleWith(otherDesc) && if (desc->sharesHwModuleWith(otherDesc) && otherDesc->isStrategyActive(ps, inPastMs, sysTime)) { otherDesc->isStrategyActive(ps, inPastMs, sysTime)) { if (desc == otherDesc || !otherDesc->devices() .onlyContainsDevicesWithType(AUDIO_DEVICE_OUT_TELEPHONY_TX)) { return true; return true; } } } } } return false; return false; } } Loading