-
Notifications
You must be signed in to change notification settings - Fork 6
Feature/vplay 11316 cc fixes for federated #713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/RDK-59937_federated_2511
Are you sure you want to change the base?
Feature/vplay 11316 cc fixes for federated #713
Conversation
* 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]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Fixed location of call to SetSubtitleMuteInternal() in SetCCStatusInternal() Updated utests
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…e/VPLAY-11316_cc_fixes_for_federated
…nto feature/VPLAY-11316_cc_fixes_for_federated
There was a problem hiding this 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_mutedandsubtitles_mutedto 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.
| // 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(); |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
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.
| * @param[in] tracks Vector of text tracks to search | ||
| * @param[in] target Track to find |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
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...
| * @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 |
| { | ||
| // Skip normalization for empty strings | ||
| if (lang.empty()) | ||
| { |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
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.
| { | |
| { | |
| AAMPLOG_WARN("SanitizeLanguageList: Encountered empty language string in language list. This may indicate a data quality issue upstream."); |
| 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); |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
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.
| { // has sidecar data | ||
| mpStreamAbstractionAAMP->MuteSidecarSubtitles(mute_subtitles_applied); | ||
| } | ||
| SetSubtitleMuteInternal(mute_subtitles_applied); |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
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.
| if (bestScore == 0) | ||
| { | ||
| AAMPLOG_WARN("No suitable text track found"); | ||
| } | ||
|
|
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
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".
| if (bestScore == 0) | |
| { | |
| AAMPLOG_WARN("No suitable text track found"); | |
| } |
…type-pref' into feature/VPLAY-11316_cc_fixes_for_federated
Pull from Feature/rdk 59937 federated 2511
Branch off of feature/RDK-59937_federated_2511 for testing, with addition of VPLAY-11846, VPLAY-11719, VPLAY-11707