mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
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.
This commit is contained in:
parent
9b260d1ba5
commit
516f1ae0f4
2 changed files with 17 additions and 4 deletions
|
@ -1211,6 +1211,7 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
|||
GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
gboolean discont = FALSE;
|
||||
gboolean subsegment_end = FALSE;
|
||||
|
||||
if (stream->starting_fragment) {
|
||||
stream->starting_fragment = FALSE;
|
||||
|
@ -1235,10 +1236,15 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
|||
if (klass->chunk_received) {
|
||||
ret = klass->chunk_received (demux, stream, &buffer);
|
||||
if (ret != GST_FLOW_OK) {
|
||||
if (buffer)
|
||||
gst_buffer_unref (buffer);
|
||||
gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL);
|
||||
return ret;
|
||||
if (ret == (GstFlowReturn) GST_ADAPTIVE_DEMUX_FLOW_SUBSEGMENT_END) {
|
||||
ret = GST_FLOW_OK;
|
||||
subsegment_end = TRUE;
|
||||
} 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)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -77,6 +77,10 @@ G_BEGIN_DECLS
|
|||
g_clear_error (&err); \
|
||||
} G_STMT_END
|
||||
|
||||
enum _GstAdaptiveDemuxFlowReturn {
|
||||
GST_ADAPTIVE_DEMUX_FLOW_SUBSEGMENT_END = GST_FLOW_CUSTOM_SUCCESS + 100
|
||||
};
|
||||
|
||||
typedef struct _GstAdaptiveDemuxStreamFragment GstAdaptiveDemuxStreamFragment;
|
||||
typedef struct _GstAdaptiveDemuxStream GstAdaptiveDemuxStream;
|
||||
typedef struct _GstAdaptiveDemux GstAdaptiveDemux;
|
||||
|
|
Loading…
Reference in a new issue