After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 765807 - dvdlpcmdec: rewrite with GstAudioDecoder and add new format
dvdlpcmdec: rewrite with GstAudioDecoder and add new format
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
git master
Other All
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-29 13:03 UTC by Michael Olbrich
Modified: 2018-11-03 15:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tsdemux: stream_type 0x83 support (1.44 KB, patch)
2016-04-29 13:04 UTC, Michael Olbrich
committed Details | Review
dvdlpcmdec: rewrite to use GstAudioDecoder (24.05 KB, patch)
2016-04-29 13:05 UTC, Michael Olbrich
none Details | Review
dvdlpcmdec: add support for another format (4.56 KB, patch)
2016-04-29 13:05 UTC, Michael Olbrich
none Details | Review
dvdlpcmdec: add support for another format (4.55 KB, patch)
2016-06-20 12:54 UTC, Michael Olbrich
committed Details | Review
dvdlpcmdec: add support for yet another format (3.04 KB, patch)
2016-06-20 12:56 UTC, Michael Olbrich
reviewed Details | Review
dvdlpcmdec: crop buffers with invalid size (1.11 KB, patch)
2016-06-20 12:58 UTC, Michael Olbrich
needs-work Details | Review
dvdlpcmdec: rewrite to use GstAudioDecoder (24.83 KB, patch)
2016-07-18 08:13 UTC, Michael Olbrich
committed Details | Review

