mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
oggdemux: assume live stream if byte size cannot be determined
This prevents trying to seek and failing, then ending up unable to stream because we can't get back at the headers. A more robust way would be to find a good place to reinject the headers when a seek fails, but I can't seem to get this to work.
This commit is contained in:
parent
d798cc1b8d
commit
229377fb6b
1 changed files with 21 additions and 1 deletions
|
@ -331,6 +331,8 @@ gst_ogg_pad_src_query (GstPad * pad, GstQuery * query)
|
|||
if (ogg->pullmode) {
|
||||
seekable = TRUE;
|
||||
stop = ogg->total_time;
|
||||
} else if (ogg->push_disable_seeking) {
|
||||
seekable = FALSE;
|
||||
} else if (ogg->current_chain->streams->len) {
|
||||
gint i;
|
||||
|
||||
|
@ -3274,6 +3276,10 @@ gst_ogg_demux_check_duration_push (GstOggDemux * ogg, GstSeekFlags flags,
|
|||
ogg->push_byte_length = length;
|
||||
GST_DEBUG_OBJECT (ogg,
|
||||
"File byte length %" G_GINT64_FORMAT, ogg->push_byte_length);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (ogg, "File byte length unknown, assuming live");
|
||||
ogg->push_disable_seeking = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
format = GST_FORMAT_TIME;
|
||||
res = gst_pad_query_duration (peer, &format, &length);
|
||||
|
@ -4562,8 +4568,22 @@ gst_ogg_demux_change_state (GstElement * element, GstStateChange transition)
|
|||
ogg->push_byte_length = -1;
|
||||
ogg->push_time_length = GST_CLOCK_TIME_NONE;
|
||||
ogg->push_time_offset = GST_CLOCK_TIME_NONE;
|
||||
ogg->push_disable_seeking = FALSE;
|
||||
ogg->push_state = PUSH_PLAYING;
|
||||
|
||||
ogg->push_disable_seeking = FALSE;
|
||||
if (!ogg->pullmode) {
|
||||
GstPad *peer;
|
||||
if ((peer = gst_pad_get_peer (ogg->sinkpad)) != NULL) {
|
||||
GstFormat format = GST_FORMAT_BYTES;
|
||||
gint64 length = -1;
|
||||
if (!gst_pad_query_duration (peer, &format, &length) || length <= 0) {
|
||||
GST_DEBUG_OBJECT (ogg,
|
||||
"Unable to determine stream size, assuming live, seeking disabled");
|
||||
ogg->push_disable_seeking = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GST_PUSH_UNLOCK (ogg);
|
||||
gst_segment_init (&ogg->segment, GST_FORMAT_TIME);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue