From 1cbcd7ed6ce8f39d1866a1ee1d4aa7bcef9b1ad1 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Thu, 3 Jan 2013 08:21:28 +0100 Subject: [PATCH] Change mutex locking in setvolume and mute --- audioomx.cc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/audioomx.cc b/audioomx.cc index a803c1c..d554ca2 100644 --- a/audioomx.cc +++ b/audioomx.cc @@ -1386,9 +1386,10 @@ int AudioOMX::mute() { if (!initted) return 0; Log::getInstance()->log("Audio", Log::DEBUG, "MUTE MUTE MUTE"); + VideoOMX *vw = (VideoOMX*) Video::getInstance(); + vw->LockClock(); if (omx_running) { - VideoOMX *vw = (VideoOMX*) Video::getInstance(); - vw->LockClock(); + OMX_AUDIO_CONFIG_MUTETYPE amute; memset(&amute, 0, sizeof(amute)); amute.nSize = sizeof(amute); @@ -1403,8 +1404,9 @@ int AudioOMX::mute() { omx_rend_input_port); return 0; } - vw->UnlockClock(); + } + vw->UnlockClock(); muted = 1; return 1; @@ -1415,9 +1417,10 @@ int AudioOMX::unMute() if (!initted) return 0; Log::getInstance()->log("Audio", Log::DEBUG, "MUTE OFF OFF OFF"); + VideoOMX *vw = (VideoOMX*) Video::getInstance(); + vw->LockClock(); if (omx_running) { - VideoOMX *vw = (VideoOMX*) Video::getInstance(); - vw->LockClock(); + OMX_AUDIO_CONFIG_MUTETYPE amute; memset(&amute, 0, sizeof(amute)); amute.nSize = sizeof(amute); @@ -1432,9 +1435,10 @@ int AudioOMX::unMute() omx_rend_input_port); return 0; } - vw->UnlockClock(); } + vw->UnlockClock(); + muted = 0; return 1; } @@ -1487,10 +1491,10 @@ int AudioOMX::setVolume(int tvolume) volume=tvolume; - + VideoOMX *vw = (VideoOMX*) Video::getInstance(); + vw->LockClock(); if (omx_running) { - VideoOMX *vw = (VideoOMX*) Video::getInstance(); - vw->LockClock(); + OMX_AUDIO_CONFIG_VOLUMETYPE avol; memset(&avol, 0, sizeof(avol)); avol.nSize = sizeof(avol); @@ -1506,8 +1510,9 @@ int AudioOMX::setVolume(int tvolume) omx_rend_input_port); return 0; } - vw->UnlockClock(); + } + vw->UnlockClock(); return 1; } -- 2.39.5