From f469ae89505e6800e0e2809d859afceeea9688ee Mon Sep 17 00:00:00 2001 From: TangoCash Date: Sun, 4 Oct 2020 17:52:21 +0200 Subject: [PATCH] fix position / duration hisilicon playback --- libarmbox/playback_hisilicon.cpp | 39 +++----------------------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/libarmbox/playback_hisilicon.cpp b/libarmbox/playback_hisilicon.cpp index adb7852..787bc0b 100644 --- a/libarmbox/playback_hisilicon.cpp +++ b/libarmbox/playback_hisilicon.cpp @@ -359,44 +359,11 @@ bool cPlayback::GetPosition(int &position, int &duration) if (!playing) return false; - int64_t vpts = 0; - //::ioctl(videoDecoder->fd, VIDEO_GET_PTS, &vpts); - vpts = videoDecoder->GetPTS(); - - if (vpts <= 0) - { - printf("ERROR: vpts==0\n"); - } - else - { - /* workaround for crazy vpts value during timeshift */ - if (!got_vpts_ts && pm == PLAYMODE_TS) - { - vpts_ts = vpts; - got_vpts_ts = true; - } - if (got_vpts_ts) - vpts -= vpts_ts; - /* end workaround */ - /* len is in nanoseconds. we have 90 000 pts per second. */ - position = vpts / 90; - } - if (got_duration) return true; - int64_t length = 0; - - length = netlink_event::getInstance()->getDuration() * 1000; - - if (length <= 0) - { - duration = duration + 1000; - } - else - { - duration = length * 1000; - } + position = videoDecoder->GetPTS() / 90LL; + duration = netlink_event::getInstance()->getDuration(); return true; } @@ -418,7 +385,7 @@ bool cPlayback::SetPosition(int position, bool absolute) return false; } - int64_t pos = (position / 1000.0); + int64_t pos = position; if (!absolute) {