Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 367
Support for dynamic codec adapter id - Part 2#5592
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
5704d950831d9ca24bcf80914fbe97792e2File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -249,7 +249,7 @@ int codec_adapter_prepare(struct comp_dev *dev) | ||
| goto free; | ||
| } | ||
| list_item_append(&buffer->sink_list, &mod->sink_buffer_list); | ||
| buffer_set_params(buffer, &mod->stream_params, BUFFER_UPDATE_FORCE); | ||
| buffer_set_params(buffer, mod->stream_params, BUFFER_UPDATE_FORCE); | ||
| buffer_reset_pos(buffer, NULL); | ||
| } | ||
| } else { | ||
| @@ -263,7 +263,7 @@ int codec_adapter_prepare(struct comp_dev *dev) | ||
| buff_size); | ||
| goto free; | ||
| } | ||
| buffer_set_params(buffer, &mod->stream_params, BUFFER_UPDATE_FORCE); | ||
| buffer_set_params(buffer, mod->stream_params, BUFFER_UPDATE_FORCE); | ||
| buffer_reset_pos(buffer, NULL); | ||
| } | ||
| } | ||
| @@ -306,9 +306,28 @@ int codec_adapter_params(struct comp_dev *dev, | ||
| return ret; | ||
| } | ||
| ret = memcpy_s(&mod->stream_params, sizeof(struct sof_ipc_stream_params), | ||
| /* allocate stream_params each time */ | ||
| if (mod->stream_params) | ||
| rfree(mod->stream_params); | ||
| mod->stream_params = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, | ||
| sizeof(*mod->stream_params) + params->ext_data_length); | ||
| if (!mod->stream_params) | ||
| return -ENOMEM; | ||
| ret = memcpy_s(mod->stream_params, sizeof(struct sof_ipc_stream_params), | ||
| params, sizeof(struct sof_ipc_stream_params)); | ||
| assert(!ret); | ||
| if (ret < 0) | ||
| return ret; | ||
Collaborator 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. this doesn't change anything, right? The only way for CollaboratorAuthor 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. @ranj063 suggested to remote the assert. | ||
| if (params->ext_data_length) { | ||
| ret = memcpy_s((uint8_t *)mod->stream_params->data, | ||
| params->ext_data_length, | ||
| (uint8_t *)params->data, | ||
| params->ext_data_length); | ||
| if (ret < 0) | ||
| return ret; | ||
| } | ||
| mod->period_bytes = params->sample_container_bytes * | ||
| params->channels * params->rate / 1000; | ||
| @@ -428,7 +447,7 @@ static void module_copy_samples(struct comp_dev *dev, struct comp_buffer *src_bu | ||
| if (!copy_bytes) | ||
| return; | ||
| audio_stream_copy(&src_buffer->stream, 0, &sink_buffer->stream, 0, | ||
| copy_bytes / mod->stream_params.sample_container_bytes); | ||
| copy_bytes / mod->stream_params->sample_container_bytes); | ||
| buffer_stream_writeback(sink_buffer, copy_bytes); | ||
| comp_update_buffer_produce(sink_buffer, copy_bytes); | ||
| @@ -677,6 +696,9 @@ int codec_adapter_reset(struct comp_dev *dev) | ||
| buffer_zero(buffer); | ||
| } | ||
| rfree(mod->stream_params); | ||
| mod->stream_params = NULL; | ||
| comp_dbg(dev, "codec_adapter_reset(): done"); | ||
| return comp_set_state(dev, COMP_TRIGGER_RESET); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -95,9 +95,12 @@ struct sof_ipc_stream_params { | ||
| uint32_t host_period_bytes; | ||
| uint16_t no_stream_position; /**< 1 means don't send stream position */ | ||
| uint8_t cont_update_posn; /**< 1 means continuous update stream position */ | ||
| uint8_t reserved0; | ||
| uint16_t ext_data_length; /**< 0 means no extended data */ | ||
dbaluta marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. Collaborator 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. this structure is packed, please, move this up before CollaboratorAuthor 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. @lyakh you have a good point. but i don't like changing the order of fields as it is already part of the ABI. I have added 1 uint8_t reseved field. See the new updated code. Collaborator 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. @dbaluta ah, right sure, but then let's put this 16-bit field after the reserved bytes to avoid splitting them. Even though you're unlikely to use 3 bytes together, still it might happen that exactly 3 bytes would be needed for an array or a structure | ||
| uint8_t reserved[5]; | ||
| uint8_t reserved[2]; | ||
| uint16_t chmap[SOF_IPC_MAX_CHANNELS]; /**< channel map - SOF_CHMAP_ */ | ||
| int8_t data[]; /**< extended data */ | ||
| } __attribute__((packed, aligned(4))); | ||
| /* PCM params info - SOF_IPC_STREAM_PCM_PARAMS */ | ||
Uh oh!
There was an error while loading. Please reload this page.