mirror of
https://github.com/jambonz/freeswitch-modules.git
synced 2025-12-19 08:57:44 +00:00
Playht delete circular buffer with mutex check (#123)
Signed-off-by: root <root@af6633a5cfe8> Co-authored-by: root <root@af6633a5cfe8>
This commit is contained in:
@@ -959,8 +959,11 @@ extern "C" {
|
|||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "playht_speech_flush_tts, download complete? %s\n", download_complete ? "yes" : "no") ;
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "playht_speech_flush_tts, download complete? %s\n", download_complete ? "yes" : "no") ;
|
||||||
ConnInfo_t *conn = (ConnInfo_t *) p->conn;
|
ConnInfo_t *conn = (ConnInfo_t *) p->conn;
|
||||||
CircularBuffer_t *cBuffer = (CircularBuffer_t *) p->circularBuffer;
|
CircularBuffer_t *cBuffer = (CircularBuffer_t *) p->circularBuffer;
|
||||||
|
// In multi threads, only delete the circular buffer when write and read buffer action finished using it.
|
||||||
|
switch_mutex_lock(p->mutex);
|
||||||
delete cBuffer;
|
delete cBuffer;
|
||||||
p->circularBuffer = nullptr ;
|
p->circularBuffer = nullptr ;
|
||||||
|
switch_mutex_unlock(p->mutex);
|
||||||
|
|
||||||
if (conn) {
|
if (conn) {
|
||||||
conn->flushed = true;
|
conn->flushed = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user