From 2539465ea11dea456e13c35b42729947cb1ccd02 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 11 Nov 2017 16:29:28 +0100 Subject: [PATCH] try to fix freeze with subtitle file , use gst_element_get_state only if need Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/4846492757738151c38874f0f9444484334ecbe6 Author: Jacek Jendrzej Date: 2017-11-11 (Sat, 11 Nov 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libarmbox/playback_gst.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/libarmbox/playback_gst.cpp b/libarmbox/playback_gst.cpp index a553ea2..2afc737 100644 --- a/libarmbox/playback_gst.cpp +++ b/libarmbox/playback_gst.cpp @@ -843,21 +843,23 @@ bool cPlayback::SetPosition(int position, bool absolute) { lt_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing); - gint64 time_nanoseconds; - gint64 pos; - GstFormat fmt = GST_FORMAT_TIME; - GstState state; if(m_gst_playbin) { - gst_element_get_state(m_gst_playbin, &state, NULL, GST_CLOCK_TIME_NONE); - - if ( (state == GST_STATE_PAUSED) && first) - { - init_jump = position; - first = false; - return false; + if(first){ + GstState state; + gst_element_get_state(m_gst_playbin, &state, NULL, GST_CLOCK_TIME_NONE); + if ( (state == GST_STATE_PAUSED) && first) + { + init_jump = position; + first = false; + return false; + } } + + gint64 time_nanoseconds; + gint64 pos; + GstFormat fmt = GST_FORMAT_TIME; if (!absolute) { gst_element_query_position(m_gst_playbin, fmt, &pos);