mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
mpegtsmux: tweak buffer handling
... for clarity and to avoid mixing _peek/_pop
This commit is contained in:
parent
30c782e062
commit
59627a3e5d
1 changed files with 4 additions and 12 deletions
|
@ -584,7 +584,6 @@ static MpegTsPadData *
|
||||||
mpegtsmux_choose_best_stream (MpegTsMux * mux)
|
mpegtsmux_choose_best_stream (MpegTsMux * mux)
|
||||||
{
|
{
|
||||||
MpegTsPadData *best = NULL;
|
MpegTsPadData *best = NULL;
|
||||||
GstCollectData2 *c_best = NULL;
|
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
|
|
||||||
for (walk = mux->collect->data; walk != NULL; walk = g_slist_next (walk)) {
|
for (walk = mux->collect->data; walk != NULL; walk = g_slist_next (walk)) {
|
||||||
|
@ -596,7 +595,7 @@ mpegtsmux_choose_best_stream (MpegTsMux * mux)
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
ts_data->queued_buf = buf =
|
ts_data->queued_buf = buf =
|
||||||
gst_collect_pads2_peek (mux->collect, c_data);
|
gst_collect_pads2_pop (mux->collect, c_data);
|
||||||
|
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
if (ts_data->prepare_func) {
|
if (ts_data->prepare_func) {
|
||||||
|
@ -633,7 +632,6 @@ mpegtsmux_choose_best_stream (MpegTsMux * mux)
|
||||||
* we push enough buffers from it to reach a timestamp */
|
* we push enough buffers from it to reach a timestamp */
|
||||||
if (ts_data->last_ts == GST_CLOCK_TIME_NONE) {
|
if (ts_data->last_ts == GST_CLOCK_TIME_NONE) {
|
||||||
best = ts_data;
|
best = ts_data;
|
||||||
c_best = c_data;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ts_data->eos = TRUE;
|
ts_data->eos = TRUE;
|
||||||
|
@ -648,19 +646,12 @@ mpegtsmux_choose_best_stream (MpegTsMux * mux)
|
||||||
best->last_ts != GST_CLOCK_TIME_NONE &&
|
best->last_ts != GST_CLOCK_TIME_NONE &&
|
||||||
ts_data->last_ts < best->last_ts) {
|
ts_data->last_ts < best->last_ts) {
|
||||||
best = ts_data;
|
best = ts_data;
|
||||||
c_best = c_data;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
best = ts_data;
|
best = ts_data;
|
||||||
c_best = c_data;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c_best) {
|
|
||||||
GstBuffer *buffer;
|
|
||||||
if ((buffer = gst_collect_pads2_pop (mux->collect, c_best)))
|
|
||||||
gst_buffer_unref (buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
@ -874,6 +865,9 @@ mpegtsmux_collected (GstCollectPads2 * pads, MpegTsMux * mux)
|
||||||
if (prog == NULL)
|
if (prog == NULL)
|
||||||
goto no_program;
|
goto no_program;
|
||||||
|
|
||||||
|
g_assert (buf != NULL);
|
||||||
|
best->queued_buf = NULL;
|
||||||
|
|
||||||
if (mux->force_key_unit_event != NULL && best->stream->is_video_stream) {
|
if (mux->force_key_unit_event != NULL && best->stream->is_video_stream) {
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
|
|
||||||
|
@ -920,7 +914,6 @@ mpegtsmux_collected (GstCollectPads2 * pads, MpegTsMux * mux)
|
||||||
tsmux_program_set_pcr_stream (prog, best->stream);
|
tsmux_program_set_pcr_stream (prog, best->stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
|
|
||||||
if (best->stream->is_video_stream)
|
if (best->stream->is_video_stream)
|
||||||
delta = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
delta = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||||
GST_DEBUG_OBJECT (mux, "delta: %d", delta);
|
GST_DEBUG_OBJECT (mux, "delta: %d", delta);
|
||||||
|
@ -936,7 +929,6 @@ mpegtsmux_collected (GstCollectPads2 * pads, MpegTsMux * mux)
|
||||||
|
|
||||||
tsmux_stream_add_data (best->stream, GST_BUFFER_DATA (buf),
|
tsmux_stream_add_data (best->stream, GST_BUFFER_DATA (buf),
|
||||||
GST_BUFFER_SIZE (buf), buf, pts, -1, !delta);
|
GST_BUFFER_SIZE (buf), buf, pts, -1, !delta);
|
||||||
best->queued_buf = NULL;
|
|
||||||
|
|
||||||
mux->is_delta = delta;
|
mux->is_delta = delta;
|
||||||
mux->last_size = GST_BUFFER_SIZE (buf);
|
mux->last_size = GST_BUFFER_SIZE (buf);
|
||||||
|
|
Loading…
Reference in a new issue