diff options
author | zhangbo_a <zhangbo_a@pinecone.net> | 2017-05-11 11:50:57 +0800 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2021-09-03 22:15:17 +0200 |
commit | 11799cffd9e4c068dd24bd1371c4f12f63de98e6 (patch) | |
tree | 6e20b88bace96d88659a00b9a1ce2bd09ea1d592 | |
parent | 535fd9b2c6d0b85ea850c8f43c8bdb8a1bcc1594 (diff) |
stagefright: Fix SurfaceMediaSource getting handle from wrong position issue
In function passMetadataBuffer_l, the bufferHandle(ANativeWindowBuffer) is
saved to data (VideoNativeMetadata) but in function getMediaBufferHandle it
gets the bufferHandle from (MediaBuffer*)buffer->data() + 4, which is a wrong
position. To solve this problem, we should get handle from ANativeWindowBuffer,
not from buffer->data() + 4. (If get bufferHandle from buffer->data() + 4, the
function signalBufferReturned will print "returned buffer was not found in the
current list" error.
Test: Running wifi display, we can see the handle could be found in buffer list.
Change-Id: I71ecf9e2bca1db67d8d6e862ac16b07e939bf521
Signed-off-by: zhangbo_a <zhangbo_a@pinecone.net>
Signed-off-by: DennySPb <dennyspb@gmail.com>
-rw-r--r-- | media/libstagefright/SurfaceMediaSource.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp index 333c618fbd..3ba18b6631 100644 --- a/media/libstagefright/SurfaceMediaSource.cpp +++ b/media/libstagefright/SurfaceMediaSource.cpp @@ -375,7 +375,9 @@ static buffer_handle_t getMediaBufferHandle(MediaBufferBase *buffer) { // need to convert to char* for pointer arithmetic and then // copy the byte stream into our handle buffer_handle_t bufferHandle; - memcpy(&bufferHandle, (char*)(buffer->data()) + 4, sizeof(buffer_handle_t)); + VideoNativeMetadata *data = (VideoNativeMetadata *)buffer->data(); + ANativeWindowBuffer *anwbuffer = (ANativeWindowBuffer *)data->pBuffer; + bufferHandle = anwbuffer->handle; return bufferHandle; } |