Skip to content

Conversation

@anshephe
Copy link
Contributor

Branch off of feature/RDK-59937_federated_2511 for testing, with addition of VPLAY-11846, VPLAY-11719, VPLAY-11707

DomSyna and others added 30 commits November 19, 2025 11:25
	* PrivateInstanceAAMP::SavePreferredTextLanguages() accepts
	  "sub-type" preference, which StreamAbstractionAAMP_HLS::
	  SelectPreferredTextTrack() uses as part of its track
	  selection scoring.
Reason for change:
Subtiles not initially muted when SetCCStatus called prior to load

Risks: Low

Test Procedure:
Test subtitles/closed captions are muted correctly, e.g. on tune

Priority: P1

Signed-off-by: anshephe <[email protected]>
Co-authored-by: Copilot <[email protected]>
Fixed location of call to SetSubtitleMuteInternal() in SetCCStatusInternal()
Updated utests
Copilot AI review requested due to automatic review settings November 27, 2025 11:54
Copilot finished reviewing on behalf of anshephe November 27, 2025 11:57
Copy link
Contributor

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 implements fixes for closed captioning (CC) functionality in a federated environment, addressing issues VPLAY-11846, VPLAY-11719, and VPLAY-11707. The changes focus on improving CC state management, text track selection logic, and thread safety.

Key changes:

  • Thread safety improvements by converting video_muted and subtitles_muted to atomic variables
  • Refactored CC status handling to properly differentiate between pre-tune and post-tune states
  • Enhanced text track selection algorithm with improved scoring and language preference handling
  • Better handling of edge cases like empty language strings and missing audio track languages

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
priv_aamp.h Added FindTextTrackIndex method declaration and converted video_muted/subtitles_muted to atomic types for thread safety
priv_aamp.cpp Updated atomic variable usage with .load() calls, refactored SetCCStatusInternal logic, added FindTextTrackIndex helper, and improved language list sanitization
test/utests/tests/PrivAampTests/PrivAampTests.cpp Renamed and restructured CC status tests to cover pre-tune, post-tune, and video mute interaction scenarios
fragmentcollector_hls.h Added NotifyTextTrackChanges method declaration
fragmentcollector_hls.cpp Improved audio track language fallback handling, refactored text track selection with enhanced scoring algorithm, and separated text track change notifications into dedicated method

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

Comment on lines +3453 to +3472
// Select preferred text track based on user language preferences
TextTrackInfo selectedTextTrack;
if (SelectPreferredTextTrack(selectedTextTrack))
{
AAMPLOG_INFO("Selected text track - lang:%s, name:%s, rendition:%s",
selectedTextTrack.language.c_str(),
selectedTextTrack.name.c_str(),
selectedTextTrack.rendition.c_str());
aamp->SetPreferredTextTrack(std::move(selectedTextTrack));
}
else
{
AAMPLOG_WARN("No text track matched user preferences, will use default selection");
}

// Configure Subtitle track for the playback
ConfigureTextTrack();

// Check for text track changes and notify
NotifyTextTrackChanges();
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

[nitpick] The function SelectPreferredTextTrack is called before ConfigureTextTrack, and the selected track is stored via aamp->SetPreferredTextTrack(). However, ConfigureTextTrack() (line 3469) retrieves this track and converts it to currentTextTrackProfileIndex. Then NotifyTextTrackChanges() (line 3472) checks if the track changed and sends a notification.

The issue is that for a new tune (first time), aamp->mCurrentTextTrackIndex will be -1 (initial/uninitialized), and currentTextTrackProfileIndex will be set to the newly selected track index. According to the logic in NotifyTextTrackChanges() (line 7341), the condition aamp->mCurrentTextTrackIndex != -1 will be false, so no notification will be sent on the first tune. This means the first text track selection won't trigger a notification event, which may or may not be intended behavior. Consider if an initial text track selection should also trigger a notification to inform the application.

