Fix bug in new audio ts parser: hangup.

This commit is contained in:
Johns 2012-02-24 15:22:26 +01:00
parent 668a6ec277
commit 07b426f2b5

View File

@ -474,6 +474,13 @@ void PesParse(PesDemux * pesdx, const uint8_t * data, int size, int is_start)
pesdx->PTS = AV_NOPTS_VALUE; // reset if not yet used pesdx->PTS = AV_NOPTS_VALUE; // reset if not yet used
pesdx->DTS = AV_NOPTS_VALUE; pesdx->DTS = AV_NOPTS_VALUE;
} }
// cleanup, if too much cruft
if (pesdx->Skip > PES_MAX_PAYLOAD / 2) {
// copy remaining bytes down
pesdx->Index -= pesdx->Skip;
memmove(pesdx->Buffer, pesdx->Buffer + pesdx->Skip, pesdx->Index);
pesdx->Skip = 0;
}
p = data; p = data;
do { do {
@ -1001,6 +1008,11 @@ int PlayAudio(const uint8_t * data, int size, uint8_t id)
if ((id == 0xbd || (id & 0xF0) == 0x80) && !r && FastAc3Check(p)) { if ((id == 0xbd || (id & 0xF0) == 0x80) && !r && FastAc3Check(p)) {
r = Ac3Check(p, n); r = Ac3Check(p, n);
codec_id = CODEC_ID_AC3; codec_id = CODEC_ID_AC3;
/* faster ac3 detection at end of pes packet (no improvemnts)
if (AudioCodecID == codec_id && -r - 2 == n) {
r = n;
}
*/
} }
if (r < 0) { // need more bytes if (r < 0) { // need more bytes
break; break;
@ -1067,6 +1079,7 @@ int PlayTsAudio(const uint8_t * data, int size)
if (NewAudioStream) { if (NewAudioStream) {
// FIXME: does this clear the audio ringbuffer? // FIXME: does this clear the audio ringbuffer?
CodecAudioClose(MyAudioDecoder); CodecAudioClose(MyAudioDecoder);
AudioSetBufferTime(216);
AudioCodecID = CODEC_ID_NONE; AudioCodecID = CODEC_ID_NONE;
NewAudioStream = 0; NewAudioStream = 0;
PesReset(PesDemuxAudio); PesReset(PesDemuxAudio);
@ -1828,12 +1841,14 @@ uint8_t *GrabImage(int *size, int jpeg, int quality, int width, int height)
/** /**
** Set play mode, called on channel switch. ** Set play mode, called on channel switch.
**
** @param play_mode play mode (none, video+audio, audio-only, ...)
*/ */
int SetPlayMode(int play_mode) int SetPlayMode(int play_mode)
{ {
if (ConfigStartSuspended) { // ignore first call, if start suspended if (ConfigStartSuspended) { // ignore first call, if start suspended
ConfigStartSuspended = 0; ConfigStartSuspended = 0;
return; return 1;
} }
Resume(); Resume();
VideoDisplayWakeup(); VideoDisplayWakeup();