-
Notifications
You must be signed in to change notification settings - Fork 619
[Do not merge] framework/src/media, os/audio : Add changeDSPFlow api for change dsp flow rule on real-time. #7064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,3 +97,20 @@ bool getStreamMuteState(stream_policy_t stream_policy, bool *mute) | |
| return true; | ||
| } | ||
|
|
||
| bool changeDSPFlow(uint8_t dsp_flow_num) | ||
| { | ||
| if (dsp_flow_num == 0) { | ||
| meddbg("dsp_flow_num can not be 0, it starts from 1\n"); | ||
| return false; | ||
| } | ||
|
|
||
| meddbg("SoundManager : changeDSPFlow. dsp_flow_num: %d\n", dsp_flow_num); | ||
| audio_manager_result_t res = change_input_dsp_flow(dsp_flow_num); | ||
| if (res != AUDIO_MANAGER_SUCCESS) { | ||
| meddbg("change_output_dsp_flow failed dsp_flow_num : %d, ret : %d\n", dsp_flow_num, res); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not matching with calling function and msg. |
||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2818,6 +2818,27 @@ audio_manager_result_t get_audio_stream_mute_state(stream_policy_t stream_policy | |
| return AUDIO_MANAGER_SUCCESS; | ||
| } | ||
|
|
||
| audio_manager_result_t change_input_dsp_flow(uint8_t dsp_flow_num) | ||
| { | ||
| audio_manager_result_t ret; | ||
| struct audio_caps_desc_s caps_desc; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. caps_desc not used anywhere |
||
| audio_card_info_t *card; | ||
| char card_path[AUDIO_DEVICE_FULL_PATH_LENGTH]; | ||
|
|
||
| card = &g_audio_in_cards[g_actual_audio_in_card_id]; | ||
| get_card_path(card_path, card->card_id, card->device_id, INPUT); | ||
|
|
||
| pthread_mutex_lock(&(card->card_mutex)); | ||
|
|
||
| ret = control_audio_stream_device(card_path, AUDIOIOC_CHANGEDSPFLOW, (unsigned long)dsp_flow_num); | ||
| if (ret != AUDIO_MANAGER_SUCCESS) { | ||
| meddbg("Fail to change dsp flow, ret = %d errno : %d\n", ret, get_errno()); | ||
| } | ||
|
|
||
| pthread_mutex_unlock(&(card->card_mutex)); | ||
| return ret; | ||
| } | ||
|
|
||
| #ifdef CONFIG_DEBUG_MEDIA_INFO | ||
| void print_audio_card_info(audio_io_direction_t direct) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -898,6 +898,21 @@ audio_manager_result_t set_audio_stream_mute_from_json(stream_policy_t stream_po | |
| ****************************************************************************/ | ||
| audio_manager_result_t get_audio_stream_mute_state(stream_policy_t stream_policy, bool *mute); | ||
|
|
||
| /**************************************************************************** | ||
| * Name: change_input_dsp_flow | ||
| * | ||
| * Description: | ||
| * It changes the current dsp flow to dsp flow of given number. | ||
| * | ||
| * Input parameter: | ||
| * stream_policy: dwp flow rule number to be changed. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor comment |
||
| * mute: pointer to store the mute state of given stream policy. | ||
| * | ||
| * Return Value: | ||
| * On success, AUDIO_MANAGER_SUCCESS. Otherwise, a negative value. | ||
| ****************************************************************************/ | ||
| audio_manager_result_t change_input_dsp_flow(uint8_t dsp_flow_num); | ||
|
|
||
| #ifdef CONFIG_DEBUG_MEDIA_INFO | ||
| /**************************************************************************** | ||
| * Name: dump_audio_card_info | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (argc == 3 && atoi(argv[1]) == 0)