nuplayer: Fix audio glitch heard in non-offload path
During ringtone preview glitch is heard at the beginning of the playback. The issue happens with any use case that is associated with deep buffer path. NuPlayerRenderer waits before draining the buffer queue for half of the duration of pending frames with audio sink. During playback start NuPlayerRenderer fills up the entire shared memory of AudioTrack i.e. 160msec and sleeps for 80msec before the next drain attempt. If cold start latency that includes opening driver, configuring DSP, etc.. is more than 80msec, the next drain attempt will be delayed by yet another 80msec. During this 80msec delay, if DSP starts rendering all the data in the shared memory will be consumed very quickly. This is assuming the buffering in the kernel and DSP is more than 160msec. This case is seen as an AudioTrack underrun by AudioFlinger because of which silence is inserted until the next buffer is written by NuPlayerRender. Fix the issue by reducing the delay equal to a buffer duration between two drain attempts. CRs-Fixed: 777860 Change-Id: I8cb8cd56942ca939bf4ab950deb57fa65a77cead
Loading
Please register or sign in to comment