Skip to content
Commit 91540aeb authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Fix theoretical race condition in addOutputTrack

This is not a real race, because addOutputTrack was only called in two
places, and in both places there could be no other threads referencing
the DuplicatingThread instance.

Those two places are:
 - the DuplicatingThread constructor, which is of course safe
 - openDuplicateOutput - this is safe because it's called immediately
   after the new DuplicatingThread, and there are no sp<> either in the
   constructor or here which could cause onFirstRef() to do Thread::run().

But for safety in case addOutputTrack is ever called somewhere else,
or there are sp<> created earlier, it is safer to take the thread lock.

Change-Id: I1502d014fa37ec5dbf4bf40d3e2884af311cd5e9
parent be3835c6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment