From cc1e2de58ba213d79f20ad4d80609ede45470edc Mon Sep 17 00:00:00 2001 From: Johns Date: Mon, 15 Jul 2013 17:00:22 +0200 Subject: [PATCH] Reduce PES error messages. --- ChangeLog | 1 + softhddev.c | 17 ++++++++++++++++- softhddevice.cpp | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b76074..9b36222 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ User johns Date: + Reduce PES error messages. Fix bug #1392: Wrong value for mixing LFE. Fix bug: wrong grab size, introduced with AMD VDPAU. Use VDR SPU decoder as default. diff --git a/softhddev.c b/softhddev.c index 9ce0c7c..de3c5d7 100644 --- a/softhddev.c +++ b/softhddev.c @@ -1316,6 +1316,8 @@ struct __video_stream__ volatile char ClearBuffers; ///< command clear video buffers volatile char ClearClose; ///< clear video buffers for close + int InvalidPesCounter; ///< counter of invalid PES packets + AVPacket PacketRb[VIDEO_PACKET_MAX]; ///< PES packet ring buffer int StartCodeState; ///< last three bytes start code state @@ -1756,6 +1758,7 @@ static void VideoStreamClose(VideoStream * stream) VideoPacketExit(stream); stream->NewStream = 1; + stream->InvalidPesCounter = 0; } /** @@ -2012,6 +2015,7 @@ static void StopVideo(void) VideoPacketExit(MyVideoStream); MyVideoStream->NewStream = 1; + MyVideoStream->InvalidPesCounter = 0; } #ifdef DEBUG @@ -2141,9 +2145,18 @@ int PlayVideo3(VideoStream * stream, const uint8_t * data, int size) // must be a PES start code // FIXME: Valgrind-3.8.1 has a problem with this code if (size < 9 || !data || data[0] || data[1] || data[2] != 0x01) { - Error(_("[softhddev] invalid PES video packet\n")); + if (!stream->InvalidPesCounter++) { + Error(_("[softhddev] invalid PES video packet\n")); + } return size; } + if (stream->InvalidPesCounter) { + if (stream->InvalidPesCounter > 1) { + Error(_("[softhddev] %d invalid PES video packet(s)\n"), + stream->InvalidPesCounter); + } + stream->InvalidPesCounter = 0; + } // 0xBE, filler, padding stream if (data[3] == PES_PADDING_STREAM) { // from DVD plugin return size; @@ -2410,6 +2423,7 @@ int SetPlayMode(int play_mode) } if (MyVideoStream->CodecID != CODEC_ID_NONE) { MyVideoStream->NewStream = 1; + MyVideoStream->InvalidPesCounter = 0; // tell hw decoder we are closing stream VideoSetClosing(MyVideoStream->HwDecoder); VideoResetStart(MyVideoStream->HwDecoder); @@ -3426,6 +3440,7 @@ void PipStop(void) VideoPacketExit(PipVideoStream); PipVideoStream->NewStream = 1; + PipVideoStream->InvalidPesCounter = 0; #else PipVideoStream->Close = 1; for (i = 0; PipVideoStream->Close && i < 50; ++i) { diff --git a/softhddevice.cpp b/softhddevice.cpp index 8bda7cd..825035f 100644 --- a/softhddevice.cpp +++ b/softhddevice.cpp @@ -1443,12 +1443,12 @@ static void PipPesParse(const uint8_t * data, int size, int is_start) if (is_start) { // start of pes packet if (pes_index) { if (0) { - fprintf(stderr, "pip: pes packet %8d %02x%02x\n", pes_index, + fprintf(stderr, "pip: PES packet %8d %02x%02x\n", pes_index, pes_buf[2], pes_buf[3]); } if (pes_buf[0] || pes_buf[1] || pes_buf[2] != 0x01) { // FIXME: first should always fail - esyslog(tr("[softhddev]pip: invalid pes packet %d\n"), + esyslog(tr("[softhddev]pip: invalid PES packet %d\n"), pes_index); } else { PipPlayVideo(pes_buf, pes_index);