Description Michael Olbrich 2016-04-29 13:03:31 UTC
There are multiple variations of LPCM. One for DVDs is already implemented in dvdlpcmdec.
Another is defined in the "DVD-Video/Audio through IEEE1394 Bus" spec (http://www.dvdforum.org/images/Guideline1394V10R0_20020911.pdf). This was also reused for Wifi-Display.
I have 3 Patches to support this:
1. Add support for the stream_type (0x83) in tsdemux
2. Convert dvdlpcmdec to use GstAudioDecoder
3. Add support for the format mentioned above.
Comment 1 Michael Olbrich 2016-04-29 13:04:15 UTC
Created attachment 327020 [details] [review]
tsdemux: stream_type 0x83 support
Comment 2 Michael Olbrich 2016-04-29 13:05:15 UTC
Created attachment 327021 [details] [review]
dvdlpcmdec: rewrite to use GstAudioDecoder
Comment 3 Michael Olbrich 2016-04-29 13:05:39 UTC
Created attachment 327022 [details] [review]
dvdlpcmdec: add support for another format
Comment 4 Michael Olbrich 2016-04-29 13:24:28 UTC
I've tested what I could with my streams and the files from https://samples.ffmpeg.org/MPEG-VOB/LPCM/ to make sure I didn't break anything. However, I don't have a test-case for width == 20 so that part is untested.
Comment 5 Michael Olbrich 2016-06-20 12:54:13 UTC
Created attachment 330067 [details] [review]
dvdlpcmdec: add support for another format

A minor bugfix in gst_dvdlpcmdec_parse_1394():
4 bytes are read so 4 bytes should be mapped.
Comment 6 Michael Olbrich 2016-06-20 12:56:19 UTC
Created attachment 330068 [details] [review]
dvdlpcmdec: add support for yet another format

I've looked at the sample in #703913. That's yet another format. Here's a patch for it.
Comment 7 Michael Olbrich 2016-06-20 12:58:22 UTC
Created attachment 330069 [details] [review]
dvdlpcmdec: crop buffers with invalid size

This happens when a buffer is incomplete because of a lossy transport
layer like RTP.
Comment 8 Sebastian Dröge (slomo) 2016-06-21 09:02:59 UTC
Review of attachment 327021 [details] [review]:

Generally looks good, thanks! Good work

::: gst/dvdlpcmdec/gstdvdlpcmdec.c
@@ +544,3 @@
   channels = GST_AUDIO_INFO_CHANNELS (&dvdlpcmdec->info);
 
+  gst_buffer_ref (buf);

Why? Please make sure it is unreffed in all cases, but this seems unnecessary? The base class keeps track of that for you
Comment 9 Sebastian Dröge (slomo) 2016-06-21 09:06:04 UTC
Review of attachment 330068 [details] [review]:

This seems unfortunate. Can't we somehow detect this at the MPEG-TS level and give it different caps? Is there some kind of different descriptor for it or ...?
Comment 10 Sebastian Dröge (slomo) 2016-06-21 09:06:53 UTC
Review of attachment 330069 [details] [review]:

::: gst/dvdlpcmdec/gstdvdlpcmdec.c
@@ +681,3 @@
+      if (size % (channels * 2)) {
+        GST_WARNING_OBJECT (dvdlpcmdec, "Buffer of size %" G_GSIZE_FORMAT
+            " is not a multiple of %d. Droping incomplete sample",

Typo: Dropping with double p
Comment 11 Sebastian Dröge (slomo) 2016-06-21 09:08:18 UTC
Review of attachment 330069 [details] [review]:

And even in a lossy transport like RTP, how would you end up with incomplete packets? At the UDP level this should've already been dropped if the UDP packet was incomplete, and the RTP depayloader should detect if there are missing packets and handle that somehow.
Comment 12 Michael Olbrich 2016-07-15 12:58:04 UTC
(In reply to Sebastian Dröge (slomo) from comment #8)
> Review of attachment 327021 [details] [review] [review]:
> 
> Generally looks good, thanks! Good work
> 
> ::: gst/dvdlpcmdec/gstdvdlpcmdec.c
> @@ +544,3 @@
>    channels = GST_AUDIO_INFO_CHANNELS (&dvdlpcmdec->info);
>  
> +  gst_buffer_ref (buf);
> 
> Why? Please make sure it is unreffed in all cases, but this seems
> unnecessary? The base class keeps track of that for you

That's because of the new base class. This code was the pad chain function so it owned the buffer. With the new base class it's in handle_frame which does not own the buffer.
There are cases where the buffer is passed to gst_audio_decoder_finish_frame() because there is nothing to do. In all other cases the buffer is eventually unrefed again.
I can change this to only ref the buffer if necessary. Maybe that will be clearer.
Comment 13 Michael Olbrich 2016-07-15 13:05:56 UTC
(In reply to Sebastian Dröge (slomo) from comment #11)
> Review of attachment 330069 [details] [review] [review]:
> 
> And even in a lossy transport like RTP, how would you end up with incomplete
> packets? At the UDP level this should've already been dropped if the UDP
> packet was incomplete, and the RTP depayloader should detect if there are
> missing packets and handle that somehow.

The pipeline here is basically rtpmp2tdepay -> tsdemux -> dvdlpcmdec. I don't think rtpmp2tdepay can handle this. Maybe tsdemux can, but I'm not sure it should: That would just mean we loose more data. This way we play as much as possible. But I should add a GST_BUFFER_FLAG_DISCONT to the next buffer, right?
Comment 14 Michael Olbrich 2016-07-18 08:13:25 UTC
Created attachment 331679 [details] [review]
dvdlpcmdec: rewrite to use GstAudioDecoder

Updated to only ref the buffer if needed.
Comment 15 Sebastian Dröge (slomo) 2016-07-25 07:26:35 UTC
(In reply to Sebastian Dröge (slomo) from comment #9)
> Review of attachment 330068 [details] [review] [review]:
> 
> This seems unfortunate. Can't we somehow detect this at the MPEG-TS level
> and give it different caps? Is there some kind of different descriptor for
> it or ...?

How should we go ahead with this?
Comment 16 Sebastian Dröge (slomo) 2016-07-25 07:27:02 UTC
(In reply to Michael Olbrich from comment #13)
> (In reply to Sebastian Dröge (slomo) from comment #11)
> > Review of attachment 330069 [details] [review] [review] [review]:
> > 
> > And even in a lossy transport like RTP, how would you end up with incomplete
> > packets? At the UDP level this should've already been dropped if the UDP
> > packet was incomplete, and the RTP depayloader should detect if there are
> > missing packets and handle that somehow.
> 
> The pipeline here is basically rtpmp2tdepay -> tsdemux -> dvdlpcmdec. I
> don't think rtpmp2tdepay can handle this. Maybe tsdemux can, but I'm not
> sure it should: That would just mean we loose more data. This way we play as
> much as possible. But I should add a GST_BUFFER_FLAG_DISCONT to the next
> buffer, right?

Yes, seems ok then
Comment 17 Sebastian Dröge (slomo) 2016-07-25 10:38:01 UTC
Attachment 330067 [details] pushed as 9f51f72 - dvdlpcmdec: add support for another format
Attachment 331679 [details] pushed as 35dc8d0 - dvdlpcmdec: rewrite to use GstAudioDecoder
Comment 18 Sebastian Dröge (slomo) 2016-07-25 10:39:00 UTC
Comment on attachment 327020 [details] [review]
tsdemux: stream_type 0x83 support

commit 48c5cc1b1b5096ccff4a25c98e14117c6e5e4d25
Author: Michael Olbrich <m.olbrich@pengutronix.de>
Date:   Fri Apr 29 14:42:34 2016 +0200

    tsdemux: add support for LPCM with stream_type = 0x83
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765807
Comment 19 Michael Olbrich 2016-08-05 15:17:57 UTC
(In reply to Sebastian Dröge (slomo) from comment #15)
> (In reply to Sebastian Dröge (slomo) from comment #9)
> > Review of attachment 330068 [details] [review] [review] [review]:
> > 
> > This seems unfortunate. Can't we somehow detect this at the MPEG-TS level
> > and give it different caps? Is there some kind of different descriptor for
> > it or ...?
> 
> How should we go ahead with this?

I don't know. I didn't see any difference at MPEG-TS level when I implemented this. But I'm not an expert when it comes to MPEG-TS. I can provide a sample of the other format if someone else wants to take a look at this.
Comment 20 Tim-Philipp Müller 2016-08-05 19:13:24 UTC
If you could attach a sample that'd be great.
Comment 21 Tim-Philipp Müller 2016-12-28 10:35:37 UTC
> If you could attach a sample that'd be great.

Michael?
Comment 22 GStreamer system administrator 2018-11-03 15:35:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/issues/15.