source: svn/trunk/newcon3bcm2_21bu/magnum/syslib/synclib/7552/bsynclib_mute_control.c

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 19.4 KB
Line 
1/***************************************************************************
2*     Copyright (c) 2004-2010, Broadcom Corporation
3*     All Rights Reserved
4*     Confidential Property of Broadcom Corporation
5*
6*  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7*  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8*  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9*
10* $brcm_Workfile: bsynclib_mute_control.c $
11* $brcm_Revision: Hydra_Software_Devel/8 $
12* $brcm_Date: 5/28/10 6:31p $
13*
14* Revision History:
15*
16* $brcm_Log: /magnum/syslib/synclib/noarch/bsynclib_mute_control.c $
17*
18* Hydra_Software_Devel/8   5/28/10 6:31p bandrews
19* SW7405-4436: printing channel index in dbg messages
20*
21* Hydra_Software_Devel/7   3/22/10 5:47p bandrews
22* sw7408-83: add unconditional video unmute; fix dbg trace messages;
23* consolidate debug prints for starting unmute and canceling unmute
24* timers
25*
26* Hydra_Software_Devel/6   3/19/10 2:49p bandrews
27* SW7405-3774: merge mute control
28*
29* Hydra_Software_Devel/SW7405-3774/2   3/18/10 10:03p bandrews
30* SW7405-3774: fixed case where video may unmute even with pending
31* adjustment
32*
33* Hydra_Software_Devel/SW7405-3774/1   2/17/10 6:17p bandrews
34* SW7405-3774: attempt to fix early audio unmute then mute
35*
36* Hydra_Software_Devel/5   2/12/10 8:47p bandrews
37* SW7405-3912: assert all input params are not null
38*
39* Hydra_Software_Devel/5   2/12/10 8:46p bandrews
40* SW7405-3912: assert all inputs are not null
41*
42* Hydra_Software_Devel/4   2/4/10 3:43p bandrews
43* SW7405-3774: fix PIG behavior
44*
45* Hydra_Software_Devel/3   2/1/10 8:01p bandrews
46* SW7405-3774: only mute/unmute synchronized sources
47*
48* Hydra_Software_Devel/2   2/1/10 3:28p bandrews
49* SW7405-3774: default mute control to off
50*
51* Hydra_Software_Devel/1   1/26/10 9:00p bandrews
52* SW7405-3774: added mute control support
53***************************************************************************/
54
55#include "bstd.h"
56#include "bsyslib.h"
57#include "bsyslib_list.h"
58#include "bsynclib.h"
59#include "bsynclib_priv.h"
60#include "bsynclib_channel_priv.h"
61#include "bsynclib_mute_control.h"
62#include "bsynclib_mute_control_priv.h"
63#include "bsynclib_audio_source.h"
64#include "bsynclib_video_source.h"
65
66BDBG_MODULE(synclib);
67
68BERR_Code BSYNClib_MuteControl_ScheduleTask_isr(BSYNClib_Channel_Handle hChn)
69{
70        BERR_Code rc = BERR_SUCCESS;
71        BSYNClib_Channel_Results * psResults;
72
73        BDBG_ENTER(BSYNClib_MuteControl_ScheduleTask_isr);
74
75        BDBG_ASSERT(hChn);
76
77        psResults = &hChn->sResults;
78
79        if (!psResults->bMuteTaskScheduled)
80        {
81#ifdef BSYSLIB_TASK_SUPPORT
82                if (hChn->sSettings.cbTask.pfSchedule_isr)
83                {
84                        BSYSlib_Task_Settings sTask;
85
86                        sTask.pvParm1 = hChn;
87                        sTask.iParm2 = 0;
88                        sTask.pfDoTask = &BSYNClib_MuteControl_P_Process;
89
90                        rc = hChn->sSettings.cbTask.pfSchedule_isr(hChn->sSettings.cbTask.pvParm1, 
91                                hChn->sSettings.cbTask.iParm2, &sTask);
92                }
93#else
94        rc = BSYNClib_Channel_P_StartTimer_isr(hChn, 
95                hChn->psMuteControlTaskTimer, 0, 
96                &BSYNClib_MuteControl_P_TaskTimerExpired, hChn, 0);
97#endif
98
99                if (!rc)
100                {
101                        psResults->bMuteTaskScheduled = true;
102                        BDBG_MSG(("[%d] Mute control task scheduled", hChn->iIndex));
103                }
104                else
105                {
106                        psResults->bMuteTaskScheduled = false;
107                }
108                if (rc) goto error;
109        }
110        else
111        {
112                BDBG_MSG(("[%d] Mute control task already scheduled", hChn->iIndex));
113        }
114
115        goto end;
116
117error:
118       
119end:
120        BDBG_LEAVE(BSYNClib_MuteControl_ScheduleTask_isr);
121        return rc;
122}
123
124BERR_Code BSYNClib_MuteControl_CancelUnmuteTimers_isr(BSYNClib_Channel_Handle hChn)
125{
126        BERR_Code rc = BERR_SUCCESS;
127        BSYSlib_List_IteratorHandle hIterator;
128        BSYNClib_VideoSource * psVideoSource;
129        BSYNClib_AudioSource * psAudioSource;
130
131        BDBG_ASSERT(hChn);
132
133        BDBG_MSG(("[%d] Canceling all unmute timers", hChn->iIndex));
134
135        hIterator = BSYSlib_List_AcquireIterator_isr(hChn->sVideo.hSources);
136        while (BSYSlib_List_HasNext_isr(hIterator))
137        {
138                psVideoSource = (BSYNClib_VideoSource *)BSYSlib_List_Next_isr(hIterator);
139
140                rc = BSYNClib_Channel_P_CancelTimer_isr(hChn, psVideoSource->psUnmuteTimer);
141                if (rc) goto error;
142        }
143        BSYSlib_List_ReleaseIterator_isr(hIterator);
144
145        hIterator = BSYSlib_List_AcquireIterator_isr(hChn->sAudio.hSources);
146        while (BSYSlib_List_HasNext_isr(hIterator))
147        {
148                psAudioSource = (BSYNClib_AudioSource *)BSYSlib_List_Next_isr(hIterator);
149
150                rc = BSYNClib_Channel_P_CancelTimer_isr(hChn, psAudioSource->psUnmuteTimer);
151                if (rc) goto error;
152        }
153        BSYSlib_List_ReleaseIterator_isr(hIterator);
154
155        goto end;
156
157error:
158        if (hIterator)
159        {
160                BSYSlib_List_ReleaseIterator_isr(hIterator);
161        }
162
163end:
164        return rc;
165}
166
167BERR_Code BSYNClib_MuteControl_StartUnmuteTimers(BSYNClib_Channel_Handle hChn)
168{
169        BERR_Code rc = BERR_SUCCESS;
170        BSYSlib_List_IteratorHandle hIterator;
171        BSYNClib_VideoSource * psVideoSource;
172        BSYNClib_AudioSource * psAudioSource;
173        unsigned int count;
174
175        BDBG_ASSERT(hChn);
176
177        count = 0;
178        hIterator = BSYSlib_List_AcquireIterator(hChn->sVideo.hSources);
179        while (BSYSlib_List_HasNext(hIterator))
180        {
181                psVideoSource = (BSYNClib_VideoSource *)BSYSlib_List_Next(hIterator);
182
183                if (psVideoSource->sStatus.bMuted)
184                {
185                        count++;
186                        BKNI_EnterCriticalSection();
187                        rc = BSYNClib_Channel_P_StartTimer_isr(hChn, psVideoSource->psUnmuteTimer, 
188                                hChn->hParent->sSettings.sVideo.uiUnmuteTimeout, 
189                                &BSYNClib_MuteControl_P_VideoSourceUnmuteTimerExpired, psVideoSource, 0);
190                        BKNI_LeaveCriticalSection();
191                        if (rc) goto error;
192                }
193        }
194        BSYSlib_List_ReleaseIterator(hIterator);
195
196        hIterator = BSYSlib_List_AcquireIterator(hChn->sAudio.hSources);
197        while (BSYSlib_List_HasNext(hIterator))
198        {
199                psAudioSource = (BSYNClib_AudioSource *)BSYSlib_List_Next(hIterator);
200
201                if (psAudioSource->sStatus.bMuted)
202                {
203                        count++;
204                        BKNI_EnterCriticalSection();
205                        rc = BSYNClib_Channel_P_StartTimer_isr(hChn, psAudioSource->psUnmuteTimer, 
206                                hChn->hParent->sSettings.sAudio.uiUnmuteTimeout, 
207                                &BSYNClib_MuteControl_P_AudioSourceUnmuteTimerExpired, psAudioSource, 0);
208                        BKNI_LeaveCriticalSection();
209                        if (rc) goto error;
210                }
211        }
212        BSYSlib_List_ReleaseIterator(hIterator);
213
214        if (count)
215        {
216                BDBG_MSG(("[%d] Scheduled %u unmute timers", hChn->iIndex, count));
217        }
218
219        goto end;
220
221error:
222        if (hIterator)
223        {
224                BSYSlib_List_ReleaseIterator(hIterator);
225        }
226
227end:
228        return rc;
229}
230
231BERR_Code BSYNClib_MuteControl_P_TaskTimerExpired(void * pvParm1, int iParm2, BSYSlib_Timer_Handle hTimer)
232{
233        BERR_Code rc = BERR_SUCCESS;
234        BSYNClib_Channel_Handle hChn = pvParm1;
235
236        BSTD_UNUSED(iParm2);
237        BDBG_ASSERT(hChn);
238        BDBG_ASSERT(hTimer);
239
240        BDBG_MSG(("[%d] Mute task timer expired", hChn->iIndex));
241
242        /* clean up this timer */
243        rc = BSYNClib_Channel_P_TimerExpired(hChn, hTimer);
244        if (rc) goto end;
245
246        rc = BSYNClib_MuteControl_P_Process(hChn, 0);
247
248end:
249        return rc;
250}
251
252BERR_Code BSYNClib_MuteControl_P_Process(void * pvParm1, int iParm2)
253{
254        BERR_Code rc = BERR_SUCCESS;
255        BSYNClib_Channel_Handle hChn = pvParm1;
256        BSYSlib_List_IteratorHandle hIterator;
257        BSYNClib_VideoSource * psVideoSource;
258        BSYNClib_AudioSource * psAudioSource;
259        bool bMutePending;
260        bool bStarted;
261        unsigned count;
262
263        BSTD_UNUSED(iParm2);
264        BDBG_ASSERT(hChn);
265
266        BKNI_EnterCriticalSection();
267        hChn->sResults.bMuteTaskScheduled = false;
268        BKNI_LeaveCriticalSection();
269
270        BDBG_MSG(("[%d] Mute control process invoked", hChn->iIndex));
271
272        if (hChn->sConfig.sMuteControl.bEnabled)
273        {
274                /* check fullscreen-ed-ness */
275                if (!BSYNClib_MuteControl_P_FullScreenCheck(hChn))
276                {
277                        rc = BSYNClib_MuteControl_P_UnmuteAll(hChn);
278                }
279                else
280                {
281                        BDBG_MSG(("[%d]  Checking video sources for pending mutes or starts", hChn->iIndex));
282                        count = 0;
283                        /* check for pending video source mutes */
284                        hIterator = BSYSlib_List_AcquireIterator(hChn->sVideo.hSources);
285                        while (BSYSlib_List_HasNext(hIterator))
286                        {
287                                psVideoSource = (BSYNClib_VideoSource *)BSYSlib_List_Next(hIterator);
288                                BKNI_EnterCriticalSection();
289                                bMutePending = psVideoSource->sResults.bMutePending;
290                                bStarted = psVideoSource->sElement.sData.bStarted;
291                                BKNI_LeaveCriticalSection();
292
293                                if (bMutePending)
294                                {
295                                        count++;
296                                        rc = BSYNClib_MuteControl_P_HandleVideoSourceMutePending(hChn, psVideoSource);
297                                        if (rc) goto end;
298                                }
299
300#if BSYNCLIB_UNCONDITIONAL_VIDEO_UNMUTE_SUPPORT
301                                if (bStarted)
302                                {
303                                        count++;
304                                        /* need to start this when video is started, not when it is muted */
305                                        if (!psVideoSource->psUnconditionalUnmuteTimer->bScheduled)
306                                        {
307                                                BDBG_MSG(("[%d]  Scheduling video unconditional unmute timer", hChn->iIndex));
308                                                /* schedule unconditional unmute timer */
309                                                BKNI_EnterCriticalSection();
310                                                rc = BSYNClib_Channel_P_StartTimer_isr(hChn, psVideoSource->psUnconditionalUnmuteTimer, 
311                                                        hChn->hParent->sSettings.sVideo.uiUnconditionalUnmuteTimeout, 
312                                                        &BSYNClib_MuteControl_P_VideoSourceUnconditionalUnmuteTimerExpired, psVideoSource, 0);
313                                                BKNI_LeaveCriticalSection();
314                                                if (rc) goto end;
315                                        }
316                                }
317#endif
318                        }
319                        BSYSlib_List_ReleaseIterator(hIterator);
320                        if (!count) 
321                        {
322                                BDBG_MSG(("[%d]    No pending video source mutes or starts found", hChn->iIndex));
323                        }
324
325                        BDBG_MSG(("[%d]  Checking audio sources for pending mutes or starts", hChn->iIndex));
326                        count = 0;
327                        /* check for pending audio source mutes and start events */
328                        hIterator = BSYSlib_List_AcquireIterator(hChn->sAudio.hSources);
329                        while (BSYSlib_List_HasNext(hIterator))
330                        {
331                                psAudioSource = (BSYNClib_AudioSource *)BSYSlib_List_Next(hIterator);
332                                BKNI_EnterCriticalSection();
333                                bMutePending = psAudioSource->sResults.bMutePending;
334                                bStarted = psAudioSource->sElement.sData.bStarted;
335                                BKNI_LeaveCriticalSection();
336
337                                if (bMutePending)
338                                {
339                                        count++;
340                                        rc = BSYNClib_MuteControl_P_HandleAudioSourceMutePending(hChn, psAudioSource);
341                                        if (rc) goto end;
342                                }
343
344#if BSYNCLIB_UNCONDITIONAL_AUDIO_UNMUTE_SUPPORT
345                                if (bStarted)
346                                {
347                                        count++;
348                                        /* need to start this when audio is started, not when it is muted */
349                                        if (!psAudioSource->psUnconditionalUnmuteTimer->bScheduled)
350                                        {
351                                                BDBG_MSG(("[%d]  Scheduling audio unconditional unmute timer", hChn->iIndex));
352                                                /* schedule unconditional unmute timer */
353                                                BKNI_EnterCriticalSection();
354                                                rc = BSYNClib_Channel_P_StartTimer_isr(hChn, psAudioSource->psUnconditionalUnmuteTimer, 
355                                                        hChn->hParent->sSettings.sAudio.uiUnconditionalUnmuteTimeout, 
356                                                        &BSYNClib_MuteControl_P_AudioSourceUnconditionalUnmuteTimerExpired, psAudioSource, 0);
357                                                BKNI_LeaveCriticalSection();
358                                                if (rc) goto end;
359                                        }
360                                }
361#endif
362                        }
363                        BSYSlib_List_ReleaseIterator(hIterator);
364                        if (!count) 
365                        {
366                                BDBG_MSG(("[%d]    No pending audio source mutes or starts found", hChn->iIndex));
367                        }
368                }
369        }
370        else
371        {
372                BDBG_MSG(("[%d] Mute control process called while mute control disabled", hChn->iIndex));
373        }
374
375end:
376        return rc;
377}
378
379BERR_Code BSYNClib_MuteControl_P_HandleVideoSourceMutePending(BSYNClib_Channel_Handle hChn, BSYNClib_VideoSource * psSource)
380{
381        BERR_Code rc = BERR_SUCCESS;
382        BSYNClib_AudioSource * psAudioSource;
383        bool bAudioSourceSynchronized;
384        BSYSlib_List_IteratorHandle hIterator;
385
386        BDBG_ASSERT(hChn);
387        BDBG_ASSERT(psSource);
388
389        BDBG_MSG(("[%d]  Found pending video source mute", hChn->iIndex));
390
391        /* check if any audio sources are synchronized */
392        bAudioSourceSynchronized = false;
393        hIterator = BSYSlib_List_AcquireIterator(hChn->sAudio.hSources);
394        while (BSYSlib_List_HasNext(hIterator))
395        {
396                psAudioSource = (BSYNClib_AudioSource *)BSYSlib_List_Next(hIterator);
397
398                if (psAudioSource->sConfig.bSynchronize)/* at mute time, no snapshot has been made */
399                {
400                        bAudioSourceSynchronized = true;
401                        break;
402                }
403        }
404        BSYSlib_List_ReleaseIterator(hIterator);
405       
406        if (bAudioSourceSynchronized)
407        {
408                /* only mute synchronized video sources */
409                if (psSource->sConfig.bSynchronize) /* at mute time, no snapshot has been made */
410                {
411                        /* only mute if full screen check passes */
412                        if (BSYNClib_MuteControl_P_FullScreenCheck(hChn))
413                        {
414                                /* user intended this to be an av session, mute video until done with sync */
415                                BDBG_MSG(("[%d]    Video source synchronized in av session, muting", hChn->iIndex));
416                                rc = BSYNClib_VideoSource_SetMute(psSource, true);
417                                if (rc) goto end;
418                        }
419                        else
420                        {
421                                BSYNClib_MuteControl_P_UnmuteAll(hChn);
422                        }
423                }
424                else
425                {
426                        BDBG_MSG(("[%d]    Video source not synchronized, pending mute postponed", hChn->iIndex));
427                }
428        }
429        else
430        {
431                BDBG_MSG(("[%d]    No synchronized audio sources, pending mute postponed", hChn->iIndex));
432        }
433
434end:
435
436        return rc;
437}
438
439BERR_Code BSYNClib_MuteControl_P_HandleAudioSourceMutePending(BSYNClib_Channel_Handle hChn, BSYNClib_AudioSource * psSource)
440{
441        BERR_Code rc = BERR_SUCCESS;
442        BSYNClib_VideoSource * psVideoSource;
443        bool bVideoSourceSynchronized;
444        BSYSlib_List_IteratorHandle hIterator;
445
446        BDBG_ASSERT(hChn);
447        BDBG_ASSERT(psSource);
448
449        BDBG_MSG(("[%d]  Found pending audio source mute", hChn->iIndex));
450
451        /* check if any video sources are synchronized */
452        bVideoSourceSynchronized = false;
453        hIterator = BSYSlib_List_AcquireIterator(hChn->sVideo.hSources);
454        while (BSYSlib_List_HasNext(hIterator))
455        {
456                psVideoSource = (BSYNClib_VideoSource *)BSYSlib_List_Next(hIterator);
457
458                if (psVideoSource->sConfig.bSynchronize)/* at mute time, no snapshot has been made */
459                {
460                        bVideoSourceSynchronized = true;
461                        break;
462                }
463        }
464        BSYSlib_List_ReleaseIterator(hIterator);
465       
466        if (bVideoSourceSynchronized)
467        {
468                /* only mute synchronized audio sources */
469                if (psSource->sConfig.bSynchronize)/* at mute time, no snapshot has been made */
470                {
471                        /* only mute if full screen check passes */
472                        if (BSYNClib_MuteControl_P_FullScreenCheck(hChn))
473                        {
474                                /* user intended this to be an av session, mute audio until done with sync */
475                                BDBG_MSG(("[%d]    Audio source synchronized in av session, muting", hChn->iIndex));
476                                rc = BSYNClib_AudioSource_SetMute(psSource, true);
477                                if (rc) goto end;
478                        }
479                        else
480                        {
481                                BDBG_MSG(("[%d] Ignoring audio mute request", hChn->iIndex));
482                        }
483                }
484                else
485                {
486                        BDBG_MSG(("[%d]    Audio source not synchronized, pending mute postponed", hChn->iIndex));
487                }
488        }
489        else
490        {
491                BDBG_MSG(("[%d]    No synchronized video sources, pending mute postponed", hChn->iIndex));
492        }
493
494end:
495
496        return rc;
497}
498
499bool BSYNClib_MuteControl_P_FullScreenCheck(BSYNClib_Channel_Handle hChn)
500{
501        BSYSlib_List_IteratorHandle hIterator;
502        BSYNClib_VideoSink * psVideoSink;
503        bool bFullScreenPass = true;
504
505        BDBG_ASSERT(hChn);
506
507        if (hChn->hParent->sSettings.sVideo.bRequireFullScreen)
508        {
509                hIterator = BSYSlib_List_AcquireIterator(hChn->sVideo.hSinks);
510                while (BSYSlib_List_HasNext(hIterator))
511                {
512                        psVideoSink = (BSYNClib_VideoSink *)BSYSlib_List_Next(hIterator);
513
514                        if (!psVideoSink->sConfig.bFullScreen)/* at mute time, no snapshot has been made */
515                        {
516                                BDBG_MSG(("[%d] Full screen check fail", hChn->iIndex));
517                                bFullScreenPass = false;
518                                break;
519                        }
520                }
521                BSYSlib_List_ReleaseIterator(hIterator);
522        }
523
524        return bFullScreenPass;
525}
526
527BERR_Code BSYNClib_MuteControl_P_UnmuteAll(BSYNClib_Channel_Handle hChn)
528{
529        BERR_Code rc = BERR_SUCCESS;
530        BSYSlib_List_IteratorHandle hIterator;
531        BSYNClib_VideoSource * psVideoSource;
532        BSYNClib_AudioSource * psAudioSource;
533
534        BDBG_ASSERT(hChn);
535
536        BDBG_MSG(("[%d] Unmuting all sources", hChn->iIndex));
537
538        hIterator = BSYSlib_List_AcquireIterator(hChn->sVideo.hSources);
539        while (BSYSlib_List_HasNext(hIterator))
540        {
541                psVideoSource = (BSYNClib_VideoSource *)BSYSlib_List_Next(hIterator);
542
543                /* unmute */
544                rc = BSYNClib_VideoSource_SetMute(psVideoSource, false);
545                if (rc) goto error;
546        }
547        BSYSlib_List_ReleaseIterator(hIterator);
548
549        hIterator = BSYSlib_List_AcquireIterator(hChn->sAudio.hSources);
550        while (BSYSlib_List_HasNext(hIterator))
551        {
552                psAudioSource = (BSYNClib_AudioSource *)BSYSlib_List_Next(hIterator);
553
554                /* unmute */
555                rc = BSYNClib_AudioSource_SetMute(psAudioSource, false);
556                if (rc) goto error;
557        }
558        BSYSlib_List_ReleaseIterator(hIterator);
559
560        goto end;
561
562error:
563        if (hIterator)
564        {
565                BSYSlib_List_ReleaseIterator(hIterator);
566        }
567
568end:
569        return rc;
570}
571
572BERR_Code BSYNClib_MuteControl_P_VideoSourceUnmuteTimerExpired(void * pvParm1, int iParm2, BSYSlib_Timer_Handle hTimer)
573{
574        BERR_Code rc = BERR_SUCCESS;
575        BSYNClib_VideoSource * psSource = pvParm1;
576        BSYNClib_Channel_Handle hChn;
577       
578        BDBG_ENTER(BSYNClib_MuteControl_P_VideoSourceUnmuteTimerExpired);
579
580        BSTD_UNUSED(iParm2);
581
582        BDBG_ASSERT(psSource);
583        BDBG_ASSERT(hTimer);
584
585        hChn = psSource->sElement.hParent;
586
587        /* clean up timer */
588        rc = BSYNClib_Channel_P_TimerExpired(hChn, hTimer);
589        if (rc) goto end;
590
591        BDBG_MSG(("[%d] Video source %u unmute timer expired", hChn->iIndex, psSource->sElement.uiIndex));
592
593        if (hChn->sConfig.sMuteControl.bSimultaneousUnmute)
594        {
595                /* TODO: may want to make this fire on longest timeout, instead of shortest */
596                rc = BSYNClib_MuteControl_P_UnmuteAll(hChn);
597        }
598        else
599        {
600                rc = BSYNClib_VideoSource_SetMute(psSource, false);
601                if (rc) goto end;
602        }
603
604end:
605        BDBG_LEAVE(BSYNClib_MuteControl_P_VideoSourceUnmuteTimerExpired);
606        return rc;
607}
608
609BERR_Code BSYNClib_MuteControl_P_AudioSourceUnmuteTimerExpired(void * pvParm1, int iParm2, BSYSlib_Timer_Handle hTimer)
610{
611        BERR_Code rc = BERR_SUCCESS;
612        BSYNClib_AudioSource * psSource = pvParm1;
613        BSYNClib_Channel_Handle hChn;
614       
615        BDBG_ENTER(BSYNClib_MuteControl_P_AudioSourceUnmuteTimerExpired);
616
617        BSTD_UNUSED(iParm2);
618
619        BDBG_ASSERT(psSource);
620        BDBG_ASSERT(hTimer);
621
622        hChn = psSource->sElement.hParent;
623
624        rc = BSYNClib_Channel_P_TimerExpired(hChn, hTimer);
625        if (rc) goto end;
626
627        BDBG_MSG(("[%d] Audio source %u unmute timer expired", hChn->iIndex, psSource->sElement.uiIndex));
628
629        if (hChn->sConfig.sMuteControl.bSimultaneousUnmute)
630        {
631                /* TODO: may want to make this fire on longest timeout, instead of shortest */
632                rc = BSYNClib_MuteControl_P_UnmuteAll(hChn);
633        }
634        else
635        {
636                /* unmute the audio */
637                rc = BSYNClib_AudioSource_SetMute(psSource, false);
638        }
639
640end:
641
642        BDBG_LEAVE(BSYNClib_MuteControl_P_AudioSourceUnmuteTimerExpired);
643        return rc;
644}
645
646#if BSYNCLIB_UNCONDITIONAL_AUDIO_UNMUTE_SUPPORT
647BERR_Code BSYNClib_MuteControl_P_AudioSourceUnconditionalUnmuteTimerExpired(void *pvParm1,int iParm2,BSYSlib_Timer_Handle hTimer)
648{
649        BERR_Code rc = BERR_SUCCESS;
650        BSYNClib_AudioSource * psSource = pvParm1;
651        BSYNClib_Channel_Handle hChn;
652       
653        BDBG_ENTER(BSYNClib_MuteControl_P_AudioSourceUnconditionalUnmuteTimerExpired);
654
655        BSTD_UNUSED(iParm2);
656
657        BDBG_ASSERT(psSource);
658        BDBG_ASSERT(hTimer);
659
660        hChn = psSource->sElement.hParent;
661
662        rc = BSYNClib_Channel_P_TimerExpired(hChn, hTimer);
663        if (rc) goto end;
664
665        BDBG_MSG(("[%d] Audio source %u unconditional unmute timer expired", hChn->iIndex, psSource->sElement.uiIndex));
666
667        if (hChn->sConfig.sMuteControl.bSimultaneousUnmute)
668        {
669                /* TODO: may want to make this fire on longest timeout, instead of shortest */
670                rc = BSYNClib_MuteControl_P_UnmuteAll(hChn);
671        }
672        else
673        {
674                /* unmute the audio */
675                rc = BSYNClib_AudioSource_SetMute(psSource, false);
676        }
677
678end:
679
680        BDBG_LEAVE(BSYNClib_MuteControl_P_AudioSourceUnconditionalUnmuteTimerExpired);
681        return rc;
682}
683#endif
684
685#if BSYNCLIB_UNCONDITIONAL_VIDEO_UNMUTE_SUPPORT
686BERR_Code BSYNClib_MuteControl_P_VideoSourceUnconditionalUnmuteTimerExpired(void *pvParm1,int iParm2,BSYSlib_Timer_Handle hTimer)
687{
688        BERR_Code rc = BERR_SUCCESS;
689        BSYNClib_VideoSource * psSource = pvParm1;
690        BSYNClib_Channel_Handle hChn;
691       
692        BDBG_ENTER(BSYNClib_MuteControl_P_VideoSourceUnconditionalUnmuteTimerExpired);
693
694        BSTD_UNUSED(iParm2);
695
696        BDBG_ASSERT(psSource);
697        BDBG_ASSERT(hTimer);
698
699        hChn = psSource->sElement.hParent;
700
701        rc = BSYNClib_Channel_P_TimerExpired(hChn, hTimer);
702        if (rc) goto end;
703
704        BDBG_MSG(("[%d] Video source %u unconditional unmute timer expired", hChn->iIndex, psSource->sElement.uiIndex));
705
706        if (hChn->sConfig.sMuteControl.bSimultaneousUnmute)
707        {
708                /* TODO: may want to make this fire on longest timeout, instead of shortest */
709                rc = BSYNClib_MuteControl_P_UnmuteAll(hChn);
710        }
711        else
712        {
713                /* unmute the video */
714                rc = BSYNClib_VideoSource_SetMute(psSource, false);
715        }
716
717end:
718
719        BDBG_LEAVE(BSYNClib_MuteControl_P_VideoSourceUnconditionalUnmuteTimerExpired);
720        return rc;
721}
722#endif
723
Note: See TracBrowser for help on using the repository browser.