mpegtsmux: restore stream creation order

In 7c767f3fcd , stream creation was
refactored to occur before potential program creation. This created
issues with pipelines such as:

gst-launch-1.0 videotestsrc ! video/x-raw, format=I420, width=640, height=640, framerate=25/1 ! \
x264enc ! hlssink2 target-duration=1

eg.: gst_buffer_copy_into: assertion 'bufsize >= offset + size' failed

As this reordering was actually not needed for the purpose of allowing
to specify a PCR stream, this reverts the reordering part of the
initial commit.
This commit is contained in:
Mathieu Duponchelle 2019-02-27 18:47:09 +01:00
parent a751b33072
commit 91c76b0851

View file

@ -878,6 +878,7 @@ mpegtsmux_create_stream (MpegTsMux * mux, MpegTsPadData * ts_data)
ts_data->stream->opus_channel_config_code = opus_channel_config_code;
tsmux_stream_set_buffer_release_func (ts_data->stream, release_buffer_cb);
tsmux_program_add_stream (ts_data->prog, ts_data->stream);
ret = GST_FLOW_OK;
}
@ -956,12 +957,6 @@ mpegtsmux_create_streams (MpegTsMux * mux)
}
}
if (ts_data->stream == NULL) {
ret = mpegtsmux_create_stream (mux, ts_data);
if (ret != GST_FLOW_OK)
goto no_stream;
}
ts_data->prog =
g_hash_table_lookup (mux->programs, GINT_TO_POINTER (ts_data->prog_id));
if (ts_data->prog == NULL) {
@ -980,7 +975,11 @@ mpegtsmux_create_streams (MpegTsMux * mux)
tsmux_program_set_pcr_stream (ts_data->prog, ts_data->stream);
}
tsmux_program_add_stream (ts_data->prog, ts_data->stream);
if (ts_data->stream == NULL) {
ret = mpegtsmux_create_stream (mux, ts_data);
if (ret != GST_FLOW_OK)
goto no_stream;
}
/* Check for user-specified PCR PID */
pcr_name = g_strdup_printf ("PCR_%d", ts_data->prog->pgm_number);