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.
This commit is contained in:
Nicolas Dufresne 2018-10-10 18:36:57 +00:00
parent 462a8130a6
commit 4a91a98ea1

View file

@ -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;