summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2014-01-06 18:21:01 +0000
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2014-01-06 18:24:15 +0000
commite2f7ac211d72d81364376847373ed79947062f7b (patch)
tree811b11bdff4ab6708d797956fcce83dcd7bf5279
parent674a4f10cac0b36a7d2899e1568c23da9e5f82d2 (diff)
downloadandroid_hardware_samsung-e2f7ac211d72d81364376847373ed79947062f7b.tar.gz
android_hardware_samsung-e2f7ac211d72d81364376847373ed79947062f7b.tar.bz2
android_hardware_samsung-e2f7ac211d72d81364376847373ed79947062f7b.zip
mfcdec: Compensate race condition in video thumbnail generation
Calling the decoder immediately after encoding a video often trips on the ongoing mfc buffer flushes from the encoder that has just shut down, and fails due to the unavailability of any buffer of sufficient size. If MFC_DEC_INIT fails, give it 100msec and try again. This resolves the blank thumbs when switching to the gallery in the same session that a recording was made. Change-Id: I13b1be8757b314e1c903a0570f9b053550164616
-rw-r--r--exynos/multimedia/codecs/video/exynos4/mfc/dec/src/SsbSipMfcDecAPI.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/exynos/multimedia/codecs/video/exynos4/mfc/dec/src/SsbSipMfcDecAPI.c b/exynos/multimedia/codecs/video/exynos4/mfc/dec/src/SsbSipMfcDecAPI.c
index 8f95439..03073b8 100644
--- a/exynos/multimedia/codecs/video/exynos4/mfc/dec/src/SsbSipMfcDecAPI.c
+++ b/exynos/multimedia/codecs/video/exynos4/mfc/dec/src/SsbSipMfcDecAPI.c
@@ -243,6 +243,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit (void *openHandle, SSBSIP_MFC_CODEC_TYPE
int packedPB = 0;
struct mfc_common_args DecArg;
_MFCLIB *pCTX;
+ int retries = 3;
if (openHandle == NULL) {
ALOGE("SsbSipMfcDecInit] openHandle is NULL");
@@ -298,8 +299,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit (void *openHandle, SSBSIP_MFC_CODEC_TYPE
/* sequence start args */
/* no needs */
+retry:
r = ioctl(pCTX->hMFC, IOCTL_MFC_DEC_INIT, &DecArg);
if (DecArg.ret_code != MFC_OK) {
+ if (retries) {
+ retries--;
+ usleep(100000);
+ goto retry;
+ }
ALOGE("SsbSipMfcDecInit] IOCTL_MFC_DEC_INIT failed");
return MFC_RET_DEC_INIT_FAIL;
}