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 751153 - dashdemux: wrong representation index returned when max_bandwidth is 0
dashdemux: wrong representation index returned when max_bandwidth is 0
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal normal
: 1.5.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2015-06-18 12:17 UTC by Florin Apostol
Modified: 2015-06-18 14:37 UTC
See Also:
GNOME target: ---
GNOME version: ---

patch containing unit test and fix (4.69 KB, patch)
2015-06-18 12:18 UTC, Florin Apostol
committed Details | Review

Description Florin Apostol 2015-06-18 12:17:50 UTC
In gst_mpdparser_get_rep_idx_with_max_bandwidth function, if max_bandwidth is <= 0, the function will return the first representation, but the comment says it is intended to return the minimum representation.
  if (max_bandwidth <= 0)       /* 0 => get lowest representation available */
    return 0;

There is no mention in the standard that representations are ordered by their bandwidth, so one of them is wrong. I suspect the comment is correct and the function should return the lowest representation available, not the first one.
Comment 1 Florin Apostol 2015-06-18 12:18:58 UTC
Created attachment 305553 [details] [review]
patch containing unit test and fix

attached is a patch containing a unit test reproducing the problem and a proposed fix.
Comment 2 Thiago Sousa Santos 2015-06-18 14:36:35 UTC
Pushed, thanks for the patch with unit tests!

commit 9f56cc27aba2ccd57eb3896a3a490302da27d9d9
Author: Florin Apostol <>
Date:   Thu Jun 18 13:08:25 2015 +0100

    dashdemux: fixed getting representation based on max bandwidth
    The gst_mpdparser_get_rep_idx_with_max_bandwidth function assumes
    representations are ordered by bandwidth and incorrectly returns the
    first one when wanting the one with minimum bandwidth.
    Corrected gst_mpdparser_get_rep_idx_with_max_bandwidth function to get the
    correct representation in case max_bandwidth parameter is 0.