Skip to content

feat: Export GetCodecMap for performance optimization#246

Closed
asnyatkov wants to merge 1 commit into
pion:masterfrom
asnyatkov:feat/export-codec-map
Closed

feat: Export GetCodecMap for performance optimization#246
asnyatkov wants to merge 1 commit into
pion:masterfrom
asnyatkov:feat/export-codec-map

Conversation

@asnyatkov
Copy link
Copy Markdown

Exports GetCodecMap to allow building the codec map once and reusing it for multiple lookups.

Before:

for _, pt := range payloadTypes {
    codec, err := sd.GetCodecForPayloadType(pt)  // rebuilds map each time
}

After:

codecMap := sd.GetCodecMap()
for _, pt := range payloadTypes {
    codec := codecMap[pt]
}

Includes benchmark demonstrating the performance improvement.

Allows callers to build codec map once and reuse it instead of
rebuilding on every GetCodecForPayloadType call.
@asnyatkov asnyatkov closed this Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant