summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2009-04-13 11:08:05 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2009-04-13 11:08:05 +0200
commit3628bbbfa16288d548a4b64a67c163699c08d06f (patch)
tree796c015d55d2c12ebaf504ace3dcc9839e6fe59d /device.c
parent1d829aaf6d263725379a5940adefbafa88af398d (diff)
downloadvdr-3628bbbfa16288d548a4b64a67c163699c08d06f.tar.gz
vdr-3628bbbfa16288d548a4b64a67c163699c08d06f.tar.bz2
cDevice::PlayTs() now syncs on the TS packet sync bytes
Diffstat (limited to 'device.c')
-rw-r--r--device.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/device.c b/device.c
index ccf176c4..f5a908de 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.14 2009/04/13 11:08:05 kls Exp $
*/
#include "device.h"
@@ -1322,9 +1322,20 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly)
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) {