From 4a91a98ea1bd5c599f67c5227b60ef01bbe3b860 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 10 Oct 2018 18:36:57 +0000 Subject: [PATCH] mpegtsdemux: Don't pretend doing NAL alignment Per specification in 2.14.2 "For PES packetization, no specific data alignment constraints apply". So we should not advertise NAL alignment. This bug was introduced at the same moment the alignment field was introduced 10 years ago. The plan was that alignment=none (or no alignment field) was to be used for mpegtsdemux, but no one noticed the error. The reason is that at the same moment, everything dealing with H264 started defaulting to AU alignment. https://bugzilla.gnome.org/show_bug.cgi?id=606662#c22 This patch will have a side effect that a parser is now needed after the tsdemux element. The following pipeline will not negotiate anymore as the mpegtsmux element requires alignment={nal,au}. ... ! tsdemux ! mpegtsmux ! ... As a side effect, anyone that forked from tsdemux should updated their code to fix this bug. --- gst/mpegtsdemux/tsdemux.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 2863656ee8..7193367c16 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -230,10 +230,8 @@ struct _TSDemuxStream "video/mpeg, " \ "mpegversion = (int) { 1, 2, 4 }, " \ "systemstream = (boolean) FALSE; " \ - "video/x-h264,stream-format=(string)byte-stream," \ - "alignment=(string)nal;" \ - "video/x-h265,stream-format=(string)byte-stream," \ - "alignment=(string)nal;" \ + "video/x-h264,stream-format=(string)byte-stream;" \ + "video/x-h265,stream-format=(string)byte-stream;" \ "video/x-dirac;" \ "video/x-cavs;" \ "video/x-wmv," \ @@ -1497,8 +1495,7 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, case DRF_ID_HEVC: is_video = TRUE; caps = gst_caps_new_simple ("video/x-h265", - "stream-format", G_TYPE_STRING, "byte-stream", - "alignment", G_TYPE_STRING, "nal", NULL); + "stream-format", G_TYPE_STRING, "byte-stream", NULL); break; case DRF_ID_KLVA: sparse = TRUE; @@ -1518,8 +1515,7 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, if (program->program_number == 10510 && bstream->pid == 3401) { is_video = TRUE; caps = gst_caps_new_simple ("video/x-h264", - "stream-format", G_TYPE_STRING, "byte-stream", - "alignment", G_TYPE_STRING, "nal", NULL); + "stream-format", G_TYPE_STRING, "byte-stream", NULL); } break; case ST_HDV_AUX_V: @@ -1560,14 +1556,12 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, case GST_MPEGTS_STREAM_TYPE_VIDEO_H264: is_video = TRUE; caps = gst_caps_new_simple ("video/x-h264", - "stream-format", G_TYPE_STRING, "byte-stream", - "alignment", G_TYPE_STRING, "nal", NULL); + "stream-format", G_TYPE_STRING, "byte-stream", NULL); break; case GST_MPEGTS_STREAM_TYPE_VIDEO_HEVC: is_video = TRUE; caps = gst_caps_new_simple ("video/x-h265", - "stream-format", G_TYPE_STRING, "byte-stream", - "alignment", G_TYPE_STRING, "nal", NULL); + "stream-format", G_TYPE_STRING, "byte-stream", NULL); break; case GST_MPEGTS_STREAM_TYPE_VIDEO_JP2K: is_video = TRUE; -- 2.34.1