try to fix freeze with subtitle file , use gst_element_get_state only if need

This commit is contained in:
Jacek Jendrzej
2017-11-11 16:29:28 +01:00
parent bc4a9b3329
commit 2864b81fe2

View File

@@ -841,21 +841,23 @@ bool cPlayback::SetPosition(int position, bool absolute)
{ {
lt_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing); 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) if(m_gst_playbin)
{ {
gst_element_get_state(m_gst_playbin, &state, NULL, GST_CLOCK_TIME_NONE); if(first){
GstState state;
if ( (state == GST_STATE_PAUSED) && first) gst_element_get_state(m_gst_playbin, &state, NULL, GST_CLOCK_TIME_NONE);
{ if ( (state == GST_STATE_PAUSED) && first)
init_jump = position; {
first = false; init_jump = position;
return false; first = false;
return false;
}
} }
gint64 time_nanoseconds;
gint64 pos;
GstFormat fmt = GST_FORMAT_TIME;
if (!absolute) if (!absolute)
{ {
gst_element_query_position(m_gst_playbin, fmt, &pos); gst_element_query_position(m_gst_playbin, fmt, &pos);