audio: Fix three-way deadlock

This is a fix for a deadlock in the audio HAL
involving three threads. Heres the deadlock sequence.

As part of closing all compress streams during SSR,
Thread1 takes out->lock, adev->lock and releases
out->lock when waiting on a condition variable
in stop_compress_output_l

Concurrently, Thread2 calls out_set_parameter on
the same output take out->lock and is blocked
trying to acquire adev->lock

Meanwhile Thread3 (offload_thread_loop) tries to
acquire out->lock (in order to signal Thread1).

But Thread3 is blocked since Thread2 has already
taken out->lock. This is a deadlock.

CRs-Fixed: 1028547

Change-Id: Ie8a8ff5e4d65c5a73641f925a46d03235d1a0f50
1 file changed