Closed
Bug 100472
Opened 23 years ago
Closed 23 years ago
nsSound should play sounds asynchronously, and cache rendered sounds
Categories
(Core :: XUL, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: sfraser_bugs, Assigned: sfraser_bugs)
Details
(Keywords: perf)
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
mikepinkerton
:
review+
sspitzer
:
superreview+
|
Details | Diff | Splinter Review |
On Mac, nsSound has very poor performance, for a number of reasons: 1. It doesn't do any cacheing, so *every* time we play a sound, we render it to a new QuickTime movie. 2. The movie is played synchronously, preventing the user from doing anything while the sound plays.
Assignee | ||
Comment 1•23 years ago
|
||
Note that this was fixed in Windows recently, and sound has always been async on Unix.
Assignee | ||
Comment 3•23 years ago
|
||
Assignee | ||
Comment 4•23 years ago
|
||
The attached patch greatly enhances nsSound on Mac, adding the following features (without interface changes): 1. Sounds are now played asynchronously 2. Rendered sounds (as QuickTime movies) are stored per-session in the necko memory cache. 3. Multiple different sounds can be played concurrently. 4. The same sound can be played several times concurrently. 5. Different sound formats are identified by sniffing the data (WAVE, uLaw, midi) or looking at the MIME type (MP3), and imported appropriately. How it works: nsSound has become more like a sound service; it just spawns URL loads, and deals with necko caching of rendered sounds. For each unique sound (keyed by URL) that is playing, we create an nsSoundRequest, which is what handles rendering to a movie, and creates a timer which calls MoviesTask(). nsSoundRequests get stuffed into the necko cache (memory cache only). Additional code is necessary to deal with playing the same sound several times simultaneously. Because the sound is in a movie, and the movie contains playback state information, we have to clone the movie each additional time we need to play it while another copy is playing. Luckily, cloning a movie just copies data refs, so this is cheap. We use a timer that fires every 250ms to call MoviesTask(); there is one timer per nsSoundRequest, that fires as long as any movie in that nsSoundRequest is playing.
Assignee | ||
Updated•23 years ago
|
Attachment #52764 -
Attachment is obsolete: true
Assignee | ||
Comment 5•23 years ago
|
||
Assignee | ||
Comment 6•23 years ago
|
||
New patch removes printfs, and disposes of movies after they finish playing, rather than when the nsSoundRequest is deleted. Reviews please.
Status: NEW → ASSIGNED
Comment 7•23 years ago
|
||
Comment on attachment 52819 [details] [diff] [review] Better nsSound patch r=pink
Attachment #52819 -
Flags: review+
Comment 8•23 years ago
|
||
Comment on attachment 52819 [details] [diff] [review] Better nsSound patch sr=sspitzer
Attachment #52819 -
Flags: superreview+
Assignee | ||
Comment 9•23 years ago
|
||
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•