author | Zhe Wang <zhe.wang@amlogic.com> | 2017-03-30 08:16:27 (GMT) |
---|---|---|
committer | Zhe Wang <zhe.wang@amlogic.com> | 2017-03-30 08:26:39 (GMT) |
commit | 28d9ab4a724faf4911919c8f055f7070a299f158 (patch) | |
tree | 8e97aae77c23e6212df8448b2b24c6e3d3fb04a0 | |
parent | 5b39287fa6999f74c20a27038ce02ff59fe7a61a (diff) | |
download | audio-28d9ab4a724faf4911919c8f055f7070a299f158.zip audio-28d9ab4a724faf4911919c8f055f7070a299f158.tar.gz audio-28d9ab4a724faf4911919c8f055f7070a299f158.tar.bz2 |
PD#140218: fixed crash bug, when raw audio track release.
Change-Id: I1b20f60064fdbf619a8db4120f01345b6af45329
Signed-off-by: Zhe Wang <zhe.wang@amlogic.com>
-rw-r--r-- | libTVaudio/audio/aml_audio.c | 1 | ||||
-rw-r--r-- | libTVaudio/audio/android_out.cpp | 10 |
2 files changed, 7 insertions, 4 deletions
diff --git a/libTVaudio/audio/aml_audio.c b/libTVaudio/audio/aml_audio.c index f99b99f..3df3700 100644 --- a/libTVaudio/audio/aml_audio.c +++ b/libTVaudio/audio/aml_audio.c @@ -1503,7 +1503,6 @@ static int set_rawdata_in_disable(struct aml_stream_out *out) { omx_codec_close(); omx_codec_dts_close(); - release_raw_audio_track(); if ((gUSBCheckFlag & AUDIO_DEVICE_OUT_SPEAKER) != 0) { if (out->user_set_device == CC_OUT_USE_AMAUDIO) { diff --git a/libTVaudio/audio/android_out.cpp b/libTVaudio/audio/android_out.cpp index 406f859..fa0e519 100644 --- a/libTVaudio/audio/android_out.cpp +++ b/libTVaudio/audio/android_out.cpp @@ -119,6 +119,10 @@ static void AudioTrackCallback(int event, void* user, void *info) { else if (spdif_audio_type == DTS) { aformat = AUDIO_FORMAT_DTS; } + else if (spdif_audio_type == LPCM && last_aformat != AUDIO_FORMAT_INVALID) { + RawAudioTrackRelease(); + } + if (aformat != last_aformat && aformat != AUDIO_FORMAT_INVALID) { ALOGI("raw aformat changed from %x to %x\n",last_aformat,aformat); RawAudioTrackRelease(); @@ -208,8 +212,8 @@ static int RawAudioTrackInit(audio_format_t aformat,int sr) ALOGD("%s, entering...,aformat %x,sr %d\n", __FUNCTION__,aformat,sr); //raw here - if (gmpAudioTracker_raw != NULL) { - glpTracker_raw = gmpAudioTracker_raw.get(); + if (glpTracker_raw != NULL && gmpAudioTracker != NULL) { + glpTracker_raw = gmpAudioTracker_raw.get(); } else { gmpAudioTracker_raw = new AudioTrack(); if (gmpAudioTracker_raw == NULL) { @@ -261,7 +265,7 @@ static int AudioTrackInit(void) { I2S_state = 0; - if (gmpAudioTracker != NULL) { + if (glpTracker != NULL && gmpAudioTracker != NULL) { glpTracker = gmpAudioTracker.get(); } else { gmpAudioTracker = new AudioTrack(); |