Copilot uses AI. Check for mistakes.
Comment on lines +12326 to +12327
* @param[in] tracks Vector of text tracks to search
* @param[in] target Track to find
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

[nitpick] The documentation for this function uses inconsistent parameter formatting. The @param[in] tags use different styles for the parameter descriptions:

  • Line 12326: "Vector of text tracks to search" (no hyphen)
  • Line 12327: "Track to find" (no hyphen)

while the declaration comment on line 12328 uses "Index of track (0-based), or -1 if not found".

For consistency with the rest of the codebase, consider using a consistent format. The function documentation in priv_aamp.h (lines 603-610) uses hyphens after parameter names, e.g., @param[in] tracks - Vector of text tracks...

Suggested change
* @param[in] tracks Vector of text tracks to search
* @param[in] target Track to find
* @param[in] tracks - Vector of text tracks to search
* @param[in] target - Track to find

Copilot uses AI. Check for mistakes.
{
// Skip normalization for empty strings
if (lang.empty())
{
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

[nitpick] The empty string check prevents calling Getiso639map_NormalizeLanguageCode with an empty string, which is good defensive programming. However, empty strings in the language list may indicate a data quality issue upstream. Consider logging a warning when an empty language string is encountered to help identify where invalid data is being introduced into the language list. This would make debugging configuration issues easier.

Suggested change
{
{
AAMPLOG_WARN("SanitizeLanguageList: Encountered empty language string in language list. This may indicate a data quality issue upstream.");

Copilot uses AI. Check for mistakes.
sink->SetVideoZoom(zoom_mode);
AAMPLOG_INFO("SetVideoMute video_muted %d mApplyCachedVideoMute %d", video_muted, mApplyCachedVideoMute);
sink->SetVideoMute(video_muted);
AAMPLOG_INFO("SetVideoMute video_muted %d mApplyCachedVideoMute %d", video_muted.load(), mApplyCachedVideoMute);
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The logging statement includes mApplyCachedVideoMute in the message but this variable is only checked in the conditional below. If mApplyCachedVideoMute is false, the log message incorrectly suggests it's being considered when it's not actually being applied. Consider moving the log statement inside the if (mApplyCachedVideoMute) block or adjusting the message to clarify when the cached value is actually being applied.

Copilot uses AI. Check for mistakes.
{ // has sidecar data
mpStreamAbstractionAAMP->MuteSidecarSubtitles(mute_subtitles_applied);
}
SetSubtitleMuteInternal(mute_subtitles_applied);
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The logic for calling SetSubtitleMuteInternal has been moved inside the OOB (out-of-band) subtitles branch. Previously, SetSubtitleMuteInternal was always called regardless of the subtitle type. Now it's only called for OOB subtitles when !isGstSubtecEnabled is false. This means that for inband CC (mIsInbandCC == true or !isGstSubtecEnabled == true), SetSubtitleMuteInternal is no longer being called. Verify this is intentional, as it could potentially break subtitle muting for inband CC scenarios.

Copilot uses AI. Check for mistakes.
Comment on lines +7657 to +7661
if (bestScore == 0)
{
AAMPLOG_WARN("No suitable text track found");
}

Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The variable bestScore is initialized to 0, and the function returns (bestScore > 0). However, every track gets a base score of 1 (line 7607). This means that if there are any available tracks at all, bestScore will always be at least 1, making the check on line 7657 (if (bestScore == 0)) unreachable. The warning "No suitable text track found" will never be logged. Consider either removing this dead code or adjusting the logic if a score of 1 (base score only, with no preference matches) should be considered "no suitable track".

Suggested change
if (bestScore == 0)
{
AAMPLOG_WARN("No suitable text track found");
}

Copilot uses AI. Check for mistakes.
kd-syna and others added 2 commits November 27, 2025 12:46
…type-pref' into feature/VPLAY-11316_cc_fixes_for_federated
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.

5 participants