Commit 516f1ae0 authored by Thiago Santos's avatar Thiago Santos
Browse files

adaptivedemux: add a special return to signal subsegment boundary

The subsegment boundary return tells the adaptivedemux that it can
try to switch to another representation as the stream is at a suitable
position for starting from another bitrate.
parent 9b260d1b
...@@ -1211,6 +1211,7 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) ...@@ -1211,6 +1211,7 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
gboolean discont = FALSE; gboolean discont = FALSE;
gboolean subsegment_end = FALSE;
if (stream->starting_fragment) { if (stream->starting_fragment) {
stream->starting_fragment = FALSE; stream->starting_fragment = FALSE;
...@@ -1235,10 +1236,15 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) ...@@ -1235,10 +1236,15 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
if (klass->chunk_received) { if (klass->chunk_received) {
ret = klass->chunk_received (demux, stream, &buffer); ret = klass->chunk_received (demux, stream, &buffer);
if (ret != GST_FLOW_OK) { if (ret != GST_FLOW_OK) {
if (buffer) if (ret == (GstFlowReturn) GST_ADAPTIVE_DEMUX_FLOW_SUBSEGMENT_END) {
gst_buffer_unref (buffer); ret = GST_FLOW_OK;
gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL); subsegment_end = TRUE;
return ret; } else {
if (buffer)
gst_buffer_unref (buffer);
gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL);
return ret;
}
} }
} }
...@@ -1321,6 +1327,9 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) ...@@ -1321,6 +1327,9 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
} }
gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL); gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL);
} else if (subsegment_end) {
/* tell upstream that we are done here */
ret = GST_FLOW_EOS;
} }
return ret; return ret;
......
...@@ -77,6 +77,10 @@ G_BEGIN_DECLS ...@@ -77,6 +77,10 @@ G_BEGIN_DECLS
g_clear_error (&err); \ g_clear_error (&err); \
} G_STMT_END } G_STMT_END
enum _GstAdaptiveDemuxFlowReturn {
GST_ADAPTIVE_DEMUX_FLOW_SUBSEGMENT_END = GST_FLOW_CUSTOM_SUCCESS + 100
};
typedef struct _GstAdaptiveDemuxStreamFragment GstAdaptiveDemuxStreamFragment; typedef struct _GstAdaptiveDemuxStreamFragment GstAdaptiveDemuxStreamFragment;
typedef struct _GstAdaptiveDemuxStream GstAdaptiveDemuxStream; typedef struct _GstAdaptiveDemuxStream GstAdaptiveDemuxStream;
typedef struct _GstAdaptiveDemux GstAdaptiveDemux; typedef struct _GstAdaptiveDemux GstAdaptiveDemux;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment