From 28d9ab4a724faf4911919c8f055f7070a299f158 Mon Sep 17 00:00:00 2001 From: Zhe Wang Date: Thu, 30 Mar 2017 08:16:27 +0000 Subject: PD#140218: fixed crash bug, when raw audio track release. Change-Id: I1b20f60064fdbf619a8db4120f01345b6af45329 Signed-off-by: Zhe Wang --- 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(); -- cgit