heic content_encoding field is optional
comply with the ISO spec that allows for content type fields to
be omitted in the mp4 header if they would be otherwise empty.
Bug: 74375003
Test: before/after of PoC
Change-Id: I522bacf192fee86122f603d6e87506e1a004f3f6
(cherry picked from commit 237dc91c546cf5e39737812f49460b552a529f7d)
diff --git a/media/extractors/mp4/ItemTable.cpp b/media/extractors/mp4/ItemTable.cpp
index cef5f4a..d13f0dd 100644
--- a/media/extractors/mp4/ItemTable.cpp
+++ b/media/extractors/mp4/ItemTable.cpp
@@ -1060,9 +1060,12 @@
return ERROR_MALFORMED;
}
- String8 content_encoding;
- if (!parseNullTerminatedString(&offset, &size, &content_encoding)) {
- return ERROR_MALFORMED;
+ // content_encoding is optional; can be omitted if would be empty
+ if (size > 0) {
+ String8 content_encoding;
+ if (!parseNullTerminatedString(&offset, &size, &content_encoding)) {
+ return ERROR_MALFORMED;
+ }
}
} else if (item_type == FOURCC('u', 'r', 'i', ' ')) {
String8 item_uri_type;