Fixed detecting frames in case the Picture Start Code or Access Unit Delimiter extends over TS packet boundaries

This commit is contained in:
Klaus Schmidinger 2011-06-11 11:28:13 +02:00
parent 1afb2cf1c2
commit b226ab46d6
3 changed files with 19 additions and 2 deletions

View File

@ -2711,3 +2711,7 @@ Dirk Leber <dirk.leber@reel-multimedia.com>
Marco Göbenich <mg@needful.de>
for reporting a problem with executing diseqc commands from different threads
Johan Andersson <jna@jna.pp.se>
for reporting a bug in detecting frames in case the Picture Start Code or Access Unit
Delimiter extends over TS packet boundaries

View File

@ -6607,7 +6607,7 @@ Video Disk Recorder Revision History
- Avoiding an unecessary call to Recordings.ResetResume() (thanks to Reinhard
Nissl).
2011-06-02: Version 1.7.19
2011-06-11: Version 1.7.19
- Fixed cString's operator=(const char *String) in case the given string is the
same as the existing one (thanks to Dirk Leber).
@ -6632,3 +6632,5 @@ Video Disk Recorder Revision History
indicating the strength (upper bar) and quality (lower bar) of the received signal.
The number to the left of these bars indicates the actual device the current
channel is being received with.
- Fixed detecting frames in case the Picture Start Code or Access Unit Delimiter
extends over TS packet boundaries (reported by Johan Andersson).

13
remux.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remux.c 2.53 2011/03/20 10:21:14 kls Exp $
* $Id: remux.c 2.54 2011/06/11 11:20:06 kls Exp $
*/
#include "remux.h"
@ -906,9 +906,20 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
if (DebugFrames && !synced)
dbgframes("/");
}
int PacketsForFrameDetector = MIN_TS_PACKETS_FOR_FRAME_DETECTOR;
for (int i = PayloadOffset; scanning && i < TS_SIZE; i++) {
scanner <<= 8;
scanner |= Data[i];
if (i == TS_SIZE - 1) { // it was the last byte in this TS packet
if (SeenPayloadStart && --PacketsForFrameDetector > 0) {
Data += TS_SIZE;
Length -= TS_SIZE;
Processed += TS_SIZE;
if (Length < TS_SIZE)
return Processed;
i = TsPayloadOffset(Data) - 1; // one before the first payload byte of the next TS packet
}
}
switch (type) {
case 0x01: // MPEG 1 video
case 0x02: // MPEG 2 video