summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-07-27 00:30:21 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-07-27 00:30:21 +0000
commit07e469c59cbc6cee0ec90cb716b2b5d3460475b3 (patch)
tree23f833f913803d2f93e71d56de49b61e679e7eb1
parentaf7f1cd76eaafee0d9838e6c40af9c494e884e36 (diff)
parent7d951403ff6549b9d0c84b2b41a9d363c27a28fc (diff)
downloadmedia-nougat-mr2-release.tar.gz
Merge cherrypicks of [2607234, 2607235, 2606313, 2607236, 2607238, 2607239, 2606314, 2606315, 2607240, 2606316, 2606317, 2607241, 2607242, 2607243, 2607244, 2607370, 2607371, 2607245, 2607246, 2607247, 2607248, 2607249, 2607372, 2607390, 2607391, 2607392, 2607393, 2607373, 2607394, 2607397, 2607398, 2607375, 2607401, 2607376, 2607402, 2607377, 2607403, 2607404, 2607378, 2607405, 2607379, 2607380, 2607381, 2607406, 2607382, 2607407, 2607408, 2607409] into nyc-mr2-releaseandroid-7.1.2_r36nougat-mr2-release
Change-Id: Iff94d3e9e6e8d74a539655bb6a430f9c193cbbb6
-rw-r--r--msm8974/mm-video-v4l2/vidc/venc/inc/omx_video_base.h3
-rw-r--r--msm8974/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp6
-rw-r--r--msm8974/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp14
3 files changed, 18 insertions, 5 deletions
diff --git a/msm8974/mm-video-v4l2/vidc/venc/inc/omx_video_base.h b/msm8974/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
index e75bfcb..025ea19 100644
--- a/msm8974/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
+++ b/msm8974/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010-2016, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -636,6 +636,7 @@ class omx_video: public qc_omx_component
omx_cmd_queue m_opq_meta_q;
omx_cmd_queue m_opq_pmem_q;
OMX_BUFFERHEADERTYPE meta_buffer_hdr[MAX_NUM_INPUT_BUFFERS];
+ pthread_mutex_t m_buf_lock;
bool input_flush_progress;
bool output_flush_progress;
diff --git a/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
index 90e2425..6907ca5 100644
--- a/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
+++ b/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010-2016, Linux Foundation. All rights reserved.
+Copyright (c) 2010-2017, Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -257,6 +257,7 @@ omx_video::omx_video():
pthread_mutex_init(&m_lock, NULL);
sem_init(&m_cmd_lock,0,0);
DEBUG_PRINT_LOW("meta_buffer_hdr = %p", meta_buffer_hdr);
+ pthread_mutex_init(&m_buf_lock, NULL);
}
@@ -292,6 +293,7 @@ omx_video::~omx_video()
sem_destroy(&m_cmd_lock);
DEBUG_PRINT_HIGH("m_etb_count = %" PRIu64 ", m_fbd_count = %" PRIu64, m_etb_count,
m_fbd_count);
+ pthread_mutex_destroy(&m_buf_lock);
DEBUG_PRINT_HIGH("omx_video: Destructor exit");
DEBUG_PRINT_HIGH("Exiting OMX Video Encoder ...");
}
@@ -2369,6 +2371,7 @@ OMX_ERRORTYPE omx_video::use_output_buffer(
return OMX_ErrorBadParameter;
}
+ auto_lock l(m_buf_lock);
if (!m_out_mem_ptr) {
output_use_buffer = true;
int nBufHdrSize = 0;
@@ -3284,6 +3287,7 @@ OMX_ERRORTYPE omx_video::free_buffer(OMX_IN OMX_HANDLETYPE hComp,
nPortIndex, (unsigned int)m_sOutPortDef.nBufferCountActual);
if (nPortIndex < m_sOutPortDef.nBufferCountActual &&
BITMASK_PRESENT(&m_out_bm_count, nPortIndex)) {
+ auto_lock l(m_buf_lock);
// Clear the bit associated with it.
BITMASK_CLEAR(&m_out_bm_count,nPortIndex);
m_sOutPortDef.bPopulated = OMX_FALSE;
diff --git a/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp b/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
index 047273a..ed63fb9 100644
--- a/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -2255,11 +2255,18 @@ int omx_venc::async_message_process (void *context, void* message)
OMX_COMPONENT_GENERATE_EBD);
break;
case VEN_MSG_OUTPUT_BUFFER_DONE:
+ {
omxhdr = (OMX_BUFFERHEADERTYPE*)m_sVenc_msg->buf.clientdata;
+ OMX_U32 bufIndex = (OMX_U32)(omxhdr - omx->m_out_mem_ptr);
if ( (omxhdr != NULL) &&
- ((OMX_U32)(omxhdr - omx->m_out_mem_ptr) < omx->m_sOutPortDef.nBufferCountActual)) {
- if (m_sVenc_msg->buf.len <= omxhdr->nAllocLen) {
+ (bufIndex < omx->m_sOutPortDef.nBufferCountActual)) {
+ auto_lock l(omx->m_buf_lock);
+ if (BITMASK_ABSENT(&(omx->m_out_bm_count), bufIndex)) {
+ DEBUG_PRINT_ERROR("Recieved FBD for buffer that is already freed !");
+ break;
+ }
+ if (!omx->is_secure_session() && (m_sVenc_msg->buf.len <= omxhdr->nAllocLen)) {
omxhdr->nFilledLen = m_sVenc_msg->buf.len;
omxhdr->nOffset = m_sVenc_msg->buf.offset;
omxhdr->nTimeStamp = m_sVenc_msg->buf.timestamp;
@@ -2284,6 +2291,7 @@ int omx_venc::async_message_process (void *context, void* message)
omx->post_event ((unsigned long)omxhdr,m_sVenc_msg->statuscode,
OMX_COMPONENT_GENERATE_FBD);
break;
+ }
case VEN_MSG_NEED_OUTPUT_BUFFER:
//TBD what action needs to be done here??
break;