audioflinger: new HW A/V sync ID allocation flow

The HW A/V sync ID is now allocated by the audio HAL before the
output stream is created by a call to global get_parameters() with
key AUDIO_PARAMETER_HW_AV_SYNC.

When the AudioTrack is created, the HW A/V sync ID is communicated
to the output stream by stream set_parameters() with key
AUDIO_PARAMETER_STREAM_HW_AV_SYNC.

Bug: 17112525.
Change-Id: Ia8bc6f3bf9f358aa89f3f56ac554e893a19811ad
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 1003017..4fb372d 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -733,6 +733,8 @@
                 // Effect chains without a valid thread
                 DefaultKeyedVector< audio_session_t , sp<EffectChain> > mOrphanEffectChains;
 
+                // list of sessions for which a valid HW A/V sync ID was retrieved from the HAL
+                DefaultKeyedVector< audio_session_t , audio_hw_sync_t >mHwAvSyncIds;
 private:
     sp<Client>  registerPid(pid_t pid);    // always returns non-0
 
@@ -741,6 +743,7 @@
     void        closeOutputInternal_l(sp<PlaybackThread> thread);
     status_t    closeInput_nonvirtual(audio_io_handle_t input);
     void        closeInputInternal_l(sp<RecordThread> thread);
+    void        setAudioHwSyncForSession_l(PlaybackThread *thread, audio_session_t sessionId);
 
 #ifdef TEE_SINK
     // all record threads serially share a common tee sink, which is re-created on format change