mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 23:43:00 +02:00
h264: don't mess with packet length
This commit is contained in:
@@ -147,8 +147,8 @@ static int writeData(void* _call)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This seems to make playback unreliable. Disabled for now. --martii
|
||||
if((call->len > 3) && ((call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x00 && call->data[3] == 0x01) ||
|
||||
// This seems to make playback unreliable. Disabled for now. --martii
|
||||
//(call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x01 && NoOtherBeginningFound) ||
|
||||
(call->data[0] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff)))
|
||||
{
|
||||
@@ -291,7 +291,6 @@ static int writeData(void* _call)
|
||||
unsigned int NalStart = 0;
|
||||
unsigned int VideoPosition = 0;
|
||||
|
||||
ic = 0;
|
||||
do {
|
||||
unsigned int NalLength;
|
||||
unsigned char NalData[4];
|
||||
@@ -310,17 +309,12 @@ static int writeData(void* _call)
|
||||
h264_printf(20, "NalStart = %u + NalLength = %u > SampleSize = %u\n", NalStart, NalLength, SampleSize);
|
||||
|
||||
if (NalStart + NalLength > SampleSize) {
|
||||
|
||||
h264_printf(20, "nal length past end of buffer - size %u frame offset %u left %u\n",
|
||||
NalLength, NalStart , SampleSize - NalStart );
|
||||
|
||||
NalStart = SampleSize;
|
||||
} else {
|
||||
NalStart += NalLength;
|
||||
while (NalLength > 0) {
|
||||
unsigned int PacketLength = (NalLength < BUFFER_SIZE) ? NalLength : BUFFER_SIZE;
|
||||
NalLength -= PacketLength;
|
||||
|
||||
ic = 0;
|
||||
iov[ic++].iov_base = PesHeader;
|
||||
|
||||
@@ -328,16 +322,15 @@ static int writeData(void* _call)
|
||||
NalPresent = 0;
|
||||
iov[ic].iov_base = (char *)Head;
|
||||
iov[ic++].iov_len = sizeof(Head);
|
||||
PacketLength += sizeof(Head);
|
||||
}
|
||||
|
||||
iov[ic].iov_base = call->data + VideoPosition;
|
||||
iov[ic++].iov_len = PacketLength;
|
||||
VideoPosition += PacketLength;
|
||||
iov[ic++].iov_len = NalLength;
|
||||
VideoPosition += NalLength;
|
||||
|
||||
h264_printf (20, " pts=%llu\n", VideoPts);
|
||||
|
||||
iov[0].iov_len = InsertPesHeader (PesHeader, PacketLength, MPEG_VIDEO_PES_START_CODE, VideoPts, 0);
|
||||
iov[0].iov_len = InsertPesHeader (PesHeader, NalLength, MPEG_VIDEO_PES_START_CODE, VideoPts, 0);
|
||||
ssize_t l = writev(call->fd, iov, ic);
|
||||
if (l < 0)
|
||||
return l;
|
||||
@@ -345,7 +338,6 @@ static int writeData(void* _call)
|
||||
|
||||
VideoPts = INVALID_PTS_VALUE;
|
||||
}
|
||||
}
|
||||
} while (NalStart < SampleSize);
|
||||
|
||||
if (len < 0)
|
||||
|
@@ -310,7 +310,7 @@ static int PlaybackOpen(Context_t *context, char * uri) {
|
||||
|
||||
} /* upnp */
|
||||
else {
|
||||
playback_err("Unknown stream!\n");
|
||||
playback_err("Unknown stream (%s)\n", uri);
|
||||
return cERR_PLAYBACK_ERROR;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user