Fix threading issues in AudioRecord JNI

Made native AudioRecord ref based to allow use
of strong pointers in JNI and solve concurrency issues
between read() and release() in particular.

Applied the same fixes to AudioTrack JNI.

Issue 6254582.

Change-Id: I381a66cb00b6639f87f4fcd19a2e202d1a4e6704
2 files changed