diff options
author | Xin Li <delphij@google.com> | 2020-09-08 16:55:39 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2020-09-08 16:55:39 -0700 |
commit | 7a251f0a63f28ffc01e8a209d0124e422184b4cf (patch) | |
tree | b63d6819065b00e3ba3d807218f1e57f1471ff26 | |
parent | d5ea805862a31ad5fc2afe0763c2f5965afb3738 (diff) | |
parent | acb4b2d4405681338ae2fffe5466252c28f3a7e6 (diff) | |
download | media-7a251f0a63f28ffc01e8a209d0124e422184b4cf.tar.gz |
Merge Android R
Bug: 168057903
Merged-In: I6572157ab6f75fefb67d7fbc24e9529df8c17743
Change-Id: I842cc3fb1a04166a28b0d778318b822c4b03214f
4 files changed, 19 insertions, 10 deletions
diff --git a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h index 5908843a..4dccb1df 100644 --- a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h +++ b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------- -Copyright (c) 2010-2018, The Linux Foundation. All rights reserved. +Copyright (c) 2010-2019, 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 @@ -152,6 +152,8 @@ static const char* MEM_DEVICE = "/dev/ion"; #define LEGACY_CAM_METADATA_TYPE encoder_media_buffer_type #endif +class omx_video; +void post_message(omx_video *omx, unsigned char id); void* message_thread_enc(void *); enum omx_venc_extradata_types { diff --git a/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp b/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp index ade82a41..8df3148c 100644 --- a/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp +++ b/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------- -Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. +Copyright (c) 2014-2017, 2019, 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: @@ -2054,6 +2054,13 @@ OMX_ERRORTYPE omx_venc::component_deinit(OMX_IN OMX_HANDLETYPE hComp) DEBUG_PRINT_HIGH("Calling swvenc_deinit()"); swvenc_deinit(m_hSwVenc); + if (msg_thread_created) { + msg_thread_created = false; + msg_thread_stop = true; + post_message(this, OMX_COMPONENT_CLOSE_MSG); + DEBUG_PRINT_HIGH("omx_video: Waiting on Msg Thread exit"); + pthread_join(msg_thread_id,NULL); + } DEBUG_PRINT_HIGH("OMX_Venc:Component Deinit"); RETURN(OMX_ErrorNone); diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp index 4018164d..0327551c 100644 --- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp +++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp @@ -320,13 +320,6 @@ omx_video::omx_video(): omx_video::~omx_video() { DEBUG_PRINT_HIGH("~omx_video(): Inside Destructor()"); - if (msg_thread_created) { - msg_thread_stop = true; - post_message(this, OMX_COMPONENT_CLOSE_MSG); - DEBUG_PRINT_HIGH("omx_video: Waiting on Msg Thread exit"); - pthread_join(msg_thread_id,NULL); - } - DEBUG_PRINT_HIGH("omx_video: Waiting on Async Thread exit"); /*For V4L2 based drivers, pthread_join is done in device_close * so no need to do it here*/ pthread_mutex_destroy(&m_lock); diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp index 6059c24f..4eaaa3d3 100644 --- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp +++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------- -Copyright (c) 2010-2018, The Linux Foundation. All rights reserved. +Copyright (c) 2010-2019, 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: @@ -1633,6 +1633,13 @@ void venc_dev::venc_close() if (async_thread_created) pthread_join(m_tid,NULL); + if (venc_handle->msg_thread_created) { + venc_handle->msg_thread_created = false; + venc_handle->msg_thread_stop = true; + post_message(venc_handle, omx_video::OMX_COMPONENT_CLOSE_MSG); + DEBUG_PRINT_HIGH("omx_video: Waiting on Msg Thread exit"); + pthread_join(venc_handle->msg_thread_id, NULL); + } DEBUG_PRINT_HIGH("venc_close X"); unsubscribe_to_events(m_nDriver_fd); close(m_poll_efd); |