Closed Bug 848401 Opened 13 years ago Closed 13 years ago

Raw PRLocks in MediaEngineWebRTCVideo.cpp are sadmaking (lots of deadlock potential)

Categories

(Core :: WebRTC, defect)

22 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: khuey, Assigned: jesup)

References

Details

(Whiteboard: [WebRTC][blocking-webrtc-][qa-])

Attachments

(1 file)

content/media/webrtc/MediaEngineWebRTCVideo.cpp is full of raw PRLock and PR_[Un]Lock calls. This code is a poster child for the benefits of RAII. Conversion to mozilla::Mutex/Monitor and the associated RAII helpers would be very nice.
Comment on attachment 724121 [details] [diff] [review] switch from ReentrantMonitors and PR_Lock/Condvar to Monitor. Fix {picture:true} for desktop khuey for the locking; dao for the trivial change to the UI to fix "picture:true".
Attachment #724121 - Flags: review?(khuey)
Attachment #724121 - Flags: review?(dao)
Comment on attachment 724121 [details] [diff] [review] switch from ReentrantMonitors and PR_Lock/Condvar to Monitor. Fix {picture:true} for desktop Review of attachment 724121 [details] [diff] [review]: ----------------------------------------------------------------- r=me but note my comment ::: content/media/webrtc/MediaEngineWebRTC.h @@ +139,5 @@ > // mMonitor protects mImage access/changes, and transitions of mState > // from kStarted to kStopped (which are combined with EndTrack() and > // image changes). Note that mSources is not accessed from other threads > + // for video and is not protected. mSnapshotCondVar is also protected > + // with this monitor. mSnapshotCondVar is no longer a thing, so don't add it to the comment. ::: content/media/webrtc/MediaEngineWebRTCVideo.cpp @@ +370,5 @@ > > + { > + MonitorAutoLock lock(mMonitor); > + mInSnapshotMode = true; > + } Is it safe to release the lock before running all of the following code? Somebody who actually knows this code (and not just the semantics of our locks) should sign off on this.
Attachment #724121 - Flags: review?(khuey) → review+
Assignee: nobody → rjesup
Whiteboard: [WebRTC][blocking-webrtc-]
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #3) > ::: content/media/webrtc/MediaEngineWebRTCVideo.cpp > @@ +370,5 @@ > > > > + { > > + MonitorAutoLock lock(mMonitor); > > + mInSnapshotMode = true; > > + } > > Is it safe to release the lock before running all of the following code? > Somebody who actually knows this code (and not just the semantics of our > locks) should sign off on this. Yes, it's safe, as we're just using this as a signal that the capture code has delivered at least one frame. The code following this starts the capture than waits (with the monitor) for something to be captured and sets the value back to false. Thanks
(In reply to Randell Jesup [:jesup] from comment #2) > dao for the trivial change to the UI to fix "picture:true". What does that change have to do with this bug?
I couldn't test this fix without first fixing the picture:true feature for desktop. Picture:true is going to be replaced with (or deprecated by) something defined in the media capture task force, but that will be a while.
Attachment #724121 - Flags: review?(dao) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [WebRTC][blocking-webrtc-] → [WebRTC][blocking-webrtc-][qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: