mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 23:48:53 +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);
|
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)
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
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;
|
||||||
|
|
Loading…
Reference in a new issue