Closed
Bug 1212723
Opened 9 years ago
Closed 9 years ago
It seems racy to share mBufferedState among WebMReaders
Categories
(Core :: Audio/Video: Playback, defect, P2)
Core
Audio/Video: Playback
Tracking
()
RESOLVED
FIXED
mozilla44
Tracking | Status | |
---|---|---|
firefox44 | --- | fixed |
People
(Reporter: jwwang, Assigned: jwwang)
References
Details
Attachments
(2 files)
https://hg.mozilla.org/mozilla-central/file/a45d680f073f/dom/media/webm/WebMReader.cpp#l205 It is possible for multiple WebMReaders to reference to the same WebMBufferedState object. The comment says it should be accessed on the main thread only. However, it is actually on the task queue thread. The usage seems racy and wrong.
Assignee | ||
Updated•9 years ago
|
Flags: needinfo?(jyavenard)
Comment 1•9 years ago
|
||
we no longer use WebMReader. We also no longer access WebMReader on any thread other than the decoder's task queue. How could multiple WebMReaders shared the WebMBufferedState ? I can't see how that could ever be possible. It could have been accessed on multiple thread (though via a monitor) with the GetBuffered being on the main thread, but that's no long the case. So at worse, it's an obsolete comment (and we should remove the monitor there), it will benefit the new WebMDemuxer / MediaFormatReader I'm fairly sure that I had submitted a patch to do just that a little while ago...
Flags: needinfo?(jyavenard)
Assignee | ||
Comment 2•9 years ago
|
||
It is still possible to use WebMReader by setting "media.format-reader.webm" to false until we completely remove WebMReader.cpp/h.
Assignee | ||
Comment 3•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/file/a45d680f073f/dom/media/webm/WebMReader.cpp#l205 WebMBufferedState is shared when a non-null aCloneDonor passed to WebMReader::Init(). this->mBufferedState and aCloneDonor->mBufferedState will reference the same object.
Comment 4•9 years ago
|
||
sure the code is there to do so, but when is it ever used in that fashion?
Assignee | ||
Comment 5•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/file/a45d680f073f/dom/html/HTMLMediaElement.cpp#l2780 It is used when we are cloning a decoder which happens when 2 media element have the same URI for the 'src' attribute. The decoders will try to share resources when possible. (See MediaResource::CloneData and WebMReader::Init()) for examples.)
Assignee | ||
Comment 6•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/file/b68eab795f9d/dom/media/webm/WebMReader.cpp#l806 After fixing bug 1213726, we still have WebMReader::NotifyDataArrivedInternal() calls mBufferedState->NotifyDataArrived. Since WebMBufferedState::NotifyDataArrived() is not protected by a monitor, it will be a data race when multiple WebMReaders share a WebMBufferedState. Since WebMReader is gonna be deprecated, I think it won't hurt much to disable the sharing in WebMReader::Init(). It also allows me to do more code cleanup.
Assignee | ||
Comment 7•9 years ago
|
||
try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=58c187059f2f
Assignee | ||
Comment 8•9 years ago
|
||
try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e046bc813397
Assignee | ||
Comment 9•9 years ago
|
||
Bug 1212723. Part 1 - don't share mBufferedState per bug 1212723 comment 6. r=jya.
Attachment #8672885 -
Flags: review?(jyavenard)
Assignee | ||
Comment 10•9 years ago
|
||
Bug 1212723. Part 2 - remove unused argument aCloneDonor from MediaDecoderReader::Init(). r=jya.
Attachment #8672886 -
Flags: review?(jyavenard)
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → jwwang
Comment 11•9 years ago
|
||
Comment on attachment 8672885 [details] MozReview Request: Bug 1212723. Part 1 - don't share mBufferedState per bug 1212723 comment 6. r=jya. https://reviewboard.mozilla.org/r/21813/#review19585
Attachment #8672885 -
Flags: review?(jyavenard) → review+
Comment 12•9 years ago
|
||
Comment on attachment 8672886 [details] MozReview Request: Bug 1212723. Part 2 - remove unused argument aCloneDonor from MediaDecoderReader::Init(). r=jya. https://reviewboard.mozilla.org/r/21815/#review19587 starting to wonder what would happen if we shared the src across multiple media element ; do we have only a single MediaResource shared between decoderreader ?
Attachment #8672886 -
Flags: review?(jyavenard) → review+
Assignee | ||
Comment 13•9 years ago
|
||
No, it is the underlying MediaCache that is shared. See: https://hg.mozilla.org/mozilla-central/file/11ff0ccb7d59/dom/media/MediaCache.h#l458
Assignee | ||
Comment 14•9 years ago
|
||
In fact, we share only when ChannelMediaResource is used. When it comes to MediaSource, local files or RTSP, there is no way to share.
Assignee | ||
Comment 15•9 years ago
|
||
Thanks for the review!
Comment 16•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/3ae763ddaac8 https://hg.mozilla.org/integration/mozilla-inbound/rev/7e968320d35b
Updated•9 years ago
|
Priority: -- → P2
Comment 17•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/3ae763ddaac8 https://hg.mozilla.org/mozilla-central/rev/7e968320d35b
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in
before you can comment on or make changes to this bug.
Description
•