mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
hlsdemux: typefind might fail if first buffer is too short
If typefind fails, check to see if the buffer is too short for typefind. If this is the case, prepend the decrypted buffer to the pending buffer and try again the next time around. https://bugzilla.gnome.org/show_bug.cgi?id=740458
This commit is contained in:
parent
1e9ce11efd
commit
68e77265a0
1 changed files with 17 additions and 1 deletions
|
@ -656,13 +656,29 @@ gst_hls_demux_chunk_received (GstAdaptiveDemux * demux,
|
||||||
tmp_buffer = hlsdemux->pending_buffer;
|
tmp_buffer = hlsdemux->pending_buffer;
|
||||||
hlsdemux->pending_buffer = buffer;
|
hlsdemux->pending_buffer = buffer;
|
||||||
*chunk = tmp_buffer;
|
*chunk = tmp_buffer;
|
||||||
|
} else if (hlsdemux->pending_buffer) {
|
||||||
|
*chunk = gst_buffer_append (hlsdemux->pending_buffer, buffer);
|
||||||
|
hlsdemux->pending_buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_UNLIKELY (hlsdemux->do_typefind && *chunk != NULL)) {
|
buffer = *chunk;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (hlsdemux->do_typefind && buffer != NULL)) {
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
caps = gst_type_find_helper_for_buffer (NULL, buffer, NULL);
|
caps = gst_type_find_helper_for_buffer (NULL, buffer, NULL);
|
||||||
if (G_UNLIKELY (!caps)) {
|
if (G_UNLIKELY (!caps)) {
|
||||||
|
/* Typefind could fail if buffer is too small. Retry later */
|
||||||
|
if (gst_buffer_get_size (buffer) < (2 * 1024 * 1024)) {
|
||||||
|
if (hlsdemux->pending_buffer)
|
||||||
|
hlsdemux->pending_buffer =
|
||||||
|
gst_buffer_append (buffer, hlsdemux->pending_buffer);
|
||||||
|
else
|
||||||
|
hlsdemux->pending_buffer = buffer;
|
||||||
|
*chunk = NULL;
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
GST_ELEMENT_ERROR (hlsdemux, STREAM, TYPE_NOT_FOUND,
|
GST_ELEMENT_ERROR (hlsdemux, STREAM, TYPE_NOT_FOUND,
|
||||||
("Could not determine type of stream"), (NULL));
|
("Could not determine type of stream"), (NULL));
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
|
|
Loading…
Reference in a new issue