Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class AttachSource : public IPlayerTask

private:
void addSource() const;
void reattachAudioSource() const;

GenericPlayerContext &m_context;
std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> m_gstWrapper;
Expand Down
14 changes: 14 additions & 0 deletions media/server/gstplayer/source/tasks/generic/AttachSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ void AttachSource::execute() const
{
addSource();
}
else if (m_attachedSource->getType() == MediaSourceType::AUDIO)
{
reattachAudioSource();
}
else
{
RIALTO_SERVER_LOG_ERROR("cannot update caps");
Expand Down Expand Up @@ -106,4 +110,14 @@ void AttachSource::addSource() const
if (caps)
m_gstWrapper->gstCapsUnref(caps);
}

void AttachSource::reattachAudioSource() const
{
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.
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.
}
} // namespace firebolt::rialto::server::tasks::generic
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,17 @@ TEST_F(AttachSourceTest, shouldFailToAttachUnknownSource)
triggerAttachUnknownSource();
}

TEST_F(AttachSourceTest, shouldSkipSwitchAudioSourceWhenSourceIsNotRemoved)
TEST_F(AttachSourceTest, shouldSwitchAudioSourceWhenSourceIsReattached)
{
setContextStreamInfo(firebolt::rialto::MediaSourceType::AUDIO);
shouldReattachAudioSource();
triggerReattachAudioSource();
}

TEST_F(AttachSourceTest, shouldFailToSwitchAudioSourceWhenSourceIsReattached)
{
setContextStreamInfo(firebolt::rialto::MediaSourceType::AUDIO);
shouldFailToReattachAudioSource();
triggerReattachAudioSource();
}

Expand Down
Loading