summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'device.c')
-rw-r--r--device.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/device.c b/device.c
index ccf176c..6121620 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 2.13 2009/04/05 12:15:41 kls Exp $
+ * $Id: device.c 2.16 2009/04/18 09:41:00 kls Exp $
*/
#include "device.h"
@@ -1075,6 +1075,7 @@ bool cDevice::AttachPlayer(cPlayer *Player)
Detach(player);
DELETENULL(liveSubtitle);
DELETENULL(dvbSubtitleConverter);
+ patPmtParser.Reset();
player = Player;
if (!Transferring())
ClrAvailableTracks(false, true);
@@ -1099,6 +1100,7 @@ void cDevice::Detach(cPlayer *Player)
SetPlayMode(pmNone);
SetVideoDisplayFormat(eVideoDisplayFormat(Setup.VideoDisplayFormat));
PlayTs(NULL, 0);
+ patPmtParser.Reset();
Audios.ClearAudio();
isPlayingVideo = false;
}
@@ -1317,14 +1319,24 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly)
{
int Played = 0;
if (Data == NULL) {
- patPmtParser.Reset();
tsToPesVideo.Reset();
tsToPesAudio.Reset();
tsToPesSubtitle.Reset();
}
+ else if (Length < TS_SIZE) {
+ esyslog("ERROR: skipped %d bytes of TS fragment", Length);
+ return Length;
+ }
else {
cMutexLock MutexLock(&mutexCurrentAudioTrack);
while (Length >= TS_SIZE) {
+ if (Data[0] != TS_SYNC_BYTE) {
+ int Skipped = 1;
+ while (Skipped < Length && (Data[Skipped] != TS_SYNC_BYTE || Length - Skipped > TS_SIZE && Data[Skipped + TS_SIZE] != TS_SYNC_BYTE))
+ Skipped++;
+ esyslog("ERROR: skipped %d bytes to sync on start of TS packet", Skipped);
+ return Played + Skipped;
+ }
if (TsHasPayload(Data)) { // silently ignore TS packets w/o payload
int PayloadOffset = TsPayloadOffset(Data);
if (PayloadOffset < TS_SIZE) {