From b464dc407d5fba192abb0c9d4ca2f35fb438adcc Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 8 Jan 2006 10:13:38 +0100 Subject: [PATCH] Added a mutex to synchronize cDevice::PlayPesPacket() and SetCurrentAudioTrack() --- CONTRIBUTORS | 1 + HISTORY | 4 +++- device.c | 4 +++- device.h | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a946dd0f..36ae8de8 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1019,6 +1019,7 @@ Reinhard Nissl for suggesting to make the DVB devices retune (and, if applicable, resend the DiSEqC data) if the lock is lost for fixing handling TS packets in cTS2PES + for adding a mutex to synchronize cDevice::PlayPesPacket() and SetCurrentAudioTrack() Richard Robson for reporting freezing replay if a timer starts while in Transfer Mode from the diff --git a/HISTORY b/HISTORY index 085fa96f..deb44297 100644 --- a/HISTORY +++ b/HISTORY @@ -3963,7 +3963,7 @@ Video Disk Recorder Revision History commands may now be executed at any time, and the message will be displayed (no more "pending message"). -2006-01-07: Version 1.3.38 +2006-01-08: Version 1.3.38 - Fixed handling second audio and Dolby Digital PIDs for encrypted channels (was broken in version 1.3.37). @@ -4129,3 +4129,5 @@ Video Disk Recorder Revision History - The file 'ca.conf' is obsolete and has been removed. - Revised all descriptions regarding CICAM. - Adapted c(Dvb)Device::ProvidesCa() to the dynamic CA handling. +- Added a mutex to synchronize cDevice::PlayPesPacket() and SetCurrentAudioTrack() + (thanks to Reinhard Nissl). diff --git a/device.c b/device.c index cd896a21..04efab54 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.119 2006/01/07 14:50:45 kls Exp $ + * $Id: device.c 1.120 2006/01/08 10:11:42 kls Exp $ */ #include "device.h" @@ -830,6 +830,7 @@ int cDevice::NumAudioTracks(void) const bool cDevice::SetCurrentAudioTrack(eTrackType Type) { if (ttNone < Type && Type < ttDolbyLast) { + cMutexLock MutexLock(&mutexCurrentAudioTrack); if (IS_DOLBY_TRACK(Type)) SetDigitalAudioDevice(true); currentAudioTrack = Type; @@ -983,6 +984,7 @@ int cDevice::PlayAudio(const uchar *Data, int Length) int cDevice::PlayPesPacket(const uchar *Data, int Length, bool VideoOnly) { + cMutexLock MutexLock(&mutexCurrentAudioTrack); bool FirstLoop = true; uchar c = Data[3]; const uchar *Start = Data; diff --git a/device.h b/device.h index 6e1df435..eb409f9c 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.69 2006/01/07 14:50:45 kls Exp $ + * $Id: device.h 1.70 2006/01/08 10:10:26 kls Exp $ */ #ifndef __DEVICE_H @@ -344,6 +344,7 @@ public: private: tTrackId availableTracks[ttMaxTrackTypes]; eTrackType currentAudioTrack; + cMutex mutexCurrentAudioTrack; int currentAudioTrackMissingCount; bool pre_1_3_19_PrivateStream; protected: