summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/avc_utils.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-09-16 15:09:22 -0700
committerAndreas Huber <andih@google.com>2011-09-16 15:19:59 -0700
commit3fe62150fa3dd6d25cb84aad80bc9e27ddd16c45 (patch)
tree4d969afd449d31381899275bf9b9fa2a87f9a24e /media/libstagefright/avc_utils.cpp
parent078cfcf7cce9185ec7559910d08b0bc02bfc88a3 (diff)
downloadframeworks_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/avc_utils.cpp')
-rw-r--r--media/libstagefright/avc_utils.cpp22
1 files changed, 22 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) {