playbin: Fix logic to detect if a stream-change is currently pending
Fixes duration reporting in gapless playback between files. https://bugzilla.gnome.org/show_bug.cgi?id=585969
This commit is contained in:
parent
6da245962d
commit
f174c450c9
@ -359,7 +359,7 @@ struct _GstSourceGroup
|
|||||||
gulong block_id;
|
gulong block_id;
|
||||||
|
|
||||||
GMutex stream_changed_pending_lock;
|
GMutex stream_changed_pending_lock;
|
||||||
GList *stream_changed_pending;
|
gboolean stream_changed_pending;
|
||||||
|
|
||||||
/* to prevent that suburidecodebin seek flushes disrupt playback */
|
/* to prevent that suburidecodebin seek flushes disrupt playback */
|
||||||
GMutex suburi_flushes_to_drop_lock;
|
GMutex suburi_flushes_to_drop_lock;
|
||||||
@ -1274,6 +1274,10 @@ init_group (GstPlayBin * playbin, GstSourceGroup * group)
|
|||||||
group->audio_channels = g_ptr_array_new ();
|
group->audio_channels = g_ptr_array_new ();
|
||||||
group->text_channels = g_ptr_array_new ();
|
group->text_channels = g_ptr_array_new ();
|
||||||
g_mutex_init (&group->lock);
|
g_mutex_init (&group->lock);
|
||||||
|
|
||||||
|
group->stream_changed_pending = FALSE;
|
||||||
|
g_mutex_init (&group->stream_changed_pending_lock);
|
||||||
|
|
||||||
/* init combiners. The combiner is found by finding the first prefix that
|
/* init combiners. The combiner is found by finding the first prefix that
|
||||||
* matches the media. */
|
* matches the media. */
|
||||||
group->playbin = playbin;
|
group->playbin = playbin;
|
||||||
@ -1320,12 +1324,8 @@ free_group (GstPlayBin * playbin, GstSourceGroup * group)
|
|||||||
gst_object_unref (group->text_sink);
|
gst_object_unref (group->text_sink);
|
||||||
group->text_sink = NULL;
|
group->text_sink = NULL;
|
||||||
|
|
||||||
g_list_free (group->stream_changed_pending);
|
group->stream_changed_pending = FALSE;
|
||||||
group->stream_changed_pending = NULL;
|
g_mutex_clear (&group->stream_changed_pending_lock);
|
||||||
|
|
||||||
if (group->stream_changed_pending_lock.p)
|
|
||||||
g_mutex_clear (&group->stream_changed_pending_lock);
|
|
||||||
group->stream_changed_pending_lock.p = NULL;
|
|
||||||
|
|
||||||
g_slist_free (group->suburi_flushes_to_drop);
|
g_slist_free (group->suburi_flushes_to_drop);
|
||||||
group->suburi_flushes_to_drop = NULL;
|
group->suburi_flushes_to_drop = NULL;
|
||||||
@ -2605,13 +2605,9 @@ gst_play_bin_query (GstElement * element, GstQuery * query)
|
|||||||
gboolean pending;
|
gboolean pending;
|
||||||
|
|
||||||
GST_SOURCE_GROUP_LOCK (group);
|
GST_SOURCE_GROUP_LOCK (group);
|
||||||
if (group->stream_changed_pending_lock.p) {
|
|
||||||
g_mutex_lock (&group->stream_changed_pending_lock);
|
pending = group->pending || group->stream_changed_pending;
|
||||||
pending = group->pending || group->stream_changed_pending;
|
|
||||||
g_mutex_unlock (&group->stream_changed_pending_lock);
|
|
||||||
} else {
|
|
||||||
pending = group->pending;
|
|
||||||
}
|
|
||||||
if (pending) {
|
if (pending) {
|
||||||
GstFormat fmt;
|
GstFormat fmt;
|
||||||
gint i;
|
gint i;
|
||||||
@ -2691,6 +2687,10 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
|
|||||||
gst_message_unref (msg);
|
gst_message_unref (msg);
|
||||||
msg = NULL;
|
msg = NULL;
|
||||||
}
|
}
|
||||||
|
} else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_STREAM_START) {
|
||||||
|
GstSourceGroup *new_group = playbin->curr_group;
|
||||||
|
|
||||||
|
new_group->stream_changed_pending = FALSE;
|
||||||
} else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
|
} else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
|
||||||
/* If we get an error of the subtitle uridecodebin transform
|
/* If we get an error of the subtitle uridecodebin transform
|
||||||
* them into warnings and disable the subtitles */
|
* them into warnings and disable the subtitles */
|
||||||
@ -4783,11 +4783,6 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_list_free (group->stream_changed_pending);
|
|
||||||
group->stream_changed_pending = NULL;
|
|
||||||
if (!group->stream_changed_pending_lock.p)
|
|
||||||
g_mutex_init (&group->stream_changed_pending_lock);
|
|
||||||
|
|
||||||
g_slist_free (group->suburi_flushes_to_drop);
|
g_slist_free (group->suburi_flushes_to_drop);
|
||||||
group->suburi_flushes_to_drop = NULL;
|
group->suburi_flushes_to_drop = NULL;
|
||||||
if (!group->suburi_flushes_to_drop_lock.p)
|
if (!group->suburi_flushes_to_drop_lock.p)
|
||||||
@ -5123,6 +5118,8 @@ setup_next_source (GstPlayBin * playbin, GstState target)
|
|||||||
if (!new_group || !new_group->valid)
|
if (!new_group || !new_group->valid)
|
||||||
goto no_next_group;
|
goto no_next_group;
|
||||||
|
|
||||||
|
new_group->stream_changed_pending = TRUE;
|
||||||
|
|
||||||
/* first unlink the current source, if any */
|
/* first unlink the current source, if any */
|
||||||
old_group = playbin->curr_group;
|
old_group = playbin->curr_group;
|
||||||
if (old_group && old_group->valid && old_group->active) {
|
if (old_group && old_group->valid && old_group->active) {
|
||||||
@ -5155,6 +5152,7 @@ no_next_group:
|
|||||||
}
|
}
|
||||||
activate_failed:
|
activate_failed:
|
||||||
{
|
{
|
||||||
|
new_group->stream_changed_pending = FALSE;
|
||||||
GST_DEBUG_OBJECT (playbin, "activate failed");
|
GST_DEBUG_OBJECT (playbin, "activate failed");
|
||||||
GST_PLAY_BIN_UNLOCK (playbin);
|
GST_PLAY_BIN_UNLOCK (playbin);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user