aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzard <fuzzard@users.noreply.github.com>2023-09-07 12:47:20 +1000
committerGitHub <noreply@github.com>2023-09-07 12:47:20 +1000
commitdd06f8d34c3cd63436e2d8d1c2e8679907c02c29 (patch)
tree4d21c15d8a093d9fa8774d57b3cc32849c382d68
parent3bf662f88b2b09d66f7f86ae4d94afaad6482f95 (diff)
parent4351bc74937b152334956eebb7e8a1ebac422607 (diff)
downloadxbmc-dd06f8d34c3cd63436e2d8d1c2e8679907c02c29.tar.xz
Merge pull request #23709 from popcornmix/keep_packet
DVDDemuxFFmpeg: Fix issues after st->cur_pts replacement part 3
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp19
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h1
2 files changed, 16 insertions, 4 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index 03388f761b..1f09cccc03 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -1026,7 +1026,7 @@ double CDVDDemuxFFmpeg::ConvertTimestamp(int64_t pts, int den, int num)
return timestamp * DVD_TIME_BASE;
}
-DemuxPacket* CDVDDemuxFFmpeg::Read()
+DemuxPacket* CDVDDemuxFFmpeg::ReadInternal(bool keep)
{
DemuxPacket* pPacket = NULL;
// on some cases where the received packet is invalid we will need to return an empty packet (0 length) otherwise the main loop (in CVideoPlayer)
@@ -1177,13 +1177,19 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
if (pPacket->dts != DVD_NOPTS_VALUE &&
(pPacket->dts > m_currentPts || m_currentPts == DVD_NOPTS_VALUE))
m_currentPts = pPacket->dts;
+ else if (pPacket->pts != DVD_NOPTS_VALUE &&
+ (pPacket->pts > m_currentPts || m_currentPts == DVD_NOPTS_VALUE))
+ m_currentPts = pPacket->pts;
// store internal id until we know the continuous id presented to player
// the stream might not have been created yet
pPacket->iStreamId = m_pkt.pkt.stream_index;
}
- m_pkt.result = -1;
- av_packet_unref(&m_pkt.pkt);
+ if (!keep)
+ {
+ m_pkt.result = -1;
+ av_packet_unref(&m_pkt.pkt);
+ }
}
}
} // end of lock scope
@@ -1243,6 +1249,11 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
return pPacket;
}
+DemuxPacket* CDVDDemuxFFmpeg::Read()
+{
+ return ReadInternal(false);
+}
+
bool CDVDDemuxFFmpeg::SeekTime(double time, bool backwards, double* startpts)
{
bool hitEnd = false;
@@ -1358,7 +1369,7 @@ bool CDVDDemuxFFmpeg::SeekTime(double time, bool backwards, double* startpts)
m_pkt.result = -1;
av_packet_unref(&m_pkt.pkt);
- DemuxPacket* pkt = Read();
+ DemuxPacket* pkt = ReadInternal(true);
if (!pkt)
{
KODI::TIME::Sleep(10ms);
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h
index 2cf4707e6f..03fb98552c 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h
@@ -92,6 +92,7 @@ public:
std::string GetFileName() override;
DemuxPacket* Read() override;
+ DemuxPacket* ReadInternal(bool keep);
bool SeekTime(double time, bool backwards = false, double* startpts = NULL) override;
bool SeekByte(int64_t pos);