Resolving createByteBufferFromABuffer null input
It was found that createByteBufferFromABuffer was recieving a NULL buffer in bug
22726278. Based on returning NULL when buffer->base() == NULL, returning NULL
when buffer == NULL. This does not fix bug 22726278 - but address a problem found
while looking into it.
Bug: 22726278
Change-Id: I933b6a4a535d803576a4cdd7a1ffaf4a428c3201
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp
index 218a117..93a4426 100644
--- a/media/jni/android_media_MediaCodec.cpp
+++ b/media/jni/android_media_MediaCodec.cpp
@@ -440,6 +440,12 @@
// if this is an ABuffer that doesn't actually hold any accessible memory,
// use a null ByteBuffer
*buf = NULL;
+
+ if (buffer == NULL) {
+ ALOGV("createByteBufferFromABuffer - given NULL, returning NULL");
+ return OK;
+ }
+
if (buffer->base() == NULL) {
return OK;
}