mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
rtph264depay: Preserve SPS/PPS arrival order.
Even if SPS/PPS haven't changed, make sure to move them to the end of the tracking array if needed, so we always know what the most recent entries are, in case we need to discard the oldest when generating codec_data. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/775>
This commit is contained in:
parent
2623404744
commit
b066441e21
1 changed files with 10 additions and 6 deletions
|
@ -581,14 +581,16 @@ gst_rtp_h264_add_sps_pps (GstElement * rtph264, GPtrArray * sps_array,
|
|||
parse_sps (&spsmap, &tmp_sps_id);
|
||||
|
||||
if (sps_id == tmp_sps_id) {
|
||||
if (map.size == spsmap.size &&
|
||||
/* If this is already the most recent SPS and unchanged, nothing to do */
|
||||
if (i == (sps_array->len - 1) && map.size == spsmap.size &&
|
||||
memcmp (map.data, spsmap.data, spsmap.size) == 0) {
|
||||
GST_LOG_OBJECT (rtph264, "Unchanged SPS %u, not updating", sps_id);
|
||||
GST_LOG_OBJECT (rtph264,
|
||||
"Unchanged SPS %u already most recent, not updating", sps_id);
|
||||
gst_buffer_unmap (sps, &spsmap);
|
||||
goto drop;
|
||||
} else {
|
||||
gst_buffer_unmap (sps, &spsmap);
|
||||
g_ptr_array_remove_index_fast (sps_array, i);
|
||||
g_ptr_array_remove_index (sps_array, i);
|
||||
g_ptr_array_add (sps_array, nal);
|
||||
GST_LOG_OBJECT (rtph264, "Modified SPS %u, replacing", sps_id);
|
||||
goto done;
|
||||
|
@ -619,15 +621,17 @@ gst_rtp_h264_add_sps_pps (GstElement * rtph264, GPtrArray * sps_array,
|
|||
parse_pps (&ppsmap, &tmp_sps_id, &tmp_pps_id);
|
||||
|
||||
if (pps_id == tmp_pps_id) {
|
||||
if (map.size == ppsmap.size &&
|
||||
/* If this is already the most recent PPS and unchanged, nothing to do */
|
||||
if (i == (pps_array->len - 1) && map.size == ppsmap.size &&
|
||||
memcmp (map.data, ppsmap.data, ppsmap.size) == 0) {
|
||||
GST_LOG_OBJECT (rtph264, "Unchanged PPS %u:%u, not updating", sps_id,
|
||||
GST_LOG_OBJECT (rtph264,
|
||||
"Unchanged PPS %u:%u already most recent, not updating", sps_id,
|
||||
pps_id);
|
||||
gst_buffer_unmap (pps, &ppsmap);
|
||||
goto drop;
|
||||
} else {
|
||||
gst_buffer_unmap (pps, &ppsmap);
|
||||
g_ptr_array_remove_index_fast (pps_array, i);
|
||||
g_ptr_array_remove_index (pps_array, i);
|
||||
g_ptr_array_add (pps_array, nal);
|
||||
GST_LOG_OBJECT (rtph264, "Modified PPS %u:%u, replacing",
|
||||
sps_id, pps_id);
|
||||
|
|
Loading…
Reference in a new issue