Loading media/libstagefright/omx/SoftVideoEncoderOMXComponent.cpp +9 −16 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ #include "include/SoftVideoEncoderOMXComponent.h" #include <hardware/gralloc.h> #include <media/hardware/HardwareAPI.h> #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/foundation/ALooper.h> Loading Loading @@ -71,7 +70,6 @@ SoftVideoEncoderOMXComponent::SoftVideoEncoderOMXComponent( mBitrate(192000), mFramerate(30 << 16), // Q16 format mColorFormat(OMX_COLOR_FormatYUV420Planar), mGrallocModule(NULL), mMinOutputBufferSize(384), // arbitrary, using one uncompressed macroblock mMinCompressionRatio(1), // max output size is normally the input size mComponentRole(componentRole), Loading Loading @@ -500,13 +498,6 @@ const uint8_t *SoftVideoEncoderOMXComponent::extractGraphicBuffer( return NULL; } if (mGrallocModule == NULL) { CHECK_EQ(0, hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &mGrallocModule)); } const gralloc_module_t *grmodule = (const gralloc_module_t *)mGrallocModule; buffer_handle_t handle; int format; size_t srcStride; Loading Loading @@ -564,19 +555,21 @@ const uint8_t *SoftVideoEncoderOMXComponent::extractGraphicBuffer( return NULL; } auto& mapper = GraphicBufferMapper::get(); void *bits = NULL; struct android_ycbcr ycbcr; status_t res; if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) { res = grmodule->lock_ycbcr( grmodule, handle, res = mapper.lockYCbCr( handle, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_NEVER, 0, 0, width, height, &ycbcr); Rect(width, height), &ycbcr); } else { res = grmodule->lock( grmodule, handle, res = mapper.lock( handle, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_NEVER, 0, 0, width, height, &bits); Rect(width, height), &bits); } if (res != OK) { ALOGE("Unable to lock image buffer %p for access", handle); Loading Loading @@ -620,7 +613,7 @@ const uint8_t *SoftVideoEncoderOMXComponent::extractGraphicBuffer( break; } if (grmodule->unlock(grmodule, handle) != OK) { if (mapper.unlock(handle) != OK) { ALOGE("Unable to unlock image buffer %p for access", handle); } Loading Loading
media/libstagefright/omx/SoftVideoEncoderOMXComponent.cpp +9 −16 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ #include "include/SoftVideoEncoderOMXComponent.h" #include <hardware/gralloc.h> #include <media/hardware/HardwareAPI.h> #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/foundation/ALooper.h> Loading Loading @@ -71,7 +70,6 @@ SoftVideoEncoderOMXComponent::SoftVideoEncoderOMXComponent( mBitrate(192000), mFramerate(30 << 16), // Q16 format mColorFormat(OMX_COLOR_FormatYUV420Planar), mGrallocModule(NULL), mMinOutputBufferSize(384), // arbitrary, using one uncompressed macroblock mMinCompressionRatio(1), // max output size is normally the input size mComponentRole(componentRole), Loading Loading @@ -500,13 +498,6 @@ const uint8_t *SoftVideoEncoderOMXComponent::extractGraphicBuffer( return NULL; } if (mGrallocModule == NULL) { CHECK_EQ(0, hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &mGrallocModule)); } const gralloc_module_t *grmodule = (const gralloc_module_t *)mGrallocModule; buffer_handle_t handle; int format; size_t srcStride; Loading Loading @@ -564,19 +555,21 @@ const uint8_t *SoftVideoEncoderOMXComponent::extractGraphicBuffer( return NULL; } auto& mapper = GraphicBufferMapper::get(); void *bits = NULL; struct android_ycbcr ycbcr; status_t res; if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) { res = grmodule->lock_ycbcr( grmodule, handle, res = mapper.lockYCbCr( handle, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_NEVER, 0, 0, width, height, &ycbcr); Rect(width, height), &ycbcr); } else { res = grmodule->lock( grmodule, handle, res = mapper.lock( handle, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_NEVER, 0, 0, width, height, &bits); Rect(width, height), &bits); } if (res != OK) { ALOGE("Unable to lock image buffer %p for access", handle); Loading Loading @@ -620,7 +613,7 @@ const uint8_t *SoftVideoEncoderOMXComponent::extractGraphicBuffer( break; } if (grmodule->unlock(grmodule, handle) != OK) { if (mapper.unlock(handle) != OK) { ALOGE("Unable to unlock image buffer %p for access", handle); } Loading