mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
tsmux: Deterministically order PAT programs by number
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1510>
This commit is contained in:
parent
853178894e
commit
b7ae1fa683
1 changed files with 12 additions and 0 deletions
|
@ -1656,6 +1656,16 @@ tsmux_program_set_pmt_pid (TsMuxProgram * program, guint16 pmt_pid)
|
|||
program->pmt_pid = pmt_pid;
|
||||
}
|
||||
|
||||
static gint
|
||||
compare_program_number (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
const GstMpegtsPatProgram *pgm1 = *(const GstMpegtsPatProgram * const *) a;
|
||||
const GstMpegtsPatProgram *pgm2 = *(const GstMpegtsPatProgram * const *) b;
|
||||
gint num1 = pgm1->program_number, num2 = pgm2->program_number;
|
||||
|
||||
return num1 - num2;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
tsmux_write_pat (TsMux * mux)
|
||||
{
|
||||
|
@ -1685,6 +1695,8 @@ tsmux_write_pat (TsMux * mux)
|
|||
g_ptr_array_add (pat, pat_pgm);
|
||||
}
|
||||
|
||||
g_ptr_array_sort (pat, compare_program_number);
|
||||
|
||||
if (mux->pat.section)
|
||||
gst_mpegts_section_unref (mux->pat.section);
|
||||
|
||||
|
|
Loading…
Reference in a new issue