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 753148 - opusdec: inband FEC is never used
opusdec: inband FEC is never used
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
unspecified
Other All
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-02 01:23 UTC by Ilya Konstantinov
Modified: 2016-05-22 18:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
opusdec: fix in-band FEC (2.26 KB, patch)
2015-08-02 01:25 UTC, Ilya Konstantinov
rejected Details | Review

Description Ilya Konstantinov 2015-08-02 01:23:37 UTC
The code path for reconstructing buffers is never taken.
Comment 1 Ilya Konstantinov 2015-08-02 01:25:45 UTC
Created attachment 308628 [details] [review]
opusdec: fix in-band FEC

In-band FEC reconstruction code path was never taken.
Comment 2 Ilya Konstantinov 2015-08-02 01:34:46 UTC
1) last_buffer is usually not NULL but a zero-length buffer. In my tests with 'identity drop-probability=0.1', we'd never enter the FEC reconstruction code path.

2) opus_*decode manual states:

"In the case of PLC (data==NULL) or FEC (decode_fec=1), then frame_size needs to be exactly the duration of audio that is missing, otherwise the decoder will not be in the optimal state to decode the next incoming packet."

Therefore, I calculate the number of missing samples from gap buffer's duration.

For some reason, this function expects buffer to be NULL, which complicates the code. GstAudioDecoder sends zero-length buffers (not NULL buffers) for gap events. In which case can we expect a NULL buffer? Due to the possibility of getting NULL buffers I've added the 'last_samples' field. If buffer is never NULL, I'd happily delete it, and a bunch of other code.
Comment 4 Ilya Konstantinov 2015-08-02 02:04:32 UTC
Actually, this code seems to be broken if buffer == NULL is possible:

  /* That's the buffer we'll be sending to the opus decoder. */
  buf = (dec->use_inband_fec
      && gst_buffer_get_size (dec->last_buffer) >
      0) ? dec->last_buffer : buffer;

In this case, gst_buffer_get_size (dec->last_buffer) can be invalid.
Comment 5 Ilya Konstantinov 2015-08-02 11:28:03 UTC
Taking GST_BUFFER_DURATION of the last buffer doesn't work as well for gap events generated by RTP jitterbuffer (as it did for identity drop-probability).

Just storing the number of samples from the last (successful) packet decode seems to work, though.
Comment 6 Vincent Penquerc'h 2015-08-03 09:09:09 UTC
There are fixes in https://bugzilla.gnome.org/show_bug.cgi?id=725167 which have not been pushed yet.
Comment 7 Vincent Penquerc'h 2015-08-03 09:12:12 UTC
Oh, seems they were actually, I'd missed that, nevermind.
Comment 8 Ilya Konstantinov 2015-08-03 09:19:23 UTC
Oh my, I should pull more often :) Too bad I spent time working on this.

My request to stop treating buffer == NULL as legit stands though; i.e. let's turn this into a g_return_val_if_fail.
Comment 9 Carlos Rafael Giani 2015-08-28 13:24:51 UTC
Why is this listed in gst-plugins-base? opus is located in gst-plugins-bad.
Comment 10 Vincent Penquerc'h 2016-03-04 09:14:44 UTC
Ilya, there were fixes with PLC/FEC recently, I think this can be closed, unless you still see bugs in latest master.
Comment 11 Tim-Philipp Müller 2016-05-22 18:28:53 UTC
Marking as obsolete as per comment #10, please re-open if you still have problems with recent versions, thanks.