Closed Bug 1399833 Opened 4 years ago Closed 4 years ago

Uninitialized variables in CubebUtils

Categories

(Core :: Audio/Video: cubeb, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox56 --- unaffected
firefox57 --- unaffected
firefox58 --- fixed

People

(Reporter: philn, Assigned: philn)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36

Steps to reproduce:

For gecko-media we don't rely on Preferences (yet?) so we need default values for at least the sCubebPlaybackLatencyInMilliseconds variable.
Blocks: servo-media
Summary: Uninitialized variables → Uninitialized variables in CubebUtils
Attached patch proposed.patchSplinter Review
Attachment #8908083 - Flags: review?(cpearce)
Component: Audio/Video → Audio/Video: cubeb
Does this apply to 56?
Rank: 15
Priority: -- → P2
Maire, you don't need to worry about this. This is not a problem in Firefox. These variables are initialized when we initialize Cubeb in Firefox.

I'm setting the tracking flags to unaffected so that nobody panics about this.

For the gecko-media Rust crate, I think we can just initialize the Preferences system so that these prefs are initialized just like they are in Firefox. I'm part way through that patch.
Comment on attachment 8908083 [details] [diff] [review]
proposed.patch

I think sCubebPlaybackLatencyInMillisecond should be initialized to  CUBEB_NORMAL_LATENCY_MS.

I think sCubebMSGLatencyInFrames should be initiaized to CUBEB_NORMAL_LATENCY_FRAMES.

Paul, can you take a look at this and suggest whether these are sane default values? We need these as we're exporting Gecko's media stack out into a Rust crate, and the preferences system isn't stood up yet.
Attachment #8908083 - Flags: review?(cpearce) → review?(padenot)
Comment on attachment 8908083 [details] [diff] [review]
proposed.patch

Review of attachment 8908083 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/media/CubebUtils.cpp
@@ +106,5 @@
>    Shutdown
>  } sCubebState = CubebState::Uninitialized;
>  cubeb* sCubebContext;
> +double sVolumeScale = 1.0;
> +uint32_t sCubebPlaybackLatencyInMilliseconds = 1;

Makes this 100 milliseconds.

@@ +107,5 @@
>  } sCubebState = CubebState::Uninitialized;
>  cubeb* sCubebContext;
> +double sVolumeScale = 1.0;
> +uint32_t sCubebPlaybackLatencyInMilliseconds = 1;
> +uint32_t sCubebMSGLatencyInFrames = 128;

Make this 512 frames. Note that in practice, we get this value via cubeb, it depends widely on the platform.
Attachment #8908083 - Flags: review?(padenot)
This is needed for Servo's gecko-media where there is no support for
Mozilla Preferences.

MozReview-Commit-ID: HbDT42SRrE3
Assignee: nobody → cpearce
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Pushed by cpearce@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a0bd70eac827
set default values for variables controlled by Preferences. r=padenot
Assignee: cpearce → philn
https://hg.mozilla.org/mozilla-central/rev/a0bd70eac827
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.