[Bug 763757] New: multiqueue: Make sure mq->percent remains valid after modifying high-percent value

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Wed Mar 16 14:57:40 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=763757

            Bug ID: 763757
           Summary: multiqueue: Make sure mq->percent remains valid after
                    modifying high-percent value
    Classification: Platform
           Product: GStreamer
           Version: git master
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: gstreamer (core)
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: dv at pseudoterminal.org
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

Created attachment 324105
  --> https://bugzilla.gnome.org/attachment.cgi?id=324105&action=edit
patch for scaling mq->percent after setting high-percent

Currently, if the high-percent value is modified right after data was inserted,
it is possible that the mq->percent value is actually invalid (read: larger
than high-percent). This happens because the mq->percent value isn't updated
when high-percent is set. It still contains the value from earlier, which as
said is larger

Given the SET_PERCENT code:

#define SET_PERCENT(mq, perc) G_STMT_START {                             \
  if (perc != mq->percent) {                                             \
    mq->percent = perc;                                                  \
    mq->percent_changed = TRUE;                                          \
    GST_DEBUG_OBJECT (mq, "buffering %d percent", perc);                 \
  }                                                                      \
} G_STMT_END

and the code in update_buffering():

...
  percent = get_percentage (sq);

  if (mq->buffering) {
    if (percent >= mq->high_percent) {
      mq->buffering = FALSE;
    }
    /* make sure it increases */
    percent = MAX (mq->percent, percent);

    SET_PERCENT (mq, percent);
  } else {
...

What happens is this:
1. Data is received, mq->percent is set for example to 10
2. high-percentage is set, for example to 5
3. In update_buffering(), (percent >= mq->high_percent) evaluates to TRUE;
   mq->buffering is set to FALSE;
   the MAX () expression returns 10, because mq->percent wasn't updated in step
#2 earlier;
   as a result, SET_PERCENT sees that perc == mq->percent and therefore does
not set mq->percent_changed to TRUE;
   therefore, since mq->percent_changed is not set to TRUE, no 100% buffering
message is posted.

By scaling mq->percent in the set_property() function, the MAX () behavior is
corrected, and 100% buffering is posted.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list