summaryrefslogtreecommitdiff
path: root/remux.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-08-28 21:25:17 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-08-28 21:25:17 +0200
commitb28336340d8bb7cde1b9929014a99794493f31a0 (patch)
tree025cf48cb175cb1980219160424952cd8c5dbb4e /remux.c
parent1f4f85a82e4e94680c17db1aa993f82ffed11973 (diff)
downloadvdr-b28336340d8bb7cde1b9929014a99794493f31a0.tar.gz
vdr-b28336340d8bb7cde1b9929014a99794493f31a0.tar.bz2
Fixed syncing in cRepacker
Diffstat (limited to 'remux.c')
-rw-r--r--remux.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/remux.c b/remux.c
index d5c82dbb..77ead28d 100644
--- a/remux.c
+++ b/remux.c
@@ -11,7 +11,7 @@
* The cRepacker family's code was originally written by Reinhard Nissl <rnissl@gmx.de>,
* and adapted to the VDR coding style by Klaus.Schmidinger@cadsoft.de.
*
- * $Id: remux.c 1.43 2005/08/28 21:03:35 kls Exp $
+ * $Id: remux.c 1.44 2005/08/28 21:24:34 kls Exp $
*/
#include "remux.h"
@@ -142,7 +142,7 @@ void cCommonRepacker::Reset(void)
{
cRepacker::Reset();
skippedBytes = 0;
- packetTodo = maxPacketSize - 6 - 3;
+ packetTodo = 0;
fragmentLen = 0;
pesHeaderLen = 0;
pesHeaderBackupLen = 0;
@@ -361,7 +361,7 @@ void cVideoRepacker::Repack(cRingBufferLinear *ResultBuffer, const uchar *Data,
done++;
todo--;
// do we have to start a new packet as there is no more space left?
- if (--packetTodo <= 0) {
+ if (state != syncing && --packetTodo <= 0) {
// we connot start a new packet here if the current might end in a start
// code and this start code shall possibly be put in the next packet. So
// overfill the current packet until we can safely detect that we won't
@@ -468,6 +468,9 @@ void cVideoRepacker::Repack(cRingBufferLinear *ResultBuffer, const uchar *Data,
int cVideoRepacker::BreakAt(const uchar *Data, int Count)
{
+ if (initiallySyncing)
+ return -1; // fill the packet buffer completely until we have synced once
+
int PesPayloadOffset = 0;
if (AnalyzePesHeader(Data, Count, PesPayloadOffset) <= phInvalid)
@@ -726,7 +729,7 @@ void cAudioRepacker::Repack(cRingBufferLinear *ResultBuffer, const uchar *Data,
done++;
todo--;
// do we have to start a new packet as there is no more space left?
- if (--packetTodo <= 0) {
+ if (state != syncing && --packetTodo <= 0) {
// We connot start a new packet here if the current might end in an audio
// frame header and this header shall possibly be put in the next packet. So
// overfill the current packet until we can safely detect that we won't
@@ -830,6 +833,9 @@ void cAudioRepacker::Repack(cRingBufferLinear *ResultBuffer, const uchar *Data,
int cAudioRepacker::BreakAt(const uchar *Data, int Count)
{
+ if (initiallySyncing)
+ return -1; // fill the packet buffer completely until we have synced once
+
int PesPayloadOffset = 0;
ePesHeader MpegLevel = AnalyzePesHeader(Data, Count, PesPayloadOffset);
@@ -1183,6 +1189,8 @@ void cDolbyRepacker::Repack(cRingBufferLinear *ResultBuffer, const uchar *Data,
int cDolbyRepacker::BreakAt(const uchar *Data, int Count)
{
+ if (initiallySyncing)
+ return -1; // fill the packet buffer completely until we have synced once
// enough data for test?
if (Count < 6 + 3)
return -1;