Skip to content

Commit

Permalink
[package] [mediacenter-osmc] Vero 4K: video scheme improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Nazarko <email@samnazarko.co.uk>
  • Loading branch information
samnazarko committed Nov 1, 2017
1 parent d32d11f commit 49a6cd9
Show file tree
Hide file tree
Showing 9 changed files with 651 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package/mediacenter-osmc/files/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Origin: OSMC
Version: 17.5.0-5
Version: 17.5.0-6
Section: video
Essential: No
Priority: required
Expand Down
19 changes: 19 additions & 0 deletions package/mediacenter-osmc/patches/vero3-090-fps-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From: afl1
Date: 2017/10/5
Subject: [PATCH] VideoPlayer: fps fix

--- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp 2017-04-29 09:01:26.783510000 +0200
+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp 2017-04-29 09:50:16.543658000 +0200
@@ -3583,6 +3583,10 @@

if(m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD))
hint.filename = "dvd";
+ if (hint.fpsrate / hint.fpsscale > 200) {
+ hint.fpsrate = 60000;
+ hint.fpsscale = 1001;
+ }
}
else if(STREAM_SOURCE_MASK(source) == STREAM_SOURCE_VIDEOMUX)
{
if (!OpenAmlVideo(hints))
--
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h 2017-08-21 19:42:52.030136000 +0200
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h 2017-08-21 21:01:34.404118620 +0200
@@ -62,7 +62,7 @@
private:

int m_iRenderBuffer;
- static const int m_numRenderBuffers = 4;
+ static const int m_numRenderBuffers = 8;

struct BUFFER
{
--- a/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h 2017-08-21 19:42:52.030136000 +0200
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h 2017-08-21 21:01:34.404118620 +0200
@@ -30,7 +30,7 @@

#define MAX_PLANES 3
#define MAX_FIELDS 3
-#define NUM_BUFFERS 6
+#define NUM_BUFFERS 8

class CSetting;

--
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
From: afl1
Date: 2017/10/05
Subject: [PATCH] VideoPlayer: chapter seek fix

--- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
@@ -2619,6 +2641,7 @@ void CVideoPlayer::HandleMessages()
{
FlushBuffers(start, true, true);
offset = DVD_TIME_TO_MSEC(start) - beforeSeek;
+ CLog::Log(LOGDEBUG, "VideoPlayer: SeekChapter:%d beforeSeek:%0.3f start:%0.3f", msg.GetChapter(), beforeSeek / 1000.0, start / 1000000.0);
m_callback.OnPlayBackSeekChapter(msg.GetChapter());
}

@@ -2692,12 +2692,14 @@
mode.accurate = true;
mode.trickplay = true;
mode.sync = true;
+ CLog::Log(LOGDEBUG, "VideoPlayer: Videostream seek: %d", mode.time);
m_messenger.Put(new CDVDMsgPlayerSeek(mode));
}
}
else
{
CloseStream(m_CurrentVideo, false);
+ CLog::Log(LOGDEBUG, "VideoPlayer: Reopen Videostream: %d id:%d", st.demuxerId, st.id);
OpenStream(m_CurrentVideo, st.demuxerId, st.id, st.source);
CDVDMsgPlayerSeek::CMode mode;
mode.time = (int)GetTime();
@@ -2705,6 +2707,7 @@
mode.accurate = true;
mode.trickplay = true;
mode.sync = true;
+ CLog::Log(LOGDEBUG, "VideoPlayer: Videostream seek: %d", mode.time);
m_messenger.Put(new CDVDMsgPlayerSeek(mode));
}
}
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp 2017-08-22 23:43:15.624322029 +0200
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp 2017-08-23 08:52:34.490227481 +0200
@@ -1118,6 +1118,7 @@
if (m_pFormatContext->start_time != (int64_t)AV_NOPTS_VALUE && !ismp3)
seek_pts += m_pFormatContext->start_time;

+ CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::%s - seek pts:%0.4f start_time:%lld", __FUNCTION__, (double)seek_pts/AV_TIME_BASE, m_pFormatContext->start_time);
int ret;
{
CSingleLock lock(m_critSection);
@@ -1146,11 +1146,28 @@
if(m_currentPts == DVD_NOPTS_VALUE)
CLog::Log(LOGDEBUG, "%s - unknown position after seek", __FUNCTION__);
else
- CLog::Log(LOGDEBUG, "%s - seek ended up on time %d", __FUNCTION__, (int)(m_currentPts / DVD_TIME_BASE * 1000));
-
+ {
+ CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::%s - seek ended up on time %0.3fs", __FUNCTION__, m_currentPts / DVD_TIME_BASE);
+ double diff = (double)seek_pts/AV_TIME_BASE - m_currentPts / DVD_TIME_BASE;
+ if (diff > 1.0)
+ {
+ ret = av_seek_frame(m_pFormatContext, -1, seek_pts + (int)(diff * AV_TIME_BASE / 2), backwards ? AVSEEK_FLAG_BACKWARD : 0);
+ if (ret >= 0)
+ UpdateCurrentPTS();
+ CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::%s - 2.seek ended up on time %0.3fs", __FUNCTION__, m_currentPts / DVD_TIME_BASE);
+ double diff1 = (double)seek_pts/AV_TIME_BASE - m_currentPts / DVD_TIME_BASE;
+ if (diff1 > 1.0)
+ {
+ ret = av_seek_frame(m_pFormatContext, -1, seek_pts + (int)((diff + diff1) * AV_TIME_BASE / 2), backwards ? AVSEEK_FLAG_BACKWARD : 0);
+ if (ret >= 0)
+ UpdateCurrentPTS();
+ CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::%s - 3.seek ended up on time %0.3fs", __FUNCTION__, m_currentPts / DVD_TIME_BASE);
+ }
+ }
+ }
// in this case the start time is requested time
if (startpts)
- *startpts = DVD_MSEC_TO_TIME(time);
+ *startpts = DVD_MSEC_TO_TIME(m_currentPts/1000);

if (ret >= 0)
{
@@ -1717,7 +1717,9 @@

AVChapter *ch = m_pFormatContext->chapters[chapter-1];
double dts = ConvertTimestamp(ch->start, ch->time_base.den, ch->time_base.num);
- return SeekTime(DVD_TIME_TO_MSEC(dts), true, startpts);
+ bool rtn = SeekTime(DVD_TIME_TO_MSEC(dts), true, startpts);
+ CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::%s - seeking chapter:%d start:%0.3f startpts:%0.3f ", __FUNCTION__, chapter, (double)ch->start * ch->time_base.num / ch->time_base.den, DVD_TIME_TO_MSEC(*startpts) / 1000.0);
+ return rtn;
}

std::string CDVDDemuxFFmpeg::GetStreamCodecName(int iStreamId)
--
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
From: afl1
Date: 2017/10/5
Subject: [PATCH] VideoPlayer: channel zapping optimalization

diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
index ce0f01a..1adf29d 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
@@ -1895,5 +1895,6 @@ void CVideoPlayer::HandlePlaySpeed()

if (m_caching == CACHESTATE_INIT)
{
+// m_clock.Discontinuity(DVD_MSEC_TO_TIME(-300));
// if all enabled streams have been inited we are done
if ((m_CurrentVideo.id >= 0 || m_CurrentAudio.id >= 0) &&
@@ -1963,15 +1963,17 @@ void CVideoPlayer::HandlePlaySpeed()
// care for live streams
else if (m_pInputStream->IsRealtime())
{
- if (m_CurrentAudio.id >= 0)
+ if (m_CurrentAudio.id >= 0 && m_clock.GetClock() > DVD_MSEC_TO_TIME(1000))
{
double adjust = -1.0; // a unique value
- if (m_clock.GetSpeedAdjust() >= 0 && m_VideoPlayerAudio->GetLevel() < 5)
- adjust = -0.05;
-
- if (m_clock.GetSpeedAdjust() < 0 && m_VideoPlayerAudio->GetLevel() > 10)
+ if (m_clock.GetSpeedAdjust() >= 0 && m_VideoPlayerAudio->GetLevel() < 1) {
+ CLog::Log(LOGDEBUG, "VideoPlayer:Speed adjust:-0.05 aq:%d", m_VideoPlayerAudio->GetLevel());
+ adjust = -0.05;
+ }
+ if (m_clock.GetSpeedAdjust() < 0 && m_VideoPlayerAudio->GetLevel() > 4) {
+ CLog::Log(LOGDEBUG, "VideoPlayer:Speed adjust:0.0 aq:%d", m_VideoPlayerAudio->GetLevel());
adjust = 0.0;
-
+ }
if (adjust != -1.0)
{
m_clock.SetSpeedAdjust(adjust);
@@ -2008,11 +2027,11 @@ void CVideoPlayer::HandlePlaySpeed()
{
double clock = 0;
if (m_CurrentAudio.syncState == IDVDStreamPlayer::SYNC_WAITSYNC)
- CLog::Log(LOGDEBUG, "VideoPlayer::Sync - Audio - pts: %f, cache: %f, totalcache: %f",
- m_CurrentAudio.starttime, m_CurrentAudio.cachetime, m_CurrentAudio.cachetotal);
+ CLog::Log(LOGDEBUG, "VideoPlayer::Sync - Audio - pts: %0.3f, cache: %0.3f, totalcache: %0.3f, packets:%d",
+ m_CurrentAudio.starttime/1000, m_CurrentAudio.cachetime/1000, m_CurrentAudio.cachetotal/1000, m_CurrentAudio.packets);
if (m_CurrentVideo.syncState == IDVDStreamPlayer::SYNC_WAITSYNC)
- CLog::Log(LOGDEBUG, "VideoPlayer::Sync - Video - pts: %f, cache: %f, totalcache: %f",
- m_CurrentVideo.starttime, m_CurrentVideo.cachetime, m_CurrentVideo.cachetotal);
+ CLog::Log(LOGDEBUG, "VideoPlayer::Sync - Video - pts: %0.3f, cache: %0.3f, totalcache: %0.3f, packets:%d",
+ m_CurrentVideo.starttime/1000, m_CurrentVideo.cachetime/1000, m_CurrentVideo.cachetotal/1000, m_CurrentVideo.packets);

if (m_CurrentVideo.starttime != DVD_NOPTS_VALUE && m_CurrentVideo.packets > 0 &&
m_playSpeed == DVD_PLAYSPEED_PAUSE)
@@ -2028,9 +2047,9 @@ void CVideoPlayer::HandlePlaySpeed()
else if (m_CurrentAudio.starttime != DVD_NOPTS_VALUE && m_CurrentAudio.packets > 0)
{
if (m_pInputStream->IsRealtime())
- clock = m_CurrentAudio.starttime - m_CurrentAudio.cachetotal - DVD_MSEC_TO_TIME(400);
+ clock = m_CurrentAudio.starttime - DVD_MSEC_TO_TIME(200); //- m_CurrentAudio.cachetime + 14000.0 * static_cast<double>(static_cast<int>(m_CurrentAudio.packets) - 60);
else
- clock = m_CurrentAudio.starttime - m_CurrentAudio.cachetime;
+ clock = m_CurrentAudio.starttime - m_CurrentAudio.cachetime - DVD_MSEC_TO_TIME(750);
if (m_CurrentVideo.starttime != DVD_NOPTS_VALUE &&
(m_CurrentVideo.packets > 0) &&
m_CurrentVideo.starttime - m_CurrentVideo.cachetotal < clock)
diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
index 38428e2..4279440 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
@@ -293,12 +293,14 @@ void CVideoPlayerAudio::Process()
// while AE sync is active, we still have time to fill buffers
if (m_syncTimer.IsTimePast())
{
- CLog::Log(LOGNOTICE, "CVideoPlayerAudio::Process - stream stalled");
+ CLog::Log(LOGNOTICE, "CVideoPlayerAudio::Process - stream stalled timeout:%d initialTimeout:%d startTime:%d MillisLeft:%d", timeout, m_syncTimer.GetInitialTimeoutValue(), m_syncTimer.GetStartTime(), m_syncTimer.MillisLeft());
m_stalled = true;
}
}
- if (timeout == 0)
- Sleep(10);
+ if (timeout == 0) {
+ CLog::Log(LOGNOTICE, "CVideoPlayerAudio::Process - sleep 0.05 sec");
+ usleep(50000);
+ }
continue;
}

--
Loading

0 comments on commit 49a6cd9

Please sign in to comment.