mpegtsdemux: Deliver all packets to tsparse
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Tue, 26 May 2020 20:40:04 +0000 (22:40 +0200)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 28 May 2020 16:41:30 +0000 (16:41 +0000)
34af8ed66a7c63048ce0bdf59bbe61011d7c6292 changed the code to use the
packetizer's packets instead of the incoming buffers, but mpegtsbase
didn't actually push all packets to the subclass. As a result, padding
(PID 0x1FFF) packets got lost.

Add a new boolean to toggle pushing unknown packets to mpegtsbase and
have mpegtsparse make use of it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1300>

gst/mpegtsdemux/mpegtsbase.c
gst/mpegtsdemux/mpegtsbase.h
gst/mpegtsdemux/mpegtspacketizer.c
gst/mpegtsdemux/mpegtsparse.c

index 237a893..147a665 100644 (file)
@@ -1491,6 +1491,8 @@ mpegts_base_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
       if (base->push_section)
         res = klass->push (base, &packet, section);
 
+    } else if (base->push_unknown) {
+      res = klass->push (base, &packet, NULL);
     } else if (packet.payload && packet.pid != 0x1fff)
       GST_LOG ("PID 0x%04x Saw packet on a pid we don't handle", packet.pid);
 
index 14dce2f..896eb1d 100644 (file)
@@ -160,6 +160,7 @@ struct _MpegTSBase {
   /* Whether to push data and/or sections to subclasses */
   gboolean push_data;
   gboolean push_section;
+  gboolean push_unknown;
 
   /* Whether the parent bin is streams-aware, meaning we can
    * add/remove streams at any point in time */
index 7dde696..8816dac 100644 (file)
@@ -994,7 +994,7 @@ mpegts_packetizer_push_section (MpegTSPacketizer2 * packetizer,
    *  If it is not a PUSI
    *    Accumulate the expected data and check for complete section
    *    (loop)
-   *    
+   *
    **/
 
   if (packet->payload_unit_start_indicator) {
@@ -1950,7 +1950,7 @@ record_pcr (MpegTSPacketizer2 * packetizer, MpegTSPCR * pcrtable,
     GList *tmp;
     /* No current estimator. This happens for the initial value, or after
      * discont and flushes. Figure out where we need to record this position.
-     * 
+     *
      * Possible choices:
      * 1) No groups at all:
      *    Create a new group with pcr/offset
index bcf6727..620f2ab 100644 (file)
@@ -210,6 +210,7 @@ mpegts_parse_init (MpegTSParse2 * parse)
   base->program_size = sizeof (MpegTSParseProgram);
   base->push_data = TRUE;
   base->push_section = TRUE;
+  base->push_unknown = TRUE;
 
   parse->user_pcr_pid = parse->pcr_pid = -1;