basetsmux: fix PCR stream selection

This commit is contained in:
Mathieu Duponchelle 2019-05-15 01:34:51 +02:00 committed by Mathieu Duponchelle
parent 1ff72bb69d
commit 52efb62876

View file

@ -685,13 +685,6 @@ gst_base_ts_mux_create_streams (GstBaseTsMux * mux)
tsmux_set_pmt_interval (ts_pad->prog, mux->pmt_interval); tsmux_set_pmt_interval (ts_pad->prog, mux->pmt_interval);
g_hash_table_insert (mux->programs, g_hash_table_insert (mux->programs,
GINT_TO_POINTER (ts_pad->prog_id), ts_pad->prog); GINT_TO_POINTER (ts_pad->prog_id), ts_pad->prog);
/* Take the first stream of the program for the PCR */
GST_DEBUG_OBJECT (ts_pad,
"Use stream (pid=%d) from pad as PCR for program (prog_id = %d)",
ts_pad->pid, ts_pad->prog_id);
tsmux_program_set_pcr_stream (ts_pad->prog, ts_pad->stream);
} }
if (ts_pad->stream == NULL) { if (ts_pad->stream == NULL) {
@ -700,6 +693,15 @@ gst_base_ts_mux_create_streams (GstBaseTsMux * mux)
goto no_stream; goto no_stream;
} }
if (ts_pad->prog->pcr_stream == NULL) {
/* Take the first stream of the program for the PCR */
GST_DEBUG_OBJECT (ts_pad,
"Use stream (pid=%d) from pad as PCR for program (prog_id = %d)",
ts_pad->pid, ts_pad->prog_id);
tsmux_program_set_pcr_stream (ts_pad->prog, ts_pad->stream);
}
/* Check for user-specified PCR PID */ /* Check for user-specified PCR PID */
pcr_name = g_strdup_printf ("PCR_%d", ts_pad->prog->pgm_number); pcr_name = g_strdup_printf ("PCR_%d", ts_pad->prog->pgm_number);
if (mux->prog_map && gst_structure_has_field (mux->prog_map, pcr_name)) { if (mux->prog_map && gst_structure_has_field (mux->prog_map, pcr_name)) {