summaryrefslogtreecommitdiff
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-04-09 07:06:22 (GMT)
committer Android Partner Code Review <android-gerrit-partner@google.com>2019-04-09 07:06:22 (GMT)
commit1362c34f81e45d65d1d212b4d2099b01c02cc72b (patch)
tree9b8995ed30f5080fe1487d67f80a7f6a19b8cc8b
parentb6b24cd16d22e972ededf017db38a0d4fa69c8f5 (diff)
parent70c4c74e30a720ae45eabf9f0b14499830be69d3 (diff)
downloadamlogic-p-tv-dev.zip
amlogic-p-tv-dev.tar.gz
amlogic-p-tv-dev.tar.bz2
Merge changes from topic "netflix_hailstorm2.0" into p-tv-dev
* changes: display: default_prop selinux warning [3/3] camera: fix selinux code error [1/2] audio: sync audio from netflix hailstorm tree [1/1] audio: continous output when tunnel pcm starts [1/1] audio: change hal buffer size from 768 to 788 audio: prop to tune hdmi latency [1/1] audio: setting SPDIF output av unsync [1/1] audio: fix noise on tracks change [1/1] audio: send AUDIO_STOP in adev_close_output_stream_new [1/1] audio: fix too many calls of resume [1/1]
Diffstat
-rwxr-xr-xaudio/audio_hal/amlAudioMixer.c45
-rwxr-xr-xaudio/audio_hal/amlAudioMixer.h3
-rwxr-xr-xaudio/audio_hal/audio_hw.c116
-rwxr-xr-xaudio/audio_hal/audio_hw.h1
-rwxr-xr-xaudio/audio_hal/audio_hw_utils.c47
-rwxr-xr-xaudio/audio_hal/audio_hw_utils.h1
-rw-r--r--[-rwxr-xr-x]audio/audio_hal/audio_hwsync.c8
-rwxr-xr-xaudio/audio_hal/hw_avsync_callbacks.c5
-rw-r--r--[-rwxr-xr-x]audio/audio_hal/sub_mixing_factory.c21
-rwxr-xr-xaudio/bt_voice/kehwin/32/btmic.a270
-rwxr-xr-xaudio/bt_voice/kehwin/64/btmic.a160
-rwxr-xr-xaudio/utils/spdifenc_wrap.cpp8
-rw-r--r--[-rwxr-xr-x]camera/V4LCameraAdapter/V4LCameraAdapter.cpp10
-rwxr-xr-xcamera/v3/EmulatedFakeCamera3.cpp2
-rw-r--r--[-rwxr-xr-x]camera/v3/fake-pipeline2/Sensor.cpp4
-rwxr-xr-xhwcomposer/common/base/HwcConfig.cpp4
16 files changed, 431 insertions, 274 deletions
diff --git a/audio/audio_hal/amlAudioMixer.c b/audio/audio_hal/amlAudioMixer.c
index 4a6acee..62e391f 100755
--- a/audio/audio_hal/amlAudioMixer.c
+++ b/audio/audio_hal/amlAudioMixer.c
@@ -76,6 +76,7 @@ struct amlAudioMixer {
struct timespec tval_last_write;
void *adev_data;
struct aml_audio_device *adev;
+ bool continuous_output;
//int init_ok : 1;
};
@@ -85,6 +86,18 @@ int mixer_set_state(struct amlAudioMixer *audio_mixer, enum mixer_state state)
return 0;
}
+int mixer_set_continuous_output(struct amlAudioMixer *audio_mixer,
+ bool continuous_output)
+{
+ audio_mixer->continuous_output = continuous_output;
+ return 0;
+}
+
+bool mixer_is_continuous_enabled(struct amlAudioMixer *audio_mixer)
+{
+ return audio_mixer->continuous_output;
+}
+
enum mixer_state mixer_get_state(struct amlAudioMixer *audio_mixer)
{
return audio_mixer->state;
@@ -544,9 +557,11 @@ static int mixer_inports_read(struct amlAudioMixer *audio_mixer)
fade_out = 1;
} else if (state == RESUMING) {
fade_in = 1;
+ ALOGI("%s(), tsync resume", __func__);
aml_hwsync_set_tsync_resume();
+ set_inport_state(in_port, ACTIVE);
} else if (state == STOPPED || state == PAUSED || state == FLUSHED) {
- ALOGD("%s(), stopped, paused or flushed", __func__);
+ ALOGV("%s(), stopped, paused or flushed", __func__);
//in_port->data_valid = 1;
//memset(in_port->data, 0, in_port->data_len_bytes);
continue;
@@ -1308,6 +1323,30 @@ static void *mixer_32b_threadloop(void *data)
return NULL;
}
+static int mixer_do_continous_output(struct amlAudioMixer *audio_mixer)
+{
+ struct output_port *out_port = audio_mixer->out_ports[MIXER_OUTPUT_PORT_PCM];
+ int16_t *data_mixed = (int16_t *)out_port->data_buf;
+ size_t frames = 4;
+ size_t bytes = frames * out_port->cfg.frame_size;
+
+ memset(data_mixed, 0 , bytes);
+ set_outport_data_avail(out_port, bytes);
+ mixer_output_write(audio_mixer);
+ return 0;
+}
+
+static bool mixer_inports_exist(struct amlAudioMixer *audio_mixer)
+{
+ enum MIXER_INPUT_PORT port_index = 0;
+ for (port_index = 0; port_index < MIXER_INPUT_PORT_NUM; port_index++) {
+ struct input_port *in_port = audio_mixer->in_ports[port_index];
+ if (in_port)
+ return true;
+ }
+ return false;
+}
+
static void *mixer_16b_threadloop(void *data)
{
struct amlAudioMixer *audio_mixer = data;
@@ -1342,6 +1381,10 @@ static void *mixer_16b_threadloop(void *data)
//usleep(5000);
ALOGV("%s %d data not enough, next turn", __func__, __LINE__);
notify_mixer_input_avail(audio_mixer);
+ if (mixer_is_continuous_enabled(audio_mixer) && !mixer_inports_exist(audio_mixer)) {
+ ALOGV("%s %d data not enough, do continue output", __func__, __LINE__);
+ mixer_do_continous_output(audio_mixer);
+ }
clock_gettime(CLOCK_MONOTONIC, &audio_mixer->tval_last_write);
continue;
}
diff --git a/audio/audio_hal/amlAudioMixer.h b/audio/audio_hal/amlAudioMixer.h
index 39a25bc..7fcdc89 100755
--- a/audio/audio_hal/amlAudioMixer.h
+++ b/audio/audio_hal/amlAudioMixer.h
@@ -99,6 +99,9 @@ int mixer_set_padding_size(
enum MIXER_INPUT_PORT port_index,
int padding_bytes);
+int mixer_set_continuous_output(struct amlAudioMixer *audio_mixer,
+ bool continuous_output);
+
__END_DECLS
#endif
diff --git a/audio/audio_hal/audio_hw.c b/audio/audio_hal/audio_hw.c
index 7b963d7..8c99a5e 100755
--- a/audio/audio_hal/audio_hw.c
+++ b/audio/audio_hal/audio_hw.c
@@ -218,7 +218,7 @@ ssize_t out_write_new(struct audio_stream_out *stream,
const void *buffer,
size_t bytes);
static aec_timestamp get_timestamp(void);
-
+static void config_output(struct audio_stream_out *stream);
static inline bool need_hw_mix(usecase_mask_t masks)
{
return (masks > 1);
@@ -643,6 +643,16 @@ static int start_output_stream_direct (struct aml_stream_out *out)
unsigned int port = PORT_SPDIF;
int ret = 0;
+ adev->debug_flag = aml_audio_get_debug_flag();
+ if (eDolbyDcvLib == adev->dolby_lib_type &&
+ DD == adev->hdmi_format &&
+ out->hal_format == AUDIO_FORMAT_E_AC3) {
+ out->need_convert = true;
+ out->hal_internal_format = AUDIO_FORMAT_AC3;
+ if (out->hal_rate == 192000)
+ out->hal_rate = out->hal_rate / 4;
+ ALOGI("spdif out DD+ need covert to DD ");
+ }
int codec_type = get_codec_type(out->hal_internal_format);
if (codec_type == AUDIO_FORMAT_PCM && out->config.rate > 48000 && (out->flags & AUDIO_OUTPUT_FLAG_DIRECT)) {
ALOGI("start output stream for high sample rate pcm for direct mode\n");
@@ -738,9 +748,21 @@ static int start_output_stream_direct (struct aml_stream_out *out)
}
if (codec_type_is_raw_data(codec_type) && !(out->flags & AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO)) {
- spdifenc_init(out->pcm, out->hal_internal_format);
- spdifenc_set_mute(out->offload_mute);
- out->spdif_enc_init_frame_write_sum = out->frame_write_sum;
+ if (out->need_convert) {
+ ALOGI("need_convert init %d ",__LINE__);
+ struct dolby_ddp_dec *ddp_dec = & (adev->ddp);
+ ddp_dec->digital_raw = 1;
+ if (ddp_dec->status != 1) {
+ int status = dcv_decoder_init_patch(ddp_dec);
+ ddp_dec->nIsEc3 = 1;
+ ALOGI("dcv_decoder_init_patch return :%d,is 61937 %d", status, ddp_dec->is_iec61937);
+ }
+
+ } else {
+ spdifenc_init(out->pcm, out->hal_internal_format);
+ spdifenc_set_mute(out->offload_mute);
+ out->spdif_enc_init_frame_write_sum = out->frame_write_sum;
+ }
}
out->codec_type = codec_type;
@@ -882,10 +904,10 @@ static size_t out_get_buffer_size (const struct audio_stream *stream)
size = EAC3_PERIOD_SIZE;//one iec61937 packet size
} else {
/*frame align*/
- if (adev->continuous_audio_mode) {
+ if (1 /* adev->continuous_audio_mode */) {
/*Tunnel sync HEADER is 16 bytes*/
if (out->flags & AUDIO_OUTPUT_FLAG_HW_AV_SYNC) {
- size = out->ddp_frame_size + 16;
+ size = out->ddp_frame_size + 20;
} else {
size = out->ddp_frame_size * 4;
}
@@ -926,7 +948,8 @@ static size_t out_get_buffer_size (const struct audio_stream *stream)
// bug_id - 158018, modify size value from PERIOD_SIZE to (PERIOD_SIZE * PLAYBACK_PERIOD_COUNT)
size = DEFAULT_PLAYBACK_PERIOD_SIZE*2/* * PLAYBACK_PERIOD_COUNT*/;
}
- size = ( (size + 15) / 16) * 16;
+ // remove alignment to have an accurate size
+ // size = ( (size + 15) / 16) * 16;
return size * audio_stream_out_frame_size ( (struct audio_stream_out *) stream);
}
@@ -1111,6 +1134,11 @@ static int out_standby_direct (struct audio_stream *stream)
}
out->pause_status = false;
set_codec_type (TYPE_PCM);
+
+ if (out->need_convert) {
+ ALOGI("need_convert release %d ",__LINE__);
+ dcv_decoder_release_patch(&adev->ddp);
+ }
/* clear the hdmitx channel config to default */
if (out->multich == 6) {
sysfs_set_sysfs_str ("/sys/class/amhdmitx/amhdmitx0/aud_output_chs", "0:0");
@@ -2655,10 +2683,20 @@ static ssize_t out_write_direct(struct audio_stream_out *stream, const void* buf
2) compressed audio data with IEC61937 wrapped (typically from amlogic amadec source)
we use the AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO to distiguwish the two cases.
*/
- if ((codec_type == TYPE_AC3 || codec_type == TYPE_EAC3) && (out->flags & AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO)) {
- spdifenc_init(out->pcm, out->hal_internal_format);
- spdifenc_set_mute(out->offload_mute);
- out->spdif_enc_init_frame_write_sum = out->frame_write_sum;
+ if ((codec_type == TYPE_AC3 || codec_type == TYPE_EAC3) && !(out->flags & AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO)) {
+ if (out->need_convert) {
+ struct dolby_ddp_dec *ddp_dec = &(adev->ddp);
+ ddp_dec->digital_raw = 1;
+ if (ddp_dec->status != 1) {
+ int status = dcv_decoder_init_patch(ddp_dec);
+ ddp_dec->nIsEc3 = 1;
+ ALOGI("dcv_decoder_init_patch return :%d,is 61937 %d", status, ddp_dec->is_iec61937);
+ }
+ } else {
+ spdifenc_init(out->pcm, out->hal_internal_format);
+ spdifenc_set_mute(out->offload_mute);
+ out->spdif_enc_init_frame_write_sum = out->frame_write_sum;
+ }
}
// todo: check timestamp header PTS discontinue for new sync point after seek
if ((codec_type == TYPE_AC3 || codec_type == TYPE_EAC3)) {
@@ -2702,13 +2740,14 @@ static ssize_t out_write_direct(struct audio_stream_out *stream, const void* buf
return hwsync_cost_bytes;
}
if (cur_pts != 0xffffffff && outsize > 0) {
+ int hwsync_hdmi_latency = aml_audio_get_hwsync_latency_offset();
// if we got the frame body,which means we get a complete frame.
//we take this frame pts as the first apts.
//this can fix the seek discontinue,we got a fake frame,which maybe cached before the seek
if (hw_sync->first_apts_flag == false) {
- if (cur_pts >= ((out_get_latency (stream)/4) + HDMI_LATENCY_MS) * 90
+ if (cur_pts >= (out_get_latency(stream) + hwsync_hdmi_latency) * 90
/*&& out->last_frames_postion > 0*/) {
- cur_pts -= ((out_get_latency (stream)/4) + HDMI_LATENCY_MS) * 90;
+ cur_pts -= (out_get_latency(stream) + hwsync_hdmi_latency) * 90;
aml_audio_hwsync_set_first_pts(out->hwsync, cur_pts);
} else {
ALOGI("%s(), first pts not set, cur_pts %lld, last position %lld",
@@ -2719,7 +2758,7 @@ static ssize_t out_write_direct(struct audio_stream_out *stream, const void* buf
uint32_t apts32;
uint pcr = 0;
uint apts_gap = 0;
- uint64_t latency = ((out_get_latency (stream)/4) + HDMI_LATENCY_MS) * 90;
+ uint64_t latency = (out_get_latency(stream) + hwsync_hdmi_latency) * 90;
// check PTS discontinue, which may happen when audio track switching
// discontinue means PTS calculated based on first_apts and frame_write_sum
// does not match the timestamp of next audio samples
@@ -2757,7 +2796,7 @@ static ssize_t out_write_direct(struct audio_stream_out *stream, const void* buf
} else {
//audio pts smaller than pcr,need skip frame.
//we assume one frame duration is 32 ms for DD+(6 blocks X 1536 frames,48K sample rate)
- if (out->codec_type == TYPE_EAC3 && outsize > 0) {
+ if ((out->codec_type == TYPE_EAC3 || out->need_convert) && outsize > 0) {
ALOGI ("audio slow 0x%x,skip frame @pts 0x%"PRIx64",pcr 0x%x,cur apts 0x%x\n",
apts_gap, cur_pts, pcr, apts32);
out->frame_skip_sum += 1536;
@@ -2804,10 +2843,33 @@ static ssize_t out_write_direct(struct audio_stream_out *stream, const void* buf
ALOGD("could not open file:/data/tmp/hal_audio_out.pcm");
}
}
- if (codec_type_is_raw_data (out->codec_type) && ! (out->flags & AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO) ) {
+ if (codec_type_is_raw_data (out->codec_type) && !(out->flags & AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO) ) {
//here to do IEC61937 pack
//ALOGV ("IEC61937 write size %zu,hw_sync_mode %d,flag %x\n", out_frames * frame_size, out->hw_sync_mode, out->flags);
- if (out->codec_type > 0) {
+ if (out->need_convert) {
+ int ret = -1;
+ struct dolby_ddp_dec *ddp_dec = & (adev->ddp);
+ int process_bytes = in_frames * frame_size;
+ do {
+ if (ddp_dec->status == 1) {
+ ret = dcv_decoder_process_patch(ddp_dec, (unsigned char *)buf, process_bytes);
+ if (ret != 0)
+ break;
+ process_bytes = 0;
+ } else {
+ config_output(stream);
+ }
+ if (ddp_dec->outlen_raw > 0) {
+ ret = pcm_write (out->pcm, ddp_dec->outbuf_raw, ddp_dec->outlen_raw);
+ }
+ if (ret == 0) {
+ out->frame_write_sum += ddp_dec->outlen_raw / 4 ;
+ } else {
+ ALOGI ("pcm_get_error(out->pcm):%s",pcm_get_error (out->pcm) );
+ }
+ } while(ddp_dec->remain_size >= 768);
+
+ } else if (out->codec_type > 0) {
// compressed audio DD/DD+
bytes = spdifenc_write ( (void *) buf, out_frames * frame_size);
//need return actual size of this burst write
@@ -2910,8 +2972,14 @@ static ssize_t out_write_direct(struct audio_stream_out *stream, const void* buf
exit:
total_frame = out->frame_write_sum + out->frame_skip_sum;
- latency_frames = out_get_latency_frames(stream)/4;
- latency_frames += HDMI_LATENCY_MS * 48;
+ latency_frames = out_get_latency_frames(stream);
+ //latency_frames += HDMI_LATENCY_MS * 48;
+ int tuning_latency = aml_audio_get_arc_latency_offset(adev->sink_format);
+ if ((latency_frames + tuning_latency * 48) < 0) {
+ latency_frames = 0;
+ } else {
+ latency_frames += tuning_latency * 48;
+ }
clock_gettime (CLOCK_MONOTONIC, &out->timestamp);
out->lasttimestamp.tv_sec = out->timestamp.tv_sec;
out->lasttimestamp.tv_nsec = out->timestamp.tv_nsec;
@@ -2920,7 +2988,9 @@ exit:
} else {
out->last_frames_postion = 0;//total_frame;
}
- ALOGV("out %p,out->last_frames_postion %"PRId64", latency = %d\n", out, out->last_frames_postion, latency_frames);
+ if (adev->debug_flag)
+ ALOGD("out %p,out->last_frames_postion %"PRId64", latency = %d, skp sum %lld , tune frames %d\n",
+ out, out->last_frames_postion, latency_frames, out->frame_skip_sum, tuning_latency);
pthread_mutex_unlock (&out->lock);
if (ret != 0) {
usleep (bytes * 1000000 / audio_stream_out_frame_size (stream) /
@@ -4108,6 +4178,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out->standby = true;
out->frame_write_sum = 0;
out->hw_sync_mode = false;
+ out->need_convert = false;
//aml_audio_hwsync_init(out->hwsync,out);
/* FIXME: when we support multiple output devices, we will want to
* do the following:
@@ -7956,6 +8027,11 @@ void adev_close_output_stream_new(struct audio_hw_device *dev,
deleteSubMixingInput(aml_out);
}
}
+ if (aml_out->hw_sync_mode) {
+ ALOGI("%s set AUDIO_STOP when close stream\n",__func__);
+ sysfs_set_sysfs_str (TSYNC_EVENT, "AUDIO_STOP");
+ }
+
adev_close_output_stream(dev, stream);
adev->dual_decoder_support = false;
ALOGD("%s: exit", __func__);
diff --git a/audio/audio_hal/audio_hw.h b/audio/audio_hal/audio_hw.h
index 2a7976a..3908709 100755
--- a/audio/audio_hal/audio_hw.h
+++ b/audio/audio_hal/audio_hw.h
@@ -548,6 +548,7 @@ struct aml_stream_out {
int debug_stream;
uint64_t us_used_last_write;
bool offload_mute;
+ bool need_convert;
};
typedef ssize_t (*write_func)(struct audio_stream_out *stream, const void *buffer, size_t bytes);
diff --git a/audio/audio_hal/audio_hw_utils.c b/audio/audio_hal/audio_hw_utils.c
index c70e799..72f05a5 100755
--- a/audio/audio_hal/audio_hw_utils.c
+++ b/audio/audio_hal/audio_hw_utils.c
@@ -412,16 +412,9 @@ int aml_audio_get_arc_latency_offset(int aformat)
int ret = -1;
int latency_ms = 0;
char *prop_name = NULL;
- if (aformat == AUDIO_FORMAT_AC3) {
- prop_name = "media.audio.hal.arc_latency.dd";
- latency_ms = -30;
- } else if (aformat == AUDIO_FORMAT_E_AC3) {
- prop_name = "media.audio.hal.arc_latency.ddp";
- latency_ms = -40;
- } else {
- prop_name = "media.audio.hal.arc_latency.pcm";
- latency_ms = -30;
- }
+ (void)aformat;
+ prop_name = "media.audio.hal.arc_latency.ddp";
+ latency_ms = 0;
ret = property_get(prop_name, buf, NULL);
if (ret > 0) {
latency_ms = atoi(buf);
@@ -429,6 +422,22 @@ int aml_audio_get_arc_latency_offset(int aformat)
return latency_ms;
}
+int aml_audio_get_hwsync_latency_offset(void)
+{
+ char buf[PROPERTY_VALUE_MAX];
+ int ret = -1;
+ int latency_ms = 0;
+ char *prop_name = NULL;
+
+ prop_name = "media.audio.hal.hwsync_latency.ddp";
+ latency_ms = 0;
+ ret = property_get(prop_name, buf, NULL);
+ if (ret > 0) {
+ latency_ms = atoi(buf);
+ }
+ return latency_ms;
+}
+
int aml_audio_get_ddp_frame_size()
{
int frame_size = DDP_FRAME_SIZE;
@@ -469,22 +478,34 @@ uint32_t out_get_outport_latency(const struct audio_stream_out *stream)
return latency_ms;
}
+static bool is_4x_rate_fmt(int codec_type)
+{
+ return (codec_type == TYPE_EAC3) ||
+ (codec_type == TYPE_DTS_HD_MA) ||
+ (codec_type == TYPE_DTS_HD);
+}
+
uint32_t out_get_latency_frames(const struct audio_stream_out *stream)
{
const struct aml_stream_out *out = (const struct aml_stream_out *)stream;
snd_pcm_sframes_t frames = 0;
uint32_t whole_latency_frames;
int ret = 0;
+ int codec_type = get_codec_type(out->hal_internal_format);
+ int mul = 1;
+
+ if (is_4x_rate_fmt(codec_type))
+ mul = 4;
whole_latency_frames = out->config.period_size * out->config.period_count;
if (!out->pcm || !pcm_is_ready(out->pcm)) {
- return whole_latency_frames;
+ return whole_latency_frames / mul;
}
ret = pcm_ioctl(out->pcm, SNDRV_PCM_IOCTL_DELAY, &frames);
if (ret < 0) {
- return whole_latency_frames;
+ return whole_latency_frames / mul;
}
- return frames;
+ return frames / mul;
}
int aml_audio_get_spdif_tuning_latency(void)
diff --git a/audio/audio_hal/audio_hw_utils.h b/audio/audio_hal/audio_hw_utils.h
index 72be6d7..c10bd3a 100755
--- a/audio/audio_hal/audio_hw_utils.h
+++ b/audio/audio_hal/audio_hw_utils.h
@@ -39,6 +39,7 @@ int aml_audio_get_debug_flag();
int aml_audio_debug_set_optical_format();
int aml_audio_dump_audio_bitstreams(const char *path, const void *buf, size_t bytes);
int aml_audio_get_arc_latency_offset(int format);
+int aml_audio_get_hwsync_latency_offset(void);
int aml_audio_get_ddp_frame_size();
bool is_stream_using_mixer(struct aml_stream_out *out);
uint32_t out_get_outport_latency(const struct audio_stream_out *stream);
diff --git a/audio/audio_hal/audio_hwsync.c b/audio/audio_hal/audio_hwsync.c
index 751e143..12e0a16 100755..100644
--- a/audio/audio_hal/audio_hwsync.c
+++ b/audio/audio_hal/audio_hwsync.c
@@ -36,11 +36,13 @@
void aml_hwsync_set_tsync_pause(void)
{
+ ALOGI("%s(), send pause event", __func__);
sysfs_set_sysfs_str(TSYNC_EVENT, "AUDIO_PAUSE");
}
void aml_hwsync_set_tsync_resume(void)
{
+ ALOGI("%s(), send resuem event", __func__);
sysfs_set_sysfs_str(TSYNC_EVENT, "AUDIO_RESUME");
}
@@ -472,9 +474,9 @@ int aml_audio_hwsync_lookup_apts(audio_hwsync_t *p_hwsync, size_t offset, unsign
ALOGE("%s,apts lookup failed,align %zu,offset %zu", __func__, align, offset);
} else if (p_hwsync->first_apts_flag) {
latency_frames = out_get_latency_frames(stream);
- if (get_output_format(stream) == AUDIO_FORMAT_E_AC3) {
- latency_frames /= 4;
- }
+ //if (get_output_format(stream) == AUDIO_FORMAT_E_AC3) {
+ // latency_frames /= 4;
+ //}
latency_pts = latency_frames / 48 * 90;
if (*p_apts > latency_pts) {
*p_apts -= latency_pts;
diff --git a/audio/audio_hal/hw_avsync_callbacks.c b/audio/audio_hal/hw_avsync_callbacks.c
index 2950618..a4a6c8c 100755
--- a/audio/audio_hal/hw_avsync_callbacks.c
+++ b/audio/audio_hal/hw_avsync_callbacks.c
@@ -132,8 +132,9 @@ int on_meta_data_cbk(void *cookie,
__func__, adev->tsync_fd, ret);
}
if (out->debug_stream)
- ALOGD("%s(): audio pts %dms, pcr %dms, latency %lldms, pcr leads %dms",
- __func__, pts32/90, pcr/90, latency/90, (int)(pcr - pts32)/90);
+ ALOGD("%s()audio pts %dms, pcr %dms, latency %lldms, diff %dms",
+ __func__, pts32/90, pcr/90, latency/90,
+ (pts32 > pcr) ? (pts32 - pcr)/90 : (pcr - pts32)/90);
apts_gap = get_pts_gap(pcr, pts32);
//sync_status = pcm_check_hwsync_status(apts_gap);
sync_status = pcm_check_hwsync_status1(pcr, pts32);
diff --git a/audio/audio_hal/sub_mixing_factory.c b/audio/audio_hal/sub_mixing_factory.c
index 96a4195..e8cce49 100755..100644
--- a/audio/audio_hal/sub_mixing_factory.c
+++ b/audio/audio_hal/sub_mixing_factory.c
@@ -65,9 +65,6 @@ static int initSubMixngOutput(
pcm_cfg.period_count = DEFAULT_PLAYBACK_PERIOD_CNT;
//pcm_cfg.period_count = PLAYBACK_PERIOD_COUNT;
//pcm_cfg.start_threshold = pcm_cfg.period_size * pcm_cfg.period_count;
- pcm_cfg.stop_threshold = pcm_cfg.period_size * pcm_cfg.period_count - 128;
- pcm_cfg.silence_threshold = pcm_cfg.stop_threshold;
- pcm_cfg.silence_size = 1024;
if (cfg.format == AUDIO_FORMAT_PCM_16_BIT)
pcm_cfg.format = PCM_FORMAT_S16_LE;
@@ -351,6 +348,7 @@ static ssize_t out_write_hwsync_lpcm(struct audio_stream_out *stream, const void
out->port_index = get_input_port_index(&out->audioCfg, out->flags);
ALOGI("%s(), hwsync port index = %d", __func__, out->port_index);
out->standby = false;
+ mixer_set_continuous_output(sm->mixerData, false);
}
if (out->pause_status) {
ALOGW("%s(), write in pause status!!", __func__);
@@ -709,7 +707,10 @@ static int initSubMixingInputPcm(
out->stream.get_presentation_position = out_get_presentation_position_port;
}
list_init(&out->mdata_list);
-
+ if (hwsync_lpcm) {
+ ALOGI("%s(), lpcm case", __func__);
+ mixer_set_continuous_output(sm->mixerData, true);
+ }
return 0;
}
@@ -718,11 +719,21 @@ static int deleteSubMixingInputPcm(struct aml_stream_out *out)
struct aml_audio_device *adev = out->dev;
struct subMixing *sm = adev->sm;
struct amlAudioMixer *audio_mixer = sm->mixerData;
+ struct audio_config *config = &out->audioCfg;
+ bool hwsync_lpcm = false;
+ int flags = out->flags;
+ int channel_count = popcount(config->channel_mask);
+
+ hwsync_lpcm = (flags & AUDIO_OUTPUT_FLAG_HW_AV_SYNC && config->sample_rate <= 48000 &&
+ audio_is_linear_pcm(config->format) && channel_count <= 2);
ALOGI("%s(), cnt_stream_using_mixer %d",
__func__, sm->cnt_stream_using_mixer);
//delete_mixer_input_port(audio_mixer, out->port_index);
-
+ if (hwsync_lpcm) {
+ ALOGI("%s(), lpcm case", __func__);
+ mixer_set_continuous_output(sm->mixerData, false);
+ }
return 0;
}
diff --git a/audio/bt_voice/kehwin/32/btmic.a b/audio/bt_voice/kehwin/32/btmic.a
index be3b9c1..3b834fe 100755
--- a/audio/bt_voice/kehwin/32/btmic.a
+++ b/audio/bt_voice/kehwin/32/btmic.a
@@ -1,9 +1,6 @@
!<arch>
/ 0 0 0 0 8982 `
-
-
-
-
+
RealtkAudioImp.o/
AudioSyncTimer.o/
audio_kw.o/ 0 0 0 644 65372 `
@@ -188,8 +185,8 @@ K­


!
-
-ELF
+
+ELF
0ĉ
X
 áþÿÿë
@@ -204,24 +201,24 @@ X
-@•åp‡â
-$
-aQã3
-$
-]
-
+@•åp‡â
+aQã;
+%
+$
+ Pã6
+
&
-Pãîÿÿ°
-$
-aQãÚÿÿ
-Êÿÿê PãÙÿÿ
-$
-¨Ÿå8…⤠Ÿå
-
- á  á0 á
+Pã
+íÿÿê
+Pã
+%
+ Pãàÿÿ
+ÆÿÿêX
+ٌ8ɉΠٌ
+ á  á0 á
-
+

d
d
@@ -495,14 +492,14 @@ D!
Ê'
+
+
-
+
-
+
A 
- 
+ 
:
&º
@@ -526,26 +523,25 @@ JÁ
¼º
>
:¹‚
->
-‚‚(
+>
:
±ä
->
-:
-:
-½‚
-J
-K
-£~‚/Ý‚J £~‚
-‚J £~J/ÝJ
-ºåJ
-‚(J
-
-
-J
-JJ
-Jº
-Þ
+>
+:×~‚
+:
+½‚
+J
+K
+Ÿ~‚/á‚J Ÿ~‚
+‚J Ÿ~J/áJ
+ºåJ
+‚(J
+
+
+J
+JJ
+Jº
+Ú
‚óƒ
‚óƒ%

@@ -557,7 +553,7 @@ Jº
æ~J JJ*‡–‚


-
+

@@ -568,9 +564,9 @@ Jº
-
+
-
+
@@ -580,7 +576,7 @@ Jº
-
+



@@ -626,61 +622,59 @@ Jº
*
1
6
-7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+7
+
+
+
+
+
+
+
+
+
+
+
+
+

-
+

-
-
+
+

-
+

-
-
+
+

-
-
+
+

-
+

-
+

-
-
+
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
ELF
 á0 á
`ô
@@ -1442,8 +1436,8 @@ K

-
-ELF
+
+ELF
@@ -1471,7 +1465,7 @@ K
@ô
@ôÏ
-
+
.n: ; I<?á2
@@ -1562,54 +1556,54 @@ h


-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
A 
- 
+ 
-ä
-‚ J ISó:
+ä
+‚ J ISó:


ƒK
-S=:
-JMH
-‚0J
-‚0J
-‚0J
-J4J
-‚ JJ JJ(J
-‚0J
-‚0J
-J4J
-‚ JJ JJ(J
-óJÐ
-u
-(
-ƒJ JuJ ¹Kœòºƒ Kƒ K K IKã
+S=:
+JMH
+‚0J
+‚0J
+‚0J
+J4J
+‚ JJ JJ(J
+‚0J
+‚0J
+J4J
+‚ JJ JJ(J
+óJÎ
+u
+(
+ƒJ JuJ ¹Kšòºƒ Kƒ K K IKå
$
$
-‚òKI¿á
-‚ºƒ Kƒ K K IK0JºƒKƒKKIK >‚KKƒ»Jƒ„u,
+‚òKI¿á
+‚ºƒ Kƒ K K IK0JºƒKƒKKIK À



@@ -1622,7 +1616,7 @@ J4J
³J JÏ
FJ J<ò
æ~J JJ*‡–‚
-ý
+ý
@@ -1668,14 +1662,14 @@ J4J



-
-
-
+
+
+
-
+
-
-
+
+
ELF
@ô@àÏ
@ô
diff --git a/audio/bt_voice/kehwin/64/btmic.a b/audio/bt_voice/kehwin/64/btmic.a
index ce9025e..655f734 100755
--- a/audio/bt_voice/kehwin/64/btmic.a
+++ b/audio/bt_voice/kehwin/64/btmic.a
@@ -1,6 +1,6 @@
!<arch>
/ 0 0 0 0 8982 `
-
+
RealtkAudioImp.o/
AudioSyncTimer.o/
audio_kw.o/ 0 0 0 644 72016 `
@@ -165,15 +165,12 @@ w


-ELF
-
-=
-
-=
-—@¹_kA
+ELF
+
+=
A‘á‘ gžh~
-A‘ᑉ
+A‘ᑉ

i
i
@@ -446,18 +443,18 @@ a!
1!
ß!
ê'
-
+
– —˜™š
– —˜™š›œ
-– —˜
-– ›œ
-– —˜™š›œ
-–
-–
-–
+– —˜
+– ›œ
+– —˜™š
+–
+–
+–
:
&>~
@@ -479,26 +476,25 @@ a!
¼¬ …ò
>÷}J ‰JÂ~‚ ¾J
:
-›‚
-<º®
+›‚
:
-±8
->
-:
-:
-?
-‚
-LIK
-£~ò/ÝòJ
-òJ £~J/ÝJ
-tå
-ò,
-
-
-ºJ
-ºº
-„ ÜJ¥~<
+±4
+>
+:×~J
+:
+?
+‚
+LIK
+Ÿ~ò/áòJ
+òJ Ÿ~J/áJ
+tå
+ò,
+
+
+ºJ
+ºº
+„ ØJ©~<
º=K
º=K%

@@ -510,16 +506,16 @@ LIK
æ~JJ‚*‡–J


-
+
-
+
-
+
-
+
@@ -581,26 +577,29 @@ LIK


!
-&
+&
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
ELF
À=às‚<`À=às<`À=às€<
I
@@ -1295,7 +1294,7 @@ I
a
Á‘ ‘i
Á‘iŽøªŽ ø€^@ù ‘¡‘‰
-a
+a
.n: ; I<?á2
@@ -1384,7 +1383,7 @@ h

-
+
@@ -1400,33 +1399,33 @@ h
-– —˜›œ
+– —˜›œ
-ä
-ò J ISK I:
+ä
+ò J ISK I:



-¹Sƒ I:
-ƒL
-º0I
-ò0I
-ò$I
-ò0I
-ò ‚J JJ JJ­I
-ò0I
-ò$I
-ò0I
-ò ‚J JJ JJ­I
-uJÐ
-$
-@
-ó„ sKœJºƒL K ¹Kã
+¹Sƒ I:
+ƒL
+º0I
+ò0I
+ò$I
+ò0I
+ò ‚J JJ JJ­I
+ò0I
+ò$I
+ò0I
+ò ‚J JJ JJ­I
+uJÎ
+$
+@
+ó„ sKšJºƒL K ¹Kå
>
>
-J=I‡$
-ºòƒ„ K ¹K0JºƒLK¹KÀ
+J=I‡$
+ºòƒ„ K ¹K0JºƒLK¹KÂ



@@ -1439,7 +1438,7 @@ h
³ J
F J
æ~JJ‚*‡–J
-ý
+ý

@@ -1500,16 +1499,15 @@ h
-
-
-
-
+
+
+
-
+
ELF
diff --git a/audio/utils/spdifenc_wrap.cpp b/audio/utils/spdifenc_wrap.cpp
index f83296d..68f0cd0 100755
--- a/audio/utils/spdifenc_wrap.cpp
+++ b/audio/utils/spdifenc_wrap.cpp
@@ -97,7 +97,8 @@ public:
: SPDIFEncoder(format),
pcm_handle(mypcm), mTotalBytes(0),
mMute(false),// eac3_frame(0),
- mFormat(format)
+ mFormat(format),
+ mFirstFrameMuted(false)
{};
virtual ssize_t writeOutput(const void* buffer, size_t bytes)
{
@@ -120,6 +121,10 @@ public:
if (mMute) {
muteFrame(buf, bytes);
}
+ if (mFirstFrameMuted == false) {
+ memset(buf, 0, bytes);
+ mFirstFrameMuted = true;
+ }
ret = pcm_write(pcm_handle, buffer, bytes);
if (ret)
return ret;
@@ -158,6 +163,7 @@ private:
bool mMute;
// uint64_t eac3_frame;
audio_format_t mFormat;
+ bool mFirstFrameMuted;
};
static MySPDIFEncoder *myencoder = NULL;
extern "C" int spdifenc_init(struct pcm *mypcm, audio_format_t format)
diff --git a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
index 09164f3..e86b897 100755..100644
--- a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
+++ b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
@@ -319,7 +319,7 @@ status_t V4LCameraAdapter::initialize(CameraProperties::Properties* caps)
char property[PROPERTY_VALUE_MAX];
int enable = 0;
memset(property,0,sizeof(property));
- if(property_get("ro.camera.preview.UseMJPEG", property, NULL) > 0){
+ if (property_get("ro.media.camera_preview.usemjpeg", property, NULL) > 0) {
enable = atoi(property);
}
mUseMJPEG = (enable!=0)?true:false;
@@ -327,7 +327,7 @@ status_t V4LCameraAdapter::initialize(CameraProperties::Properties* caps)
if(property_get("camera.preview.DebugMJPEG", property, NULL) > 0){
enable = atoi(property);
}
- mDebugMJPEG = (enable!=0)?true:false;
+ mDebugMJPEG = (enable!=0)?true:false;
}
if(mUseMJPEG == true){
@@ -2802,7 +2802,7 @@ extern "C" int getValidFrameSize(int camera_fd, int pixel_format, char *framesiz
support_w = 10000;
support_h = 10000;
memset(property,0,sizeof(property));
- if(property_get("ro.camera.preview.MaxSize", property, NULL) > 0){
+ if (property_get("ro.media.camera_preview.maxsize", property, NULL) > 0) {
CAMHAL_LOGDB("support Max Preview Size :%s",property);
if(sscanf(property,"%dx%d",&support_w,&support_h)!=2){
support_w = 10000;
@@ -2883,7 +2883,7 @@ static void ParserLimitedRateInfo(LimitedRate_t* rate)
char* pos = NULL;
memset(property,0,sizeof(property));
rate->num = 0;
- if(property_get("ro.camera.preview.LimitedRate", property, NULL) > 0){
+ if (property_get("ro.media.camera_preview.limitedrate", property, NULL) > 0) {
pos = &property[0];
while((pos != NULL)&&(rate->num<MAX_LIMITED_RATE_NUM)){
if(sscanf(pos,"%dx%dx%d",&w,&h,&r)!=3){
@@ -3394,7 +3394,7 @@ extern "C" void loadCaps(int camera_id, CameraProperties::Properties* params) {
int useMJPEG = 0;
preview_format = enumFrameFormats(camera_fd, CAM_PREVIEW);
memset(property,0,sizeof(property));
- if(property_get("ro.camera.preview.UseMJPEG", property, NULL) > 0){
+ if (property_get("ro.media.camera_preview.usemjpeg", property, NULL) > 0) {
useMJPEG = atoi(property);
}
#ifdef AMLOGIC_USB_CAMERA_SUPPORT
diff --git a/camera/v3/EmulatedFakeCamera3.cpp b/camera/v3/EmulatedFakeCamera3.cpp
index de623ad..80ec5a0 100755
--- a/camera/v3/EmulatedFakeCamera3.cpp
+++ b/camera/v3/EmulatedFakeCamera3.cpp
@@ -1687,7 +1687,7 @@ status_t EmulatedFakeCamera3::constructStaticInfo() {
if ( mSensorType == SENSOR_USB) {
char property[PROPERTY_VALUE_MAX];
- property_get("rw.camera.usb.faceback", property, "false");
+ property_get("ro.media.camera_usb.faceback", property, "false");
if (strstr(property, "true"))
mFacingBack = 1;
else
diff --git a/camera/v3/fake-pipeline2/Sensor.cpp b/camera/v3/fake-pipeline2/Sensor.cpp
index f646944..f026b62 100755..100644
--- a/camera/v3/fake-pipeline2/Sensor.cpp
+++ b/camera/v3/fake-pipeline2/Sensor.cpp
@@ -1369,7 +1369,7 @@ int Sensor::getStreamConfigurations(uint32_t picSizes[], const int32_t kAvailabl
support_w = 10000;
support_h = 10000;
memset(property, 0, sizeof(property));
- if(property_get("ro.camera.preview.MaxSize", property, NULL) > 0){
+ if (property_get("ro.media.camera_preview.maxsize", property, NULL) > 0) {
CAMHAL_LOGDB("support Max Preview Size :%s",property);
if(sscanf(property,"%dx%d",&support_w,&support_h)!=2){
support_w = 10000;
@@ -1800,7 +1800,7 @@ int Sensor::getPictureSizes(int32_t picSizes[], int size, bool preview) {
support_w = 10000;
support_h = 10000;
memset(property, 0, sizeof(property));
- if(property_get("ro.camera.preview.MaxSize", property, NULL) > 0){
+ if (property_get("ro.media.camera_preview.maxsize", property, NULL) > 0) {
CAMHAL_LOGDB("support Max Preview Size :%s",property);
if(sscanf(property,"%dx%d",&support_w,&support_h)!=2){
support_w = 10000;
diff --git a/hwcomposer/common/base/HwcConfig.cpp b/hwcomposer/common/base/HwcConfig.cpp
index adc36a9..c7cbd83 100755
--- a/hwcomposer/common/base/HwcConfig.cpp
+++ b/hwcomposer/common/base/HwcConfig.cpp
@@ -17,7 +17,7 @@ int32_t HwcConfig::getFramebufferSize(int disp, uint32_t & width, uint32_t & hei
char uiMode[PROPERTY_VALUE_MAX] = {0};
if (disp == 0) {
/*primary display*/
- if (sys_get_string_prop("ro.ui_mode", uiMode) > 0) {
+ if (sys_get_string_prop("vendor.ui_mode", uiMode) > 0) {
if (!strncmp(uiMode, "720", 3)) {
width = 1280;
height = 720;
@@ -25,7 +25,7 @@ int32_t HwcConfig::getFramebufferSize(int disp, uint32_t & width, uint32_t & hei
width = 1920;
height = 1080;
} else {
- MESON_ASSERT(0, "%s: get not support mode [%s] from ro.ui_mode",
+ MESON_ASSERT(0, "%s: get not support mode [%s] from vendor.ui_mode",
__func__, uiMode);
}
} else {