Skip to content

Comments

Allow to switch audio codec, when audio is re-attached#448

Merged
skywojciechowskim merged 1 commit intomasterfrom
SwitchAudioSourceFix
Feb 18, 2026
Merged

Allow to switch audio codec, when audio is re-attached#448
skywojciechowskim merged 1 commit intomasterfrom
SwitchAudioSourceFix

Conversation

@skywojciechowskim
Copy link
Contributor

Summary: Allow to switch audio codec, when audio is re-attached
Type: Fix
Test Plan: UT/CT, Fullstack
Jira: LLAMA-18057

Copilot AI review requested due to automatic review settings February 18, 2026 12:52
@github-actions
Copy link

Pull request must be merged with a description containing the required fields,

Summary:
Type: Feature/Fix/Cleanup
Test Plan:
Jira:

If there is no jira releated to this change, please put 'Jira: NO-JIRA'.

Description can be changed by editing the top comment on your pull request and making a new commit.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables audio codec switching when an audio source is re-attached by adding a new code path in the AttachSource task. Previously, attempting to attach an already-attached audio source would fail with a "cannot update caps" error. Now, when an audio source is re-attached, the code will call the existing reattachSource method to perform the codec switch.

Changes:

  • Added logic to handle audio source reattachment in AttachSource::execute()
  • Renamed and expanded test coverage for the audio source reattachment scenario

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
media/server/gstplayer/source/tasks/generic/AttachSource.cpp Added reattachAudioSource() method and logic to handle audio source reattachment when source already exists in streamInfo
media/server/gstplayer/include/tasks/generic/AttachSource.h Added declaration for the new reattachAudioSource() private method
tests/unittests/media/server/gstplayer/genericPlayer/tasksTests/AttachSourceTest.cpp Renamed test from shouldSkipSwitchAudioSourceWhenSourceIsNotRemoved to shouldSwitchAudioSourceWhenSourceIsReattached and added a failure test case

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

RIALTO_SERVER_LOG_ERROR("Reattaching source failed!");
return;
}
RIALTO_SERVER_LOG_MIL("Audio source reattached");
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The success log message is inconsistent with the codebase convention. Throughout the codebase, log messages use common::convertMediaSourceType to make messages generic for different source types. For example, SwitchSource uses "%s source switched" with convertMediaSourceType. Consider using a similar pattern like "RIALTO_SERVER_LOG_MIL("%s source reattached", common::convertMediaSourceType(m_attachedSource->getType()))" to match the established convention and allow the code to work generically for any source type that might be supported in the future.

Suggested change
RIALTO_SERVER_LOG_MIL("Audio source reattached");
RIALTO_SERVER_LOG_MIL("%s source reattached",
common::convertMediaSourceType(m_attachedSource->getType()));

Copilot uses AI. Check for mistakes.
{
if (!m_player.reattachSource(m_attachedSource))
{
RIALTO_SERVER_LOG_ERROR("Reattaching source failed!");
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The error logging level is inconsistent with SwitchSource task. The SwitchSource task uses RIALTO_SERVER_LOG_WARN for the same reattachSource failure scenario (see SwitchSource.cpp line 43). Consider using RIALTO_SERVER_LOG_WARN instead of RIALTO_SERVER_LOG_ERROR for consistency.

Suggested change
RIALTO_SERVER_LOG_ERROR("Reattaching source failed!");
RIALTO_SERVER_LOG_WARN("Reattaching source failed!");

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

Coverage statistics of your commit:
Lines coverage stays unchanged and is: 85.2%
Functions coverage stays unchanged and is: 92.5%

@skywojciechowskim skywojciechowskim merged commit ef0589a into master Feb 18, 2026
80 of 82 checks passed
@skywojciechowskim skywojciechowskim deleted the SwitchAudioSourceFix branch February 18, 2026 13:38
@github-actions github-actions bot locked and limited conversation to collaborators Feb 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants