[Webkit-unassigned] [Bug 199559] New: [GStreamer] Ensure that “volume = foo; assert(volume == foo)” always succeeds

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jul 7 02:58:49 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=199559

            Bug ID: 199559
           Summary: [GStreamer] Ensure that  “volume = foo; assert(volume
                    == foo)” always succeeds
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Media
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: cturner at igalia.com

See https://bugs.webkit.org/show_bug.cgi?id=199505. It would be nice if for any media element E, E.volume = x does not undergo and transformations that cannot be reversed when reading the volume back. Currently in the pulseaudio backend, this is not the case due to the following PA code,


// converting to PA integer volume code
uint32_t pa_sw_volume_from_linear(double v) {

  if (v <= 0.0)
    return PA_VOLUME_MUTED;

  /*
   * We use a cubic mapping here, as suggested and discussed here:
   *
   * http://www.robotplanet.dk/audio/audio_gui_design/
   * http://lists.linuxaudio.org/pipermail/linux-audio-dev/2009-May/thread.html#23151
   *
   * We make sure that the conversion to linear and back yields the
   * same volume value! That's why we need the lround() below!
   */

// clamps between 0 and UINT32_MAX/2
  return (uint32_t) PA_CLAMP_VOLUME((uint64_t) lround(cbrt(v) * PA_VOLUME_NORM));
}

// converting back to double from PA integer volume code
double pa_sw_volume_to_linear(uint32_t v) {
  double f;

  if (v <= PA_VOLUME_MUTED)
    return 0.0;

  if (v == PA_VOLUME_NORM)
    return 1.0;

  f = ((double) v / PA_VOLUME_NORM);

  return (f*f*f);
}



The lround there means it's lossy. I'm not sure how to fix that when the PA devs do not consider it a bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190707/783147fb/attachment-0001.html>


More information about the webkit-unassigned mailing list