Loading hal/audio_extn/audio_extn.h +5 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,10 @@ AUDIO_FORMAT_AAC_SUB_HE_V2) #endif #ifndef AUDIO_OUTPUT_FLAG_TIMESTAMP #define AUDIO_OUTPUT_FLAG_TIMESTAMP 0x10000 #endif #ifndef COMPRESS_METADATA_NEEDED #define audio_extn_parse_compress_metadata(out, parms) (0) #else Loading Loading @@ -829,4 +833,5 @@ int audio_extn_utils_get_avt_device_drift( struct audio_usecase *usecase, struct audio_avt_device_drift_param *drift_param); int audio_extn_utils_compress_get_dsp_latency(struct stream_out *out); int audio_extn_utils_compress_set_render_mode(struct stream_out *out); #endif /* AUDIO_EXTN_H */ hal/audio_extn/utils.c +43 −0 Original line number Diff line number Diff line Loading @@ -1698,3 +1698,46 @@ int audio_extn_utils_compress_get_dsp_latency(struct stream_out *out __unused) return COMPRESS_OFFLOAD_PLAYBACK_LATENCY; } #endif #ifdef SNDRV_COMPRESS_RENDER_MODE int audio_extn_utils_compress_set_render_mode(struct stream_out *out) { struct snd_compr_metadata metadata; int ret = -EINVAL; if (!(is_offload_usecase(out->usecase))) { ALOGE("%s:: not supported for non offload session", __func__); goto exit; } if (!out->compr) { ALOGD("%s:: Invalid compress handle", __func__); goto exit; } ALOGD("%s:: render mode %d", __func__, out->render_mode); metadata.key = SNDRV_COMPRESS_RENDER_MODE; if (out->render_mode == RENDER_MODE_AUDIO_MASTER) { metadata.value[0] = SNDRV_COMPRESS_RENDER_MODE_AUDIO_MASTER; } else if (out->render_mode == RENDER_MODE_AUDIO_STC_MASTER) { metadata.value[0] = SNDRV_COMPRESS_RENDER_MODE_STC_MASTER; } else { ret = 0; goto exit; } ret = compress_set_metadata(out->compr, &metadata); if(ret) { ALOGE("%s::error %s", __func__, compress_get_error(out->compr)); } exit: return ret; } #else int audio_extn_utils_compress_set_render_mode(struct stream_out *out __unused) { ALOGD("%s:: configuring render mode not supported", __func__); return 0; } #endif hal/audio_hw.c +10 −0 Original line number Diff line number Diff line Loading @@ -2363,6 +2363,8 @@ int start_output_stream(struct stream_out *out) compress_set_max_poll_wait(out->compr, 1000); } audio_extn_utils_compress_set_render_mode(out); audio_extn_dts_create_state_notifier_node(out->usecase); audio_extn_dts_notify_playback_state(out->usecase, 0, out->sample_rate, popcount(out->channel_mask), Loading Loading @@ -4133,6 +4135,14 @@ int adev_open_output_stream(struct audio_hw_device *dev, if (flags & AUDIO_OUTPUT_FLAG_NON_BLOCKING) out->non_blocking = 1; if ((flags & AUDIO_OUTPUT_FLAG_TIMESTAMP) && (flags & AUDIO_OUTPUT_FLAG_HW_AV_SYNC)) { out->render_mode = RENDER_MODE_AUDIO_STC_MASTER; } else if(flags & AUDIO_OUTPUT_FLAG_TIMESTAMP) { out->render_mode = RENDER_MODE_AUDIO_MASTER; } else { out->render_mode = RENDER_MODE_AUDIO_NO_TIMESTAMP; } out->send_new_metadata = 1; out->send_next_track_params = false; Loading hal/audio_hw.h +9 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,12 @@ struct offload_cmd { int data[]; }; typedef enum render_mode { RENDER_MODE_AUDIO_NO_TIMESTAMP = 0, RENDER_MODE_AUDIO_MASTER, RENDER_MODE_AUDIO_STC_MASTER, } render_mode_t; struct stream_app_type_cfg { int sample_rate; uint32_t bit_width; Loading Loading @@ -252,11 +258,14 @@ struct stream_out { bool realtime; int af_period_multiplier; struct audio_device *dev; void* qaf_stream_handle; pthread_cond_t qaf_offload_cond; pthread_t qaf_offload_thread; struct listnode qaf_offload_cmd_list; uint32_t platform_latency; render_mode_t render_mode; audio_offload_info_t info; }; Loading Loading
hal/audio_extn/audio_extn.h +5 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,10 @@ AUDIO_FORMAT_AAC_SUB_HE_V2) #endif #ifndef AUDIO_OUTPUT_FLAG_TIMESTAMP #define AUDIO_OUTPUT_FLAG_TIMESTAMP 0x10000 #endif #ifndef COMPRESS_METADATA_NEEDED #define audio_extn_parse_compress_metadata(out, parms) (0) #else Loading Loading @@ -829,4 +833,5 @@ int audio_extn_utils_get_avt_device_drift( struct audio_usecase *usecase, struct audio_avt_device_drift_param *drift_param); int audio_extn_utils_compress_get_dsp_latency(struct stream_out *out); int audio_extn_utils_compress_set_render_mode(struct stream_out *out); #endif /* AUDIO_EXTN_H */
hal/audio_extn/utils.c +43 −0 Original line number Diff line number Diff line Loading @@ -1698,3 +1698,46 @@ int audio_extn_utils_compress_get_dsp_latency(struct stream_out *out __unused) return COMPRESS_OFFLOAD_PLAYBACK_LATENCY; } #endif #ifdef SNDRV_COMPRESS_RENDER_MODE int audio_extn_utils_compress_set_render_mode(struct stream_out *out) { struct snd_compr_metadata metadata; int ret = -EINVAL; if (!(is_offload_usecase(out->usecase))) { ALOGE("%s:: not supported for non offload session", __func__); goto exit; } if (!out->compr) { ALOGD("%s:: Invalid compress handle", __func__); goto exit; } ALOGD("%s:: render mode %d", __func__, out->render_mode); metadata.key = SNDRV_COMPRESS_RENDER_MODE; if (out->render_mode == RENDER_MODE_AUDIO_MASTER) { metadata.value[0] = SNDRV_COMPRESS_RENDER_MODE_AUDIO_MASTER; } else if (out->render_mode == RENDER_MODE_AUDIO_STC_MASTER) { metadata.value[0] = SNDRV_COMPRESS_RENDER_MODE_STC_MASTER; } else { ret = 0; goto exit; } ret = compress_set_metadata(out->compr, &metadata); if(ret) { ALOGE("%s::error %s", __func__, compress_get_error(out->compr)); } exit: return ret; } #else int audio_extn_utils_compress_set_render_mode(struct stream_out *out __unused) { ALOGD("%s:: configuring render mode not supported", __func__); return 0; } #endif
hal/audio_hw.c +10 −0 Original line number Diff line number Diff line Loading @@ -2363,6 +2363,8 @@ int start_output_stream(struct stream_out *out) compress_set_max_poll_wait(out->compr, 1000); } audio_extn_utils_compress_set_render_mode(out); audio_extn_dts_create_state_notifier_node(out->usecase); audio_extn_dts_notify_playback_state(out->usecase, 0, out->sample_rate, popcount(out->channel_mask), Loading Loading @@ -4133,6 +4135,14 @@ int adev_open_output_stream(struct audio_hw_device *dev, if (flags & AUDIO_OUTPUT_FLAG_NON_BLOCKING) out->non_blocking = 1; if ((flags & AUDIO_OUTPUT_FLAG_TIMESTAMP) && (flags & AUDIO_OUTPUT_FLAG_HW_AV_SYNC)) { out->render_mode = RENDER_MODE_AUDIO_STC_MASTER; } else if(flags & AUDIO_OUTPUT_FLAG_TIMESTAMP) { out->render_mode = RENDER_MODE_AUDIO_MASTER; } else { out->render_mode = RENDER_MODE_AUDIO_NO_TIMESTAMP; } out->send_new_metadata = 1; out->send_next_track_params = false; Loading
hal/audio_hw.h +9 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,12 @@ struct offload_cmd { int data[]; }; typedef enum render_mode { RENDER_MODE_AUDIO_NO_TIMESTAMP = 0, RENDER_MODE_AUDIO_MASTER, RENDER_MODE_AUDIO_STC_MASTER, } render_mode_t; struct stream_app_type_cfg { int sample_rate; uint32_t bit_width; Loading Loading @@ -252,11 +258,14 @@ struct stream_out { bool realtime; int af_period_multiplier; struct audio_device *dev; void* qaf_stream_handle; pthread_cond_t qaf_offload_cond; pthread_t qaf_offload_thread; struct listnode qaf_offload_cmd_list; uint32_t platform_latency; render_mode_t render_mode; audio_offload_info_t info; }; Loading