Skip to content

codec_adapter: prepare for dynamic codec id - #4572

Closed
Potochi wants to merge 1 commit into
thesofproject:mainfrom
Potochi:codec_id
Closed

Potochi wants to merge 1 commit into
thesofproject:mainfrom
Potochi:codec_id

Conversation

@Potochi

@Potochi Potochi commented Jul 29, 2021

Copy link
Copy Markdown
Contributor

For now the codec id is determined from the topology file, this
doesn't scale well when we have to support a lot of codecs.

The earlyest time when we can get the codec id is in
"cadence_codec_prepare". So we move some of the codec initialisation
from "cadence_codec_init" into "cadence_codec_prepare".

The current topologies which specify the codec id directly will still
work, new topologies that want to use this functionality must specify
"0" as the codec id.

The codec id should be sent by the linux kernel. Until this will happen
we assume the default codec id to be for MP3.

Signed-off-by: Bud Liviu-Alexandru budliviu@gmail.com

@sofci

sofci commented Jul 29, 2021

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

reply test this please to run this test once

@dbaluta

dbaluta commented Jul 29, 2021

Copy link
Copy Markdown
Collaborator

test this please

Comment thread src/audio/codec_adapter/codec/cadence.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this some sort of default?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the commit message, we use this as default for now because codec id should be sent from the kernel side. Why don't have a clean way to do that now.

Comment thread src/audio/codec_adapter/codec/cadence.c Outdated
Comment thread src/audio/codec_adapter/codec/cadence.c Outdated

@mrajwa mrajwa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"we assume the default codec id to be for MP3." This does not sound good - the default shall be just pass through.

@dbaluta

dbaluta commented Jul 30, 2021

Copy link
Copy Markdown
Collaborator

@mrajwa that sounds good. As far as I remember we do not support passthrough with Cadence libraries. Should we create a dummy library which exposes a function that just copies input to output?

@mrajwa

mrajwa commented Jul 30, 2021

Copy link
Copy Markdown
Contributor

@dbaluta by passthrough I mean no lib was selected at all here so we just copy in -> out. I don't get why Mp3 codec (or any other) should be assumed as the default one if none was specified.

@dbaluta

dbaluta commented Jul 30, 2021 •

Copy link
Copy Markdown
Collaborator

@mrajwa i understood you from your first comment. But we still need to plugin this passthrough functionality in the codec_adapter framework.

We need to understand at what level we implement the passthrough:

  • at codec adapter level
  • OR at little bit down at specific Cadence level.

Notice that we have UUID that identifies the library type (e.g Dolby, Cadence) and then we also have codec id inside Cadence which identifies which particular API / library for Cadence is used.

Indeed you are right, we didn't took into cosnsideration the passthrough case so for this reason we considered MP3 as default case.

For now the codec id is determined from the topology file, this
doesn't scale well when we have to support a lot of codecs.

The earlyest time when we can get the codec id is in
"cadence_codec_prepare". So we move some of the codec initialisation
from "cadence_codec_init" into "cadence_codec_prepare".

The current topologies which specify the codec id directly will still
work, new topologies that want to use this functionality must specify
"0" as the codec id.

The codec id should be sent by the linux kernel. Until this will happen
we assume the default codec id to be for MP3.

Signed-off-by: Bud Liviu-Alexandru <budliviu@gmail.com>
@dbaluta

dbaluta commented Aug 2, 2021

Copy link
Copy Markdown
Collaborator

@mrajwa we had a deeper look at this and your comment suggests that we should implement the passthrough functionality using the Cadence API, this is not really what we intended with this commit. Maybe we can leave this for later.

Why, I'm advocating for using an already implemented codec ID for now is that actually that values shouldn't matter once we send the parameters from kernel side.

We don't have yet a field for codec_id inside parameters structure passed from the kernel.

We can eventually go with a default like:

 	uint32_t req_api_id = CADENCE_CODEC_WRAPPER_ID;

what do you say?

@lgirdwood

Copy link
Copy Markdown
Member

@mrajwa ping - need your inputs.

@lgirdwood lgirdwood added this to the v1.9 milestone Aug 6, 2021
@mrajwa

mrajwa commented Aug 10, 2021

Copy link
Copy Markdown
Contributor

@dbaluta if the codec selection is not complete in any way we should set the adapter to pass thru mode where we only copy input to output. I would not make any assumption about unspecified codec id.

Sorry for late responses I am on vacations currently.

@dbaluta

dbaluta commented Aug 10, 2021

Copy link
Copy Markdown
Collaborator

@mrajwa lets move this to v1.10 milestone, as there are a lot of things needed to be discussed. Including Kernel side changes.

@dbaluta dbaluta modified the milestones: v1.9, v1.10 Aug 10, 2021
@lgirdwood

Copy link
Copy Markdown
Member

@dbaluta ping ?

@dbaluta

dbaluta commented Nov 15, 2021

Copy link
Copy Markdown
Collaborator

@lgirdwood thanks for reminder. we were busy with some bugfixing. will send this week a follow up to this patch.

@dbaluta dbaluta closed this Jan 21, 2022
@dbaluta

dbaluta commented Jan 21, 2022

Copy link
Copy Markdown
Collaborator

Replaced with #5245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants