hal: Fix issues with USB audio after disconnect

 * Stop the USB audio thread when the refcnt goes to zero.
 * Fix tracking of multiple soundcards.

Change-Id: Ia24dbcfcbcc855cde32c57dbbeb6d07af8f4cce8
hal: Correct the multi-channel output usecase selection

Both Multi-channel output on HDMI and Compress offload playback on
HDMI use cases request for a stream with AUDIO_OUTPUT_FLAG_DIRECT.
The current logic would then result selection MULTI_CH usecase.
Fix this by checking for complete match of flags to select the
use case.

Change-Id: I66df94af6c3b837a6c8054282364e1acf78e6e0f
hal: fix channel mask for m-ch offload playback

- Update channel mask with compress parameters for
  compress offload playback on HDMI device

Change-Id: I89263f56923588fcb906facfd4ae9ebf95203743
audio: Re-arrange member var initializations

Rearrange initializations of some stream_out member
variables to prevent possible uninitialized use.

CRs-Fixed: 587676
Change-Id: I7018f38f29a19b130185b285f4acf22219e4228c
hal: Use deep buffer output as primary

- The audio content in video clips, YouTube content, etc
  are being rendered through low latency path as it was
  set as default output profile. This results more power
  consumption for video playback.
- Fix this using deep buffer path as default one and use
  low latency path only for those audio tracks that
  request with AUDIO_OUTPUT_FLAG_FAST.

Change-Id: I52fafa0ec2a312bc4383c813497830e6ded071bc
CRs-Fixed: 570389

hal: Avoid duplicate primary outputs

open_output_stream API expects the default usecase to
be returned if other usecases are unavailable or unusable.
However, the output returned in this default case must be
the default primary if it exists.

 * cyanogen: This behavior is off by default.

Change-Id: Ie5cc53f077358d7039d62b09b29edb58c213bc08
Merge remote-tracking branch 'cm/cm-11.0' into kitkat