Merge "Avoid FFmpeg destroying active resources during demuxer stop."

The root cause is a combination of BufferedDataSource::Stop()
requiring a lock and BlockingURLProtocol::Read() returning
control to FFmpeg which may destory resources in use by an
ongoing BufferedDataSource::ReadCallback() call.

The lock in BDS::Stop() shared by BDS::ReadCallback() prevents
the stop signal from taking affect until after the read finishes,
however calling BUP::Abort() will immediately returns control to
FFmpeg which may destroy the resources in use by BDS::ReadCallback().

Sadly, given the racy nature and multi-class dependencies I've been
unable to craft a unit test for this, but I've manually verified this
fix works by arbitrarily delaying BDS::Stop() under an ASAN build.

BUG=411318
TEST=none
TBR=dalecurtis,scherkus

Review URL: https://codereview.chromium.org/544843005

Cr-Commit-Position: refs/heads/master@{#293995}
(cherry picked from commit 1973f0b6f7497b1887397de9bb36dbff4faf5e39)

Review URL: https://codereview.chromium.org/564213002

Cr-Commit-Position: refs/branch-heads/2125@{#337}
Cr-Branched-From: b68026d94bda36dd106a3d91a098719f952a9477-refs/heads/master@{#290040}
1 file changed