Closed Bug 1614019 Opened 6 years ago Closed 5 years ago

AudioContext allows specifying a negative sampleRate

Categories

(Core :: Web Audio, defect, P3)

defect

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: bzbarsky, Assigned: nazarcf)

Details

Attachments

(3 files, 1 obsolete file)

Maybe this is intentional, but I would have expected this:

new AudioContext({sampleRate: -1 })

to throw, since that's smaller than MinSampleRate. In Firefox it does not throw, because the bounds checks on sampleRate are skipped if it's <= 0 in AudioContext::Constructor. Is that on purpose? It might be worth a comment explaining why.

Flags: needinfo?(padenot)
Component: Audio/Video → Web Audio
Flags: needinfo?(padenot)
Priority: -- → P3
Assignee: nobody → nazarcf
Status: NEW → ASSIGNED
Attachment #9137323 - Attachment description: Bug 1614019 - For an audioContext, a negative value of sampeRate now throws an exception r?padenot" → Bug 1614019 - For an audioContext, a negative value of sampeRate now throws an exception r?padenot

0 is not considered because this is the default value.
The condition in the if is changed because the minus operation could overflow.
The declaration of sampleRate has been moved to its next use because its first value was never used.

Attachment #9164298 - Attachment description: Bug 1614019 - Added mochitest for negative duration. r?padenot → Bug 1614019 - Added mochitest for negative sample rate. r?padenot
Pushed by padenot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8b700a13395e Removed negative value from the valid range r=padenot,webidl,smaug https://hg.mozilla.org/integration/autoland/rev/18cf45575936 Added mochitest for negative sample rate. r=padenot https://hg.mozilla.org/integration/autoland/rev/c5f74915fe26 Added wpt for negative sample rate. r=padenot
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/24825 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Attachment #9137323 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: