summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-07-29 12:32:50 +0300
committerSebastian Dröge <sebastian@centricular.com>2016-08-11 11:56:55 +0200
commitcfad48ce5a09f2d3899e494fe397d2181f3d2dcd (patch)
tree7931d2b2757d32fc021f2e3cc12ba59125bb50bf /ext
parentb936c00f5147f96757e55b36f46de2a238cbc167 (diff)
dashdemux: Remember if for a stream we could do key-units only mode
This makes sure we don't even try going into that mode if we previously saw that the stream does not have the suitable metadata. https://bugzilla.gnome.org/show_bug.cgi?id=741104
Diffstat (limited to 'ext')
-rw-r--r--ext/dash/gstdashdemux.c33
-rw-r--r--ext/dash/gstdashdemux.h1
2 files changed, 24 insertions, 10 deletions
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c
index 346b20440..bee085a33 100644
--- a/ext/dash/gstdashdemux.c
+++ b/ext/dash/gstdashdemux.c
@@ -922,6 +922,7 @@ gst_dash_demux_reset (GstAdaptiveDemux * ademux)
demux->n_subtitle_streams = 0;
demux->trickmode_no_audio = FALSE;
+ demux->allow_trickmode_key_units = TRUE;
}
static GstCaps *
@@ -1862,6 +1863,7 @@ gst_dash_demux_stream_fragment_finished (GstAdaptiveDemux * demux,
static gboolean
gst_dash_demux_need_another_chunk (GstAdaptiveDemuxStream * stream)
{
+ GstDashDemux *dashdemux = (GstDashDemux *) stream->demux;
GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
/* We're chunked downloading for ISOBMFF in KEY_UNITS mode for the actual
@@ -1874,7 +1876,8 @@ gst_dash_demux_need_another_chunk (GstAdaptiveDemuxStream * stream)
&& (GST_ADAPTIVE_DEMUX (stream->demux)->
segment.flags & GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS)
&& dashstream->active_stream->mimeType == GST_STREAM_VIDEO
- && !stream->downloading_header && !stream->downloading_index) {
+ && !stream->downloading_header && !stream->downloading_index
+ && dashdemux->allow_trickmode_key_units) {
if (dashstream->isobmff_parser.current_fourcc != GST_ISOFF_FOURCC_MDAT) {
stream->fragment.chunk_size = 8192;
} else if (dashstream->moof && dashstream->moof_sync_samples) {
@@ -1882,13 +1885,17 @@ gst_dash_demux_need_another_chunk (GstAdaptiveDemuxStream * stream)
} else {
stream->fragment.chunk_size = -1;
}
-
- return stream->fragment.chunk_size != 0;
+ } else {
+ /* We might've decided that we can't allow key-unit only
+ * trickmodes while doing chunked downloading. In that case
+ * just download from here to the end now */
+ if (dashstream->moof)
+ stream->fragment.chunk_size = -1;
+ else
+ stream->fragment.chunk_size = 0;
}
- stream->fragment.chunk_size = 0;
-
- return FALSE;
+ return stream->fragment.chunk_size != 0;
}
static GstBuffer *
@@ -2063,14 +2070,17 @@ static gboolean
gst_dash_demux_find_sync_samples (GstAdaptiveDemux * demux,
GstAdaptiveDemuxStream * stream)
{
+ GstDashDemux *dashdemux = (GstDashDemux *) stream->demux;
GstDashDemuxStream *dash_stream = (GstDashDemuxStream *) stream;
guint i;
guint32 track_id = 0;
guint64 prev_traf_end;
gboolean trex_sample_flags = FALSE;
- if (!dash_stream->moof)
+ if (!dash_stream->moof) {
+ dashdemux->allow_trickmode_key_units = FALSE;
return FALSE;
+ }
dash_stream->current_sync_sample = -1;
dash_stream->moof_sync_samples =
@@ -2092,6 +2102,7 @@ gst_dash_demux_find_sync_samples (GstAdaptiveDemux * demux,
traf->tfhd.track_id);
g_array_free (dash_stream->moof_sync_samples, TRUE);
dash_stream->moof_sync_samples = NULL;
+ dashdemux->allow_trickmode_key_units = FALSE;
return FALSE;
}
@@ -2166,6 +2177,7 @@ gst_dash_demux_find_sync_samples (GstAdaptiveDemux * demux,
"Sample size given by trex - can't download only keyframes");
g_array_free (dash_stream->moof_sync_samples, TRUE);
dash_stream->moof_sync_samples = NULL;
+ dashdemux->allow_trickmode_key_units = FALSE;
return FALSE;
}
@@ -2193,6 +2205,7 @@ gst_dash_demux_find_sync_samples (GstAdaptiveDemux * demux,
"Sample flags given by trex - can't download only keyframes");
g_array_free (dash_stream->moof_sync_samples, TRUE);
dash_stream->moof_sync_samples = NULL;
+ dashdemux->allow_trickmode_key_units = FALSE;
return FALSE;
}
}
@@ -2210,7 +2223,7 @@ gst_dash_demux_data_received (GstAdaptiveDemux * demux,
guint index_header_or_data;
if (!gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client)) {
- if (dash_stream->is_isobmff) {
+ if (dash_stream->is_isobmff && dashdemux->allow_trickmode_key_units) {
if (dash_stream->isobmff_parser.current_fourcc != GST_ISOFF_FOURCC_MDAT) {
buffer = gst_dash_demux_parse_isobmff (demux, dash_stream, buffer);
@@ -2354,7 +2367,7 @@ gst_dash_demux_data_received (GstAdaptiveDemux * demux,
GST_BUFFER_OFFSET (buffer) + gst_buffer_get_size (buffer);
dash_stream->sidx_current_offset = GST_BUFFER_OFFSET_END (buffer);
- if (dash_stream->is_isobmff) {
+ if (dash_stream->is_isobmff && dashdemux->allow_trickmode_key_units) {
if (dash_stream->isobmff_parser.current_fourcc != GST_ISOFF_FOURCC_MDAT) {
buffer = gst_dash_demux_parse_isobmff (demux, dash_stream, buffer);
@@ -2416,7 +2429,7 @@ gst_dash_demux_data_received (GstAdaptiveDemux * demux,
GST_BUFFER_OFFSET (buffer) + gst_buffer_get_size (buffer);
dash_stream->sidx_current_offset = GST_BUFFER_OFFSET_END (buffer);
- if (dash_stream->is_isobmff) {
+ if (dash_stream->is_isobmff && dashdemux->allow_trickmode_key_units) {
if (dash_stream->isobmff_parser.current_fourcc != GST_ISOFF_FOURCC_MDAT) {
buffer = gst_dash_demux_parse_isobmff (demux, dash_stream, buffer);
diff --git a/ext/dash/gstdashdemux.h b/ext/dash/gstdashdemux.h
index d058c091b..e6eff4e95 100644
--- a/ext/dash/gstdashdemux.h
+++ b/ext/dash/gstdashdemux.h
@@ -124,6 +124,7 @@ struct _GstDashDemux
gint n_subtitle_streams;
gboolean trickmode_no_audio;
+ gboolean allow_trickmode_key_units;
};
struct _GstDashDemuxClass