diff options
author | Andreas Huber <andih@google.com> | 2011-09-16 15:09:22 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-09-16 15:19:59 -0700 |
commit | 3fe62150fa3dd6d25cb84aad80bc9e27ddd16c45 (patch) | |
tree | 4d969afd449d31381899275bf9b9fa2a87f9a24e /media/libstagefright | |
parent | 078cfcf7cce9185ec7559910d08b0bc02bfc88a3 (diff) | |
download | frameworks_av-3fe62150fa3dd6d25cb84aad80bc9e27ddd16c45.zip frameworks_av-3fe62150fa3dd6d25cb84aad80bc9e27ddd16c45.tar.gz frameworks_av-3fe62150fa3dd6d25cb84aad80bc9e27ddd16c45.tar.bz2 |
In order to recover from video lagging behind audio, drop avc frames
that are not referenced by other frames before feeding them into the decoder.
Change-Id: I822190af8f8329567bff8da1ea23136d0a765481
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/avc_utils.cpp | 22 | ||||
-rw-r--r-- | media/libstagefright/include/avc_utils.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/media/libstagefright/avc_utils.cpp b/media/libstagefright/avc_utils.cpp index 8a42e8b..07aa140 100644 --- a/media/libstagefright/avc_utils.cpp +++ b/media/libstagefright/avc_utils.cpp @@ -329,6 +329,28 @@ bool IsIDR(const sp<ABuffer> &buffer) { return foundIDR; } +bool IsAVCReferenceFrame(const sp<ABuffer> &accessUnit) { + const uint8_t *data = accessUnit->data(); + size_t size = accessUnit->size(); + + const uint8_t *nalStart; + size_t nalSize; + while (getNextNALUnit(&data, &size, &nalStart, &nalSize, true) == OK) { + CHECK_GT(nalSize, 0u); + + unsigned nalType = nalStart[0] & 0x1f; + + if (nalType == 5) { + return true; + } else if (nalType == 1) { + unsigned nal_ref_idc = (nalStart[0] >> 5) & 3; + return nal_ref_idc != 0; + } + } + + return true; +} + sp<MetaData> MakeAACCodecSpecificData( unsigned profile, unsigned sampling_freq_index, unsigned channel_configuration) { diff --git a/media/libstagefright/include/avc_utils.h b/media/libstagefright/include/avc_utils.h index 15cd4d4..e418822 100644 --- a/media/libstagefright/include/avc_utils.h +++ b/media/libstagefright/include/avc_utils.h @@ -50,6 +50,7 @@ struct MetaData; sp<MetaData> MakeAVCCodecSpecificData(const sp<ABuffer> &accessUnit); bool IsIDR(const sp<ABuffer> &accessUnit); +bool IsAVCReferenceFrame(const sp<ABuffer> &accessUnit); const char *AVCProfileToString(uint8_t profile); |