From 427887bc50ea2d9297f2710843a7c9b5c508f0fd Mon Sep 17 00:00:00 2001 From: Vasantha Balla Date: Tue, 22 Dec 2015 17:07:21 +0530 Subject: libstagefright:Fix random memcmp crash while accessing output format. Random memcmp crash happens while checking for image-data in output format of audio buffer.Audio output format gets updated with pcm-format flag after codec formatchange in ExtendedNuUtils. Simultaneous memory check happens for image-data in FBD of MediaCodec. So crash happens. Avoid checking for image-data and crop information for audio buffers. Change-Id: I85ffcb149dc67a0f1bdb26116245627b1843d932 --- media/libstagefright/MediaCodec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'media') diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 54c57ee..5e0ee55 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -2575,7 +2575,7 @@ ssize_t MediaCodec::dequeuePortBuffer(int32_t portIndex) { info->mOwnedByClient = true; // set image-data - if (info->mFormat != NULL) { + if (info->mFormat != NULL && mIsVideo) { sp imageData; if (info->mFormat->findBuffer("image-data", &imageData)) { info->mData->meta()->setBuffer("image-data", imageData); -- cgit v1.1 From 617daafc1cf7580b7d80ead8a7e21bb5cbf525cf Mon Sep 17 00:00:00 2001 From: Kim Zhang Date: Tue, 29 Dec 2015 14:50:52 +0800 Subject: StagefrightMetadataRetriever: correct the status flag In case of EOS or ERROR from source, correct the status flag and clear the input index to continue to wait for output buffer from decoder. This is to fix thumbnail generation failure for some clips with one frame. CRs-Fixed: 951250 Change-Id: If9889dbcc32bf49368add408a317da026879fec8 --- media/libstagefright/StagefrightMetadataRetriever.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'media') diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp index 5b96040..d39f34b 100644 --- a/media/libstagefright/StagefrightMetadataRetriever.cpp +++ b/media/libstagefright/StagefrightMetadataRetriever.cpp @@ -273,6 +273,9 @@ static VideoFrame *extractVideoFrame( if (err != OK) { ALOGW("Input Error or EOS"); haveMoreInputs = false; + //correct the status to continue to get output from decoder + err = OK; + inputIndex = -1; break; } -- cgit v1.1 From 9dae27c03dd73ca23c6aa778ed1423e4e133eb48 Mon Sep 17 00:00:00 2001 From: Santhosh Behara Date: Wed, 25 Nov 2015 19:27:22 +0530 Subject: ACodec: update native window crop rectangle In setupNativeWindowSizeFormatAndUsage, set the crop rectangle with the output port's crop value. Change-Id: I415be069d02d88dcd6b7c2460dda6df191ee7434 --- media/libstagefright/ACodec.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'media') diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index ad4676f..3a08078 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -925,7 +925,7 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage( #endif ALOGV("gralloc usage: %#x(OMX) => %#x(ACodec)", omxUsage, usage); - return setNativeWindowSizeFormatAndUsage( + err = setNativeWindowSizeFormatAndUsage( nativeWindow, def.format.video.nFrameWidth, def.format.video.nFrameHeight, @@ -936,6 +936,24 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage( #endif mRotationDegrees, usage); + if (err == OK) { + OMX_CONFIG_RECTTYPE rect; + InitOMXParams(&rect); + rect.nPortIndex = kPortIndexOutput; + err = mOMX->getConfig( + mNode, OMX_IndexConfigCommonOutputCrop, &rect, sizeof(rect)); + if (err == OK) { + ALOGV("rect size = %d, %d, %d, %d", rect.nLeft, rect.nTop, rect.nWidth, rect.nHeight); + android_native_rect_t crop; + crop.left = rect.nLeft; + crop.top = rect.nTop; + crop.right = rect.nLeft + rect.nWidth - 1; + crop.bottom = rect.nTop + rect.nHeight - 1; + ALOGV("crop update (%d, %d), (%d, %d)", crop.left, crop.top, crop.right, crop.bottom); + err = native_window_set_crop(nativeWindow, &crop); + } + } + return err; } status_t ACodec::configureOutputBuffersFromNativeWindow( -- cgit v1.1 From 4486f97b6652b6b111a809827355b6ce5bf9c21e Mon Sep 17 00:00:00 2001 From: Weiyin Jiang Date: Wed, 6 Jan 2016 15:49:06 +0800 Subject: nuplayer: looping playback only if it was running Audio buffer filling in renderer is still happening, though pause was issued. As a result, EOS was reported irrespective of renderer state. If nuplayer driver receives playback complete after stopped, it will again be activated, which appears stop is not taking effect. Add a check for driver state to allow looping only if it was in running state. Change-Id: Ic9f8eac635a774cd805b3978fab640d73ae35744 CRs-Fixed: 958311 --- media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'media') diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp index 7c71e4e..4383fce 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp @@ -750,12 +750,19 @@ void NuPlayerDriver::notifyListener_l( } } if (mLooping || mAutoLoop) { - mPlayer->seekToAsync(0); - if (mAudioSink != NULL) { - // The renderer has stopped the sink at the end in order to play out - // the last little bit of audio. If we're looping, we need to restart it. - mAudioSink->start(); + if (mState == STATE_RUNNING) { + mPlayer->seekToAsync(0); + if (mAudioSink != NULL) { + // The renderer has stopped the sink at the end in order to play out + // the last little bit of audio. If we're looping, we need to restart it. + mAudioSink->start(); + } + } else { + mPlayer->pause(); + mState = STATE_PAUSED; + mAtEOS = true; } + // don't send completion event when looping return; } -- cgit v1.1 From e80385c9252ba5a2619378bed0bcb34d17506ba1 Mon Sep 17 00:00:00 2001 From: Preetam Singh Ranawat Date: Mon, 21 Dec 2015 16:39:11 +0530 Subject: audio: Update anchor time for offload playback post resume -AV sync is lost after multiple pasue/resume operatins. -Renderer does not update anchor time post resume and it may lead to AV sync loss after multiple pause/resume in offload playback case. -Get renderer position and update anchor time post resume for offload audio Change-Id: I2d9ba21c0e9b193ec77213de12229407cbf8dfd6 --- media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'media') diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp index d959e62..2336eb7 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp @@ -1590,6 +1590,13 @@ void NuPlayer::Renderer::onResume() { ALOGD("received error :%d on resume for offload track posting TEAR_DOWN event",status); notifyAudioTearDown(); } + //Update anchor time after resuming playback. + if (offloadingAudio()) { + int64_t nowUs = ALooper::GetNowUs(); + int64_t nowMediaUs = + mAudioFirstAnchorTimeMediaUs + getPlayedOutAudioDurationUs(nowUs); + mMediaClock->updateAnchor(nowMediaUs, nowUs, INT64_MAX); + } } { -- cgit v1.1 From 7c1e4d782fec07f5b0273b7a443b6cee76357ea2 Mon Sep 17 00:00:00 2001 From: "Christopher R. Palmer" Date: Wed, 20 Jan 2016 20:31:42 -0500 Subject: av: "ACodec: update native window crop rectangle" depends on QCOM Change-Id: If0cc81468ab7ee8fa0ec374a9f23e4004e7cb212 --- media/libstagefright/ACodec.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'media') diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 3a08078..4807b65 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -936,6 +936,7 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage( #endif mRotationDegrees, usage); +#ifdef QCOM_HARDWARE if (err == OK) { OMX_CONFIG_RECTTYPE rect; InitOMXParams(&rect); @@ -953,6 +954,7 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage( err = native_window_set_crop(nativeWindow, &crop); } } +#endif return err; } -- cgit v1.1 From df1c503b9dac70cd9b1c433215eea7661b5925da Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Thu, 14 Jan 2016 11:36:26 -0800 Subject: Revert "Stagefright: Allow setting high-framerates in CameraSource" This reverts commit b5ccf81c19a7e9ce9b330abe734f1bae76d50796. That patch breaks "High Speed 60 FPS" and it fails in CameraSource::checkFrameRate which it compares the preview frame rate: Failed to set preview frame rate to 30 fps. The actual frame rate is 60. SAMBAR-1261 Change-Id: I6adf1432bf901e8ba37b1b86621e117e77cbf853 --- media/libstagefright/CameraSource.cpp | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'media') diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index 4ee878a..e2ad924 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -325,12 +325,6 @@ status_t CameraSource::isCameraColorFormatSupported( return OK; } -static int32_t getHighSpeedFrameRate(const CameraParameters& params) { - const char* hsr = params.get("video-hsr"); - int32_t rate = (hsr != NULL && strncmp(hsr, "off", 3)) ? atoi(hsr) : 0; - return rate > 240 ? 240 : rate; -} - /* * Configure the camera to use the requested video size * (width and height) and/or frame rate. If both width and @@ -383,10 +377,6 @@ status_t CameraSource::configureCamera( params->get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES); CHECK(supportedFrameRates != NULL); ALOGV("Supported frame rates: %s", supportedFrameRates); - if (getHighSpeedFrameRate(*params)) { - ALOGI("Use default 30fps for HighSpeed %dfps", frameRate); - frameRate = 30; - } char buf[4]; snprintf(buf, 4, "%d", frameRate); if (strstr(supportedFrameRates, buf) == NULL) { @@ -488,8 +478,6 @@ status_t CameraSource::checkFrameRate( ALOGE("Failed to retrieve preview frame rate (%d)", frameRateActual); return UNKNOWN_ERROR; } - int32_t highSpeedRate = getHighSpeedFrameRate(params); - frameRateActual = highSpeedRate ? highSpeedRate : frameRateActual; // Check the actual video frame rate against the target/requested // video frame rate. -- cgit v1.1 From dfcb22072eca593be848b762e49d4f7ab74bba13 Mon Sep 17 00:00:00 2001 From: Diogo Ferreira Date: Fri, 22 Jan 2016 14:42:31 +0000 Subject: AVUtils: hevc: Return 0 when codec data is malformed This was returning ERROR_MALFORMED, which is a negative value, since the function prototype returns size_t, it would be converted to somewhere near 2**32 and would never fall into the actual error checking clause in AVUtils::HEVCMuxer::makeHEVCCodecSpecificData. Fixes android.mediastress.cts.HEVCR1080pAacLongPlayerTest#testPlay00 Ticket: CYNGNOS-1683 Change-Id: I13e6a76cb0ee4a6b730e1eb1023320b74a0539c7 --- media/libavextensions/stagefright/AVUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'media') diff --git a/media/libavextensions/stagefright/AVUtils.cpp b/media/libavextensions/stagefright/AVUtils.cpp index bdf5eb6..413026b 100644 --- a/media/libavextensions/stagefright/AVUtils.cpp +++ b/media/libavextensions/stagefright/AVUtils.cpp @@ -448,7 +448,7 @@ status_t AVUtils::HEVCMuxer::makeHEVCCodecSpecificData( List picParamSets; if ((*codecSpecificDataSize = parseHEVCCodecSpecificData(data, size, - vidParamSets, seqParamSets, picParamSets)) <= 0) { + vidParamSets, seqParamSets, picParamSets)) == 0) { ALOGE("cannot parser codec specific data, bailing out"); return ERROR_MALFORMED; } @@ -885,12 +885,12 @@ size_t AVUtils::HEVCMuxer::parseHEVCCodecSpecificData( } } else { ALOGE("Only VPS, SPS and PPS Nal units are expected"); - return ERROR_MALFORMED; + return 0; } if (nextStartCode == NULL) { ALOGE("Next start code is NULL"); - return ERROR_MALFORMED; + return 0; } // Move on to find the next parameter set -- cgit v1.1 From 214a19495ddd3d837f72ed1ee49c36d50d55fe5d Mon Sep 17 00:00:00 2001 From: Karthik Reddy Katta Date: Tue, 3 Nov 2015 16:14:27 +0530 Subject: libmedia: Add support for LHR tones Add tones to the ToneGenerator that are to be used for Local Hold Recall. Change-Id: I92cc1d63a3f6d38fc224774909b5b27d58be969c --- media/libmedia/ToneGenerator.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'media') diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp index d738ea7..af75e0f 100644 --- a/media/libmedia/ToneGenerator.cpp +++ b/media/libmedia/ToneGenerator.cpp @@ -698,7 +698,11 @@ const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = { { .segments = { { .duration = 0, .waveFreq = { 0 }, 0, 0 }}, .repeatCnt = 0, .repeatSegment = 0 }, // TONE_CDMA_SIGNAL_OFF - + { .segments = { { .duration = 15000, .waveFreq = { 0 }, 0, 0 }, + { .duration = 500, .waveFreq = { 450, 0 }, 0, 0 }, + { .duration = 0 , .waveFreq = { 0 }, 0, 0}}, + .repeatCnt = ToneGenerator::TONEGEN_INF, + .repeatSegment = 0 }, // TONE_HOLD_RECALL { .segments = { { .duration = ToneGenerator::TONEGEN_INF, .waveFreq = { 350, 440, 0 }, 0, 0 }, { .duration = 0 , .waveFreq = { 0 }, 0, 0}}, .repeatCnt = ToneGenerator::TONEGEN_INF, -- cgit v1.1