Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 2799d743 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Use sp<AudioTrack> instead of raw AudioTrack *

This change prepares for the new implementation of AudioTrack client, which
will require clients to use only sp<AudioTrack>, not raw AudioTrack *.
A raw delete will cause a race condition during AudioTrack destruction.

AudioTrack was made a RefBase by commit b68a91a7
on 2011/11/15, when it was needed by OpenSL ES (for the callback protector).
At that time, the only other client that was also converted from
AudioTrack * to sp<AudioTrack> was android.media.AudioTrack JNI in
project frameworks/base (file android_media_AudioTrack.cpp).

Details:
 * Use .clear() instead of delete followed by = NULL.
 * ALOG %p need .get().
 * sp<> don't need to be listed in constructor initializer, if initially 0.
 * Use == 0 for sp<> vs == NULL for raw pointers.
 * Use if (sp != 0) instead of if (raw).

Change-Id: Ic7cad25795d6e862e112abdc227b6d33afdfce17
parent 7c684c62
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment