From b88c0ed35fa6f215bc5ffb7a79bdcdaef5578ed2 Mon Sep 17 00:00:00 2001 From: Thomas Reufer Date: Tue, 3 Feb 2015 20:08:51 +0100 Subject: don't clear audio PTS when parser shrinks the packet buffer --- HISTORY | 3 +++ audio.c | 17 ++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/HISTORY b/HISTORY index 949f2d9..29ea5ba 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,9 @@ VDR Plugin 'rpihddevice' Revision History ----------------------------------------- +- fixed: + - don't clear audio PTS when parser shrinks the packet buffer + 2015-01-21: Version 0.0.11 -------------------------- - new: diff --git a/audio.c b/audio.c index 34168ca..c58471b 100644 --- a/audio.c +++ b/audio.c @@ -196,7 +196,7 @@ public: return ret; } - void Shrink(unsigned int length) + void Shrink(unsigned int length, bool retainPts = false) { m_mutex->Lock(); @@ -206,11 +206,6 @@ public: m_size -= length; memset(m_packet.data + m_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - // clear current PTS since it's not valid anymore after - // shrinking the packet - if (!m_ptsQueue.empty()) - m_ptsQueue.front()->pts = 0; - while (!m_ptsQueue.empty() && length) { if (m_ptsQueue.front()->length <= length) @@ -221,8 +216,12 @@ public: } else { - m_ptsQueue.front()->pts = 0; - length -= m_ptsQueue.front()->length -= length; + // clear current PTS since it's not valid anymore after + // shrinking the packet + if (!retainPts) + m_ptsQueue.front()->pts = 0; + + m_ptsQueue.front()->length -= length; length = 0; } } @@ -321,7 +320,7 @@ private: if (offset) { DBG("audio parser skipped %u of %u bytes", offset, m_size); - Shrink(offset); + Shrink(offset, true); } if (codec != cAudioCodec::eInvalid) -- cgit v1.2.3