Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba6842be authored by Pavan Chikkala's avatar Pavan Chikkala
Browse files

mm-audio: Avoid command thread loop if omx component is stopped

When omx init and deinit are called in short duration,there
is a possibility that deinit is called before command thread
is started. omx_thread_stop closes respective pipe and waits
for the command thread to exit.
In a specific scenario, same pipe fd is allocated in another
module and command thread in omx continues to read from the
same pipe although it is closed by the main omx thread.
omx_thread_stop is blocked infinitely due to this reason

Fix is to set a flag in omx_thread_stop to avoid command
thread to go into the read loop if it is started after
omx_thread_stop is called

Change-Id: I4b9c4909c7178010568219fddcd05eaafdddc769
parent a25a1fe5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
/*--------------------------------------------------------------------------
Copyright (c) 2010, The Linux Foundation. All rights reserved.
Copyright (c) 2010, 2016, 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:
@@ -189,6 +189,7 @@ fail_pipe:

void omx_aac_thread_stop(struct aac_ipc_info *aac_info) {
    DEBUG_DETAIL("%s stop server\n", __FUNCTION__);
    aac_info->dead = 1;
    close(aac_info->pipe_in);
    close(aac_info->pipe_out);
    pthread_join(aac_info->thr,NULL);
+2 −1
Original line number Diff line number Diff line
/*--------------------------------------------------------------------------
Copyright (c) 2010, The Linux Foundation. All rights reserved.
Copyright (c) 2010, 2016, 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:
@@ -189,6 +189,7 @@ fail_pipe:

void omx_amr_thread_stop(struct amr_ipc_info *amr_info) {
    DEBUG_DETAIL("%s stop server\n", __FUNCTION__);
    amr_info->dead = 1;
    close(amr_info->pipe_in);
    close(amr_info->pipe_out);
    pthread_join(amr_info->thr,NULL);
+2 −1
Original line number Diff line number Diff line
/*--------------------------------------------------------------------------
Copyright (c) 2010, The Linux Foundation. All rights reserved.
Copyright (c) 2010, 2016, 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:
@@ -189,6 +189,7 @@ fail_pipe:

void omx_evrc_thread_stop(struct evrc_ipc_info *evrc_info) {
    DEBUG_DETAIL("%s stop server\n", __FUNCTION__);
    evrc_info->dead = 1;
    close(evrc_info->pipe_in);
    close(evrc_info->pipe_out);
    pthread_join(evrc_info->thr,NULL);
+2 −1
Original line number Diff line number Diff line
/*--------------------------------------------------------------------------
Copyright (c) 2010, The Linux Foundation. All rights reserved.
Copyright (c) 2010, 2016, 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:
@@ -191,6 +191,7 @@ fail_pipe:

void omx_qcelp13_thread_stop(struct qcelp13_ipc_info *qcelp13_info) {
    DEBUG_DETAIL("%s stop server\n", __FUNCTION__);
    qcelp13_info->dead = 1;
    close(qcelp13_info->pipe_in);
    close(qcelp13_info->pipe_out);
    pthread_join(qcelp13_info->thr,NULL);