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
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
hal: Disable gapless offload playback by default.

-Set the property-audio.offload.gapless.enabled to true to enable
 gapless playback by default.
-Set mixer control to the driver to decide if gapless playback needs
 to be used or not
-If gapless playback is not enabled then partial drain from HAL is
 treated as full drain.

Change-Id: Id7f4967fe528bab9097c3f609058276ec02174e1
hal: set gapless metadata for compress  offload playback

-If any of the  metadata parameters are set from the framework.
 set the gapless metadata to one.

CRs-Fixed: 588353
Change-Id: I66a79d3f64515d108585527496a754c06a441560
hal: Add support for audio effects in DSP for tunnel mode playback

Add support to enable or disable audio post processing  effects
in DSP for tunnel mode playback.

Change-Id: I4e0b01ab4ae29d4b1c7986f2a6146e18e8bce2c1
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: Add property to configure the compress offload fragment size.

Add property - audio.offload.buffer.size.kbytes to configure offload
fragment size. The maximum value for fragment size is 256k. Default
value is 32k. The minimum value is 8k.

Change-Id: I9b440a420270b27f5fdba9f82de6944da0afb9d2
hal: Add DYNAMIC_VOLUME_MIXER ifdef for AOSP compatibility

 * Upstream kernel uses a much newer compress offload implementation
   which supports gapless playback, multiple streams, and effects.
 * The volume for these streams can be controlled independently,
   so add an ifdef if we support the new mixer names.

Change-Id: I6633ec5c95ba8a8e4424be82fe90fe207a66b964
hal: fix set_parameter() returning -2 error

When setparameters() is called and if the known keys are not found,
the implementation returns -2 error.Fix this by setting error only
when keys are found and there is an error while executing corresponding
implemention.

CRs-fixed: 589280
Change-Id: If5544d6fdeac47ddfc1f7e8e18bfa81e2ef5cbc2