Move AudioRecord frame count calculations to server

Buffer frame count and notification frame count
are now calculated by server instead of by client.
The server has more information and can do a better job.

Also fix a few bugs:

 - If a fast track was re-created, even with same pipe depth, it would fail.
   Now it can correctly re-create a fast track provided the pipe depth is same.

 - Notification frame count for fast tracks was calculated by client
   as 1/2 of the total frame count, which is a large value due to the pipe.
   Now the notification frame count is set by server to the HAL frame count.
   This should reduce latency for fast tracks.

 - EVENT_OVERRUN were happening frequently when there was sample rate conversion,
   because the client didn't know about the sample rate conversion,
   and under-estimated the necessary buffer size.  Now since server
   calculates the buffer sizes, EVENT_OVERRUN is unlikely.

 - RecordThread::createRecordTrack_l was checking for mono and stereo
   for fast tracks.  This is not necessary, and now we can handle a
   multi-channel fast track.

Bug: 7498763
Change-Id: I0c581618e8db33084d5ff9ed50a592990c9749e8
4 files changed