Lines Matching refs:out
1114 struct stream_out *out = adev->primary_output; in put_echo_reference() local
1122 if (out != NULL && out->usecase == USECASE_AUDIO_PLAYBACK) { in put_echo_reference()
1127 if ((out->echo_reference_generation != prev_generation) || out->standby) in put_echo_reference()
1216 static int get_playback_delay(struct stream_out *out, in get_playback_delay() argument
1225 pcm_device = node_to_item(list_head(&out->pcm_dev_list), in get_playback_delay()
1244 out->config.rate); in get_playback_delay()
2098 static int send_offload_cmd_l(struct stream_out* out, int command) in send_offload_cmd_l() argument
2105 list_add_tail(&out->offload_cmd_list, &cmd->node); in send_offload_cmd_l()
2106 pthread_cond_signal(&out->offload_cond); in send_offload_cmd_l()
2111 static void stop_compressed_output_l(struct stream_out *out) in stop_compressed_output_l() argument
2113 out->send_new_metadata = 1; in stop_compressed_output_l()
2114 if (out->compr != NULL) { in stop_compressed_output_l()
2115 compress_stop(out->compr); in stop_compressed_output_l()
2116 while (out->offload_thread_blocked) { in stop_compressed_output_l()
2117 pthread_cond_wait(&out->cond, &out->lock); in stop_compressed_output_l()
2124 struct stream_out *out = (struct stream_out *) context; in offload_thread_loop() local
2132 pthread_mutex_lock(&out->lock); in offload_thread_loop()
2139 __func__, list_empty(&out->offload_cmd_list), in offload_thread_loop()
2140 out->offload_state); in offload_thread_loop()
2141 if (list_empty(&out->offload_cmd_list)) { in offload_thread_loop()
2143 pthread_cond_wait(&out->offload_cond, &out->lock); in offload_thread_loop()
2148 item = list_head(&out->offload_cmd_list); in offload_thread_loop()
2153 __func__, out->offload_state, cmd->cmd, out->compr); in offload_thread_loop()
2160 if (out->compr == NULL) { in offload_thread_loop()
2162 pthread_cond_signal(&out->cond); in offload_thread_loop()
2165 out->offload_thread_blocked = true; in offload_thread_loop()
2166 pthread_mutex_unlock(&out->lock); in offload_thread_loop()
2170 compress_wait(out->compr, -1); in offload_thread_loop()
2175 compress_next_track(out->compr); in offload_thread_loop()
2176 compress_partial_drain(out->compr); in offload_thread_loop()
2181 compress_drain(out->compr); in offload_thread_loop()
2189 pthread_mutex_lock(&out->lock); in offload_thread_loop()
2190 out->offload_thread_blocked = false; in offload_thread_loop()
2191 pthread_cond_signal(&out->cond); in offload_thread_loop()
2193 out->offload_callback(event, NULL, out->offload_cookie); in offload_thread_loop()
2198 pthread_cond_signal(&out->cond); in offload_thread_loop()
2199 while (!list_empty(&out->offload_cmd_list)) { in offload_thread_loop()
2200 item = list_head(&out->offload_cmd_list); in offload_thread_loop()
2204 pthread_mutex_unlock(&out->lock); in offload_thread_loop()
2209 static int create_offload_callback_thread(struct stream_out *out) in create_offload_callback_thread() argument
2211 pthread_cond_init(&out->offload_cond, (const pthread_condattr_t *) NULL); in create_offload_callback_thread()
2212 list_init(&out->offload_cmd_list); in create_offload_callback_thread()
2213 pthread_create(&out->offload_thread, (const pthread_attr_t *) NULL, in create_offload_callback_thread()
2214 offload_thread_loop, out); in create_offload_callback_thread()
2218 static int destroy_offload_callback_thread(struct stream_out *out) in destroy_offload_callback_thread() argument
2220 pthread_mutex_lock(&out->lock); in destroy_offload_callback_thread()
2221 send_offload_cmd_l(out, OFFLOAD_CMD_EXIT); in destroy_offload_callback_thread()
2223 pthread_mutex_unlock(&out->lock); in destroy_offload_callback_thread()
2224 pthread_join(out->offload_thread, (void **) NULL); in destroy_offload_callback_thread()
2225 pthread_cond_destroy(&out->offload_cond); in destroy_offload_callback_thread()
2232 struct stream_out *out = (struct stream_out *)usecase->stream; in uc_release_pcm_devices() local
2237 list_for_each_safe(node, next, &out->pcm_dev_list) { in uc_release_pcm_devices()
2250 struct stream_out *out = (struct stream_out *)usecase->stream; in uc_select_pcm_devices() local
2257 list_init(&out->pcm_dev_list); in uc_select_pcm_devices()
2262 list_add_tail(&out->pcm_dev_list, &pcm_device->stream_list_node); in uc_select_pcm_devices()
2265 mixer_card = adev_get_mixer_for_card(out->dev, pcm_profile->card); in uc_select_pcm_devices()
2274 static int out_close_pcm_devices(struct stream_out *out) in out_close_pcm_devices() argument
2278 struct audio_device *adev = out->dev; in out_close_pcm_devices()
2280 list_for_each(node, &out->pcm_dev_list) { in out_close_pcm_devices()
2303 static int out_open_pcm_devices(struct stream_out *out) in out_open_pcm_devices() argument
2309 list_for_each(node, &out->pcm_dev_list) { in out_open_pcm_devices()
2327 if (out->sample_rate != pcm_device->pcm_profile->config.rate) { in out_open_pcm_devices()
2331 out->sample_rate, pcm_device->pcm_profile->config.rate); in out_open_pcm_devices()
2332 ret = create_resampler(out->sample_rate, in out_open_pcm_devices()
2334 audio_channel_count_from_out_mask(out->channel_mask), in out_open_pcm_devices()
2345 out_close_pcm_devices(out); in out_open_pcm_devices()
2349 static int disable_output_path_l(struct stream_out *out) in disable_output_path_l() argument
2351 struct audio_device *adev = out->dev; in disable_output_path_l()
2354 uc_info = get_usecase_from_id(adev, out->usecase); in disable_output_path_l()
2357 __func__, out->usecase); in disable_output_path_l()
2368 static void enable_output_path_l(struct stream_out *out) in enable_output_path_l() argument
2370 struct audio_device *adev = out->dev; in enable_output_path_l()
2374 uc_info->id = out->usecase; in enable_output_path_l()
2376 uc_info->stream = (struct audio_stream *)out; in enable_output_path_l()
2377 uc_info->devices = out->devices; in enable_output_path_l()
2384 select_devices(adev, out->usecase); in enable_output_path_l()
2387 static int stop_output_stream(struct stream_out *out) in stop_output_stream() argument
2390 struct audio_device *adev = out->dev; in stop_output_stream()
2394 out->usecase, use_case_table[out->usecase]); in stop_output_stream()
2396 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD && in stop_output_stream()
2398 adev->offload_fx_stop_output(out->handle); in stop_output_stream()
2400 if (out->offload_state == OFFLOAD_STATE_PAUSED || in stop_output_stream()
2401 out->offload_state == OFFLOAD_STATE_PAUSED_FLUSHED) in stop_output_stream()
2403 out->offload_state = OFFLOAD_STATE_IDLE; in stop_output_stream()
2406 ret = disable_output_path_l(out); in stop_output_stream()
2412 int start_output_stream(struct stream_out *out) in start_output_stream() argument
2415 struct audio_device *adev = out->dev; in start_output_stream()
2418 __func__, out->usecase, use_case_table[out->usecase], out->devices, out->config.channels); in start_output_stream()
2420 enable_output_path_l(out); in start_output_stream()
2422 if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD) { in start_output_stream()
2423 out->compr = NULL; in start_output_stream()
2424 ret = out_open_pcm_devices(out); in start_output_stream()
2428 out->echo_reference = NULL; in start_output_stream()
2429 out->echo_reference_generation = adev->echo_reference_generation; in start_output_stream()
2431 out->echo_reference = adev->echo_reference; in start_output_stream()
2434 out->compr = compress_open(COMPRESS_CARD, COMPRESS_DEVICE, in start_output_stream()
2435 COMPRESS_IN, &out->compr_config); in start_output_stream()
2436 if (out->compr && !is_compress_ready(out->compr)) { in start_output_stream()
2437 ALOGE("%s: %s", __func__, compress_get_error(out->compr)); in start_output_stream()
2438 compress_close(out->compr); in start_output_stream()
2439 out->compr = NULL; in start_output_stream()
2443 if (out->offload_callback) in start_output_stream()
2444 compress_nonblock(out->compr, out->non_blocking); in start_output_stream()
2447 adev->offload_fx_start_output(out->handle); in start_output_stream()
2452 stop_output_stream(out); in start_output_stream()
2571 struct stream_out *out = (struct stream_out *)stream; in out_get_sample_rate() local
2573 return out->sample_rate; in out_get_sample_rate()
2585 struct stream_out *out = (struct stream_out *)stream; in out_get_buffer_size() local
2587 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { in out_get_buffer_size()
2588 return out->compr_config.fragment_size; in out_get_buffer_size()
2591 return out->config.period_size * in out_get_buffer_size()
2597 struct stream_out *out = (struct stream_out *)stream; in out_get_channels() local
2599 return out->channel_mask; in out_get_channels()
2604 struct stream_out *out = (struct stream_out *)stream; in out_get_format() local
2606 return out->format; in out_get_format()
2616 static int do_out_standby_l(struct stream_out *out) in do_out_standby_l() argument
2618 struct audio_device *adev = out->dev; in do_out_standby_l()
2621 out->standby = true; in do_out_standby_l()
2622 if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD) { in do_out_standby_l()
2623 out_close_pcm_devices(out); in do_out_standby_l()
2626 if (out->echo_reference != NULL) { in do_out_standby_l()
2627 out->echo_reference->write(out->echo_reference, NULL); in do_out_standby_l()
2628 if (out->echo_reference_generation != adev->echo_reference_generation) { in do_out_standby_l()
2629 ALOGV("%s: release_echo_reference %p", __func__, out->echo_reference); in do_out_standby_l()
2630 release_echo_reference(out->echo_reference); in do_out_standby_l()
2631 out->echo_reference_generation = adev->echo_reference_generation; in do_out_standby_l()
2633 out->echo_reference = NULL; in do_out_standby_l()
2637 stop_compressed_output_l(out); in do_out_standby_l()
2638 out->gapless_mdata.encoder_delay = 0; in do_out_standby_l()
2639 out->gapless_mdata.encoder_padding = 0; in do_out_standby_l()
2640 if (out->compr != NULL) { in do_out_standby_l()
2641 compress_close(out->compr); in do_out_standby_l()
2642 out->compr = NULL; in do_out_standby_l()
2645 status = stop_output_stream(out); in do_out_standby_l()
2652 struct stream_out *out = (struct stream_out *)stream; in out_standby() local
2653 struct audio_device *adev = out->dev; in out_standby()
2656 out->usecase, use_case_table[out->usecase]); in out_standby()
2657 pthread_mutex_lock(&out->lock); in out_standby()
2658 if (!out->standby) { in out_standby()
2660 do_out_standby_l(out); in out_standby()
2663 pthread_mutex_unlock(&out->lock); in out_standby()
2676 static int parse_compress_metadata(struct stream_out *out, struct str_parms *parms) in parse_compress_metadata() argument
2682 if (!out || !parms) { in parse_compress_metadata()
2700 out->gapless_mdata = tmp_mdata; in parse_compress_metadata()
2701 out->send_new_metadata = 1; in parse_compress_metadata()
2703 out->gapless_mdata.encoder_delay, out->gapless_mdata.encoder_padding); in parse_compress_metadata()
2711 struct stream_out *out = (struct stream_out *)stream; in out_set_parameters() local
2712 struct audio_device *adev = out->dev; in out_set_parameters()
2727 __func__, out->usecase, use_case_table[out->usecase], kvpairs, out->devices, adev->mode); in out_set_parameters()
2733 pthread_mutex_lock(&out->lock); in out_set_parameters()
2736 if (((int)out->devices != val) && (val != 0) && (!out->standby) && in out_set_parameters()
2737 (out->usecase == USECASE_AUDIO_PLAYBACK)) { in out_set_parameters()
2748 out->devices = val; in out_set_parameters()
2750 if (!out->standby) { in out_set_parameters()
2751 uc_info = get_usecase_from_id(adev, out->usecase); in out_set_parameters()
2754 __func__, out->usecase); in out_set_parameters()
2756 list_for_each(node, &out->pcm_dev_list) { in out_set_parameters()
2766 do_out_standby_l(out); in out_set_parameters()
2768 select_devices(adev, out->usecase); in out_set_parameters()
2772 (out == adev->primary_output)) { in out_set_parameters()
2775 (out == adev->primary_output)) { in out_set_parameters()
2781 (out == adev->primary_output)) { in out_set_parameters()
2785 pthread_mutex_unlock(&out->lock); in out_set_parameters()
2800 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { in out_set_parameters()
2801 parse_compress_metadata(out, parms); in out_set_parameters()
2811 struct stream_out *out = (struct stream_out *)stream; in out_get_parameters() local
2824 while (out->supported_channel_masks[i] != 0) { in out_get_parameters()
2826 if (out_channels_name_to_enum_table[j].value == out->supported_channel_masks[i]) { in out_get_parameters()
2850 struct stream_out *out = (struct stream_out *)stream; in out_get_latency() local
2852 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) in out_get_latency()
2855 return (out->config.period_count * out->config.period_size * 1000) / in out_get_latency()
2856 (out->config.rate); in out_get_latency()
2862 struct stream_out *out = (struct stream_out *)stream; in out_set_volume() local
2863 struct audio_device *adev = out->dev; in out_set_volume()
2866 if (out->usecase == USECASE_AUDIO_PLAYBACK_MULTI_CH) { in out_set_volume()
2868 out->muted = (left == 0.0f); in out_set_volume()
2870 } else if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { in out_set_volume()
2921 struct stream_out *out = (struct stream_out *)stream; in out_write() local
2922 struct audio_device *adev = out->dev; in out_write()
2936 pthread_mutex_lock(&out->lock); in out_write()
2937 if (out->standby) { in out_write()
2939 pthread_mutex_unlock(&out->lock); in out_write()
2942 pthread_mutex_lock(&out->lock); in out_write()
2943 if (!out->standby) { in out_write()
2949 ret = start_output_stream(out); in out_write()
2958 out->standby = false; in out_write()
2979 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { in out_write()
2982 if (out->offload_state == OFFLOAD_STATE_PAUSED_FLUSHED) { in out_write()
2985 enable_output_path_l(out); in out_write()
2989 if (out->send_new_metadata) { in out_write()
2991 compress_set_gapless_metadata(out->compr, &out->gapless_mdata); in out_write()
2992 out->send_new_metadata = 0; in out_write()
2995 ret = compress_write(out->compr, buffer, bytes); in out_write()
2998 send_offload_cmd_l(out, OFFLOAD_CMD_WAIT_FOR_BUFFER); in out_write()
3000 if (out->offload_state != OFFLOAD_STATE_PLAYING) { in out_write()
3001 compress_start(out->compr); in out_write()
3002 out->offload_state = OFFLOAD_STATE_PLAYING; in out_write()
3004 pthread_mutex_unlock(&out->lock); in out_write()
3015 != out->echo_reference_generation) { in out_write()
3017 if (out->echo_reference != NULL) { in out_write()
3018 ALOGV("%s: release_echo_reference %p", __func__, out->echo_reference); in out_write()
3019 release_echo_reference(out->echo_reference); in out_write()
3024 out->echo_reference_generation = adev->echo_reference_generation; in out_write()
3025 out->echo_reference = adev->echo_reference; in out_write()
3027 out->echo_reference_generation); in out_write()
3032 if (out->muted) in out_write()
3034 list_for_each(node, &out->pcm_dev_list) { in out_write()
3037 if (bytes * pcm_device->pcm_profile->config.rate / out->sample_rate + frame_size in out_write()
3040 … bytes * pcm_device->pcm_profile->config.rate / out->sample_rate + frame_size; in out_write()
3056 … if (out->echo_reference != NULL && pcm_device->pcm_profile->devices != SND_DEVICE_OUT_SPEAKER) { in out_write()
3061 get_playback_delay(out, out_frames, &b); in out_write()
3062 out->echo_reference->write(out->echo_reference, &b); in out_write()
3066 if (out->devices & AUDIO_DEVICE_OUT_SPEAKER) { in out_write()
3069 … calloc(pcm_frames_to_bytes(pcm_device->pcm, out->config.period_size), in out_write()
3095 for (i = out->config.period_count; i > 0; i--) in out_write()
3098 out->config.period_size)); in out_write()
3127 pthread_mutex_unlock(&out->lock); in out_write()
3146 out->written += bytes / (out->config.channels * sizeof(short)); in out_write()
3150 pthread_mutex_unlock(&out->lock); in out_write()
3153 list_for_each(node, &out->pcm_dev_list) { in out_write()
3158 out_standby(&out->stream.common); in out_write()
3160 out_get_sample_rate(&out->stream.common)); in out_write()
3183 struct stream_out *out = (struct stream_out *)stream; in out_get_render_position() local
3185 if ((out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) && (dsp_frames != NULL)) { in out_get_render_position()
3186 pthread_mutex_lock(&out->lock); in out_get_render_position()
3187 if (out->compr != NULL) { in out_get_render_position()
3188 compress_get_tstamp(out->compr, (unsigned long *)dsp_frames, in out_get_render_position()
3189 &out->sample_rate); in out_get_render_position()
3191 __func__, *dsp_frames, out->sample_rate); in out_get_render_position()
3193 pthread_mutex_unlock(&out->lock); in out_get_render_position()
3224 struct stream_out *out = (struct stream_out *)stream; in out_get_presentation_position() local
3228 pthread_mutex_lock(&out->lock); in out_get_presentation_position()
3230 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { in out_get_presentation_position()
3231 if (out->compr != NULL) { in out_get_presentation_position()
3232 compress_get_tstamp(out->compr, &dsp_frames, in out_get_presentation_position()
3233 &out->sample_rate); in out_get_presentation_position()
3235 __func__, dsp_frames, out->sample_rate); in out_get_presentation_position()
3243 if (!list_empty(&out->pcm_dev_list)) { in out_get_presentation_position()
3245 struct pcm_device *pcm_device = node_to_item(list_head(&out->pcm_dev_list), in out_get_presentation_position()
3249 size_t kernel_buffer_size = out->config.period_size * out->config.period_count; in out_get_presentation_position()
3250 int64_t signed_frames = out->written - kernel_buffer_size + avail; in out_get_presentation_position()
3254 (render_latency(out->usecase) * out->sample_rate / 1000000LL); in out_get_presentation_position()
3265 pthread_mutex_unlock(&out->lock); in out_get_presentation_position()
3273 struct stream_out *out = (struct stream_out *)stream; in out_set_callback() local
3276 pthread_mutex_lock(&out->lock); in out_set_callback()
3277 out->offload_callback = callback; in out_set_callback()
3278 out->offload_cookie = cookie; in out_set_callback()
3279 pthread_mutex_unlock(&out->lock); in out_set_callback()
3285 struct stream_out *out = (struct stream_out *)stream; in out_pause() local
3288 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { in out_pause()
3289 pthread_mutex_lock(&out->lock); in out_pause()
3290 if (out->compr != NULL && out->offload_state == OFFLOAD_STATE_PLAYING) { in out_pause()
3291 status = compress_pause(out->compr); in out_pause()
3292 out->offload_state = OFFLOAD_STATE_PAUSED; in out_pause()
3293 pthread_mutex_lock(&out->dev->lock); in out_pause()
3294 status = disable_output_path_l(out); in out_pause()
3295 pthread_mutex_unlock(&out->dev->lock); in out_pause()
3297 pthread_mutex_unlock(&out->lock); in out_pause()
3304 struct stream_out *out = (struct stream_out *)stream; in out_resume() local
3307 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { in out_resume()
3309 pthread_mutex_lock(&out->lock); in out_resume()
3310 if (out->compr != NULL && out->offload_state == OFFLOAD_STATE_PAUSED) { in out_resume()
3311 pthread_mutex_lock(&out->dev->lock); in out_resume()
3312 enable_output_path_l(out); in out_resume()
3313 pthread_mutex_unlock(&out->dev->lock); in out_resume()
3314 status = compress_resume(out->compr); in out_resume()
3315 out->offload_state = OFFLOAD_STATE_PLAYING; in out_resume()
3317 pthread_mutex_unlock(&out->lock); in out_resume()
3324 struct stream_out *out = (struct stream_out *)stream; in out_drain() local
3327 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { in out_drain()
3328 pthread_mutex_lock(&out->lock); in out_drain()
3330 status = send_offload_cmd_l(out, OFFLOAD_CMD_PARTIAL_DRAIN); in out_drain()
3332 status = send_offload_cmd_l(out, OFFLOAD_CMD_DRAIN); in out_drain()
3333 pthread_mutex_unlock(&out->lock); in out_drain()
3340 struct stream_out *out = (struct stream_out *)stream; in out_flush() local
3342 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { in out_flush()
3343 pthread_mutex_lock(&out->lock); in out_flush()
3344 if (out->offload_state == OFFLOAD_STATE_PLAYING) { in out_flush()
3345 ALOGE("out_flush() called in wrong state %d", out->offload_state); in out_flush()
3346 pthread_mutex_unlock(&out->lock); in out_flush()
3349 if (out->offload_state == OFFLOAD_STATE_PAUSED) { in out_flush()
3350 stop_compressed_output_l(out); in out_flush()
3351 out->offload_state = OFFLOAD_STATE_PAUSED_FLUSHED; in out_flush()
3353 pthread_mutex_unlock(&out->lock); in out_flush()
3797 struct stream_out *out; in adev_open_output_stream() local
3804 out = (struct stream_out *)calloc(1, sizeof(struct stream_out)); in adev_open_output_stream()
3809 out->flags = flags; in adev_open_output_stream()
3810 out->devices = devices; in adev_open_output_stream()
3811 out->dev = adev; in adev_open_output_stream()
3812 out->format = config->format; in adev_open_output_stream()
3813 out->sample_rate = config->sample_rate; in adev_open_output_stream()
3814 out->channel_mask = AUDIO_CHANNEL_OUT_STEREO; in adev_open_output_stream()
3815 out->supported_channel_masks[0] = AUDIO_CHANNEL_OUT_STEREO; in adev_open_output_stream()
3816 out->handle = handle; in adev_open_output_stream()
3823 out->config = pcm_profile->config; in adev_open_output_stream()
3826 if (out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { in adev_open_output_stream()
3839 out->compr_config.codec = (struct snd_codec *) in adev_open_output_stream()
3842 out->usecase = USECASE_AUDIO_PLAYBACK_OFFLOAD; in adev_open_output_stream()
3844 out->channel_mask = config->offload_info.channel_mask; in adev_open_output_stream()
3846 out->channel_mask = config->channel_mask; in adev_open_output_stream()
3847 out->format = config->offload_info.format; in adev_open_output_stream()
3848 out->sample_rate = config->offload_info.sample_rate; in adev_open_output_stream()
3850 out->stream.set_callback = out_set_callback; in adev_open_output_stream()
3851 out->stream.pause = out_pause; in adev_open_output_stream()
3852 out->stream.resume = out_resume; in adev_open_output_stream()
3853 out->stream.drain = out_drain; in adev_open_output_stream()
3854 out->stream.flush = out_flush; in adev_open_output_stream()
3856 out->compr_config.codec->id = in adev_open_output_stream()
3858 out->compr_config.fragment_size = COMPRESS_OFFLOAD_FRAGMENT_SIZE; in adev_open_output_stream()
3859 out->compr_config.fragments = COMPRESS_OFFLOAD_NUM_FRAGMENTS; in adev_open_output_stream()
3860 out->compr_config.codec->sample_rate = config->offload_info.sample_rate; in adev_open_output_stream()
3861 out->compr_config.codec->bit_rate = in adev_open_output_stream()
3863 out->compr_config.codec->ch_in = in adev_open_output_stream()
3865 out->compr_config.codec->ch_out = out->compr_config.codec->ch_in; in adev_open_output_stream()
3868 out->non_blocking = 1; in adev_open_output_stream()
3870 out->send_new_metadata = 1; in adev_open_output_stream()
3871 create_offload_callback_thread(out); in adev_open_output_stream()
3872 out->offload_state = OFFLOAD_STATE_IDLE; in adev_open_output_stream()
3877 } else if (out->flags & (AUDIO_OUTPUT_FLAG_DEEP_BUFFER)) { in adev_open_output_stream()
3878 out->usecase = USECASE_AUDIO_PLAYBACK_DEEP_BUFFER; in adev_open_output_stream()
3879 out->config = pcm_config_deep_buffer; in adev_open_output_stream()
3880 out->sample_rate = out->config.rate; in adev_open_output_stream()
3883 out->usecase = USECASE_AUDIO_PLAYBACK; in adev_open_output_stream()
3884 out->sample_rate = out->config.rate; in adev_open_output_stream()
3889 adev->primary_output = out; in adev_open_output_stream()
3899 if (get_usecase_from_id(adev, out->usecase) != NULL) { in adev_open_output_stream()
3900 ALOGE("%s: Usecase (%d) is already present", __func__, out->usecase); in adev_open_output_stream()
3907 out->stream.common.get_sample_rate = out_get_sample_rate; in adev_open_output_stream()
3908 out->stream.common.set_sample_rate = out_set_sample_rate; in adev_open_output_stream()
3909 out->stream.common.get_buffer_size = out_get_buffer_size; in adev_open_output_stream()
3910 out->stream.common.get_channels = out_get_channels; in adev_open_output_stream()
3911 out->stream.common.get_format = out_get_format; in adev_open_output_stream()
3912 out->stream.common.set_format = out_set_format; in adev_open_output_stream()
3913 out->stream.common.standby = out_standby; in adev_open_output_stream()
3914 out->stream.common.dump = out_dump; in adev_open_output_stream()
3915 out->stream.common.set_parameters = out_set_parameters; in adev_open_output_stream()
3916 out->stream.common.get_parameters = out_get_parameters; in adev_open_output_stream()
3917 out->stream.common.add_audio_effect = out_add_audio_effect; in adev_open_output_stream()
3918 out->stream.common.remove_audio_effect = out_remove_audio_effect; in adev_open_output_stream()
3919 out->stream.get_latency = out_get_latency; in adev_open_output_stream()
3920 out->stream.set_volume = out_set_volume; in adev_open_output_stream()
3921 out->stream.write = out_write; in adev_open_output_stream()
3922 out->stream.get_render_position = out_get_render_position; in adev_open_output_stream()
3923 out->stream.get_next_write_timestamp = out_get_next_write_timestamp; in adev_open_output_stream()
3924 out->stream.get_presentation_position = out_get_presentation_position; in adev_open_output_stream()
3926 out->standby = 1; in adev_open_output_stream()
3930 pthread_mutex_init(&out->lock, (const pthread_mutexattr_t *) NULL); in adev_open_output_stream()
3931 pthread_cond_init(&out->cond, (const pthread_condattr_t *) NULL); in adev_open_output_stream()
3933 config->format = out->stream.common.get_format(&out->stream.common); in adev_open_output_stream()
3934 config->channel_mask = out->stream.common.get_channels(&out->stream.common); in adev_open_output_stream()
3935 config->sample_rate = out->stream.common.get_sample_rate(&out->stream.common); in adev_open_output_stream()
3937 *stream_out = &out->stream; in adev_open_output_stream()
3942 free(out); in adev_open_output_stream()
3951 struct stream_out *out = (struct stream_out *)stream; in adev_close_output_stream() local
3952 struct audio_device *adev = out->dev; in adev_close_output_stream()
3957 if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { in adev_close_output_stream()
3958 destroy_offload_callback_thread(out); in adev_close_output_stream()
3960 if (out->compr_config.codec != NULL) in adev_close_output_stream()
3961 free(out->compr_config.codec); in adev_close_output_stream()
3963 pthread_cond_destroy(&out->cond); in adev_close_output_stream()
3964 pthread_mutex_destroy(&out->lock); in adev_close_output_stream()