Skip to content

Commit 9ef3cb0

Browse files
authored
VPLAY-11213 [VIPA] No need to reset TSB when Closed Caption Lang changed (#581)
VPLAY-11213 [VIPA] No need to reset TSB when Closed Caption Lang changed Reason for Change: With in-band subtitles then all subtitle tracks are in the video segments and stored in the local TSB. Changing closed caption language does not need the TSB to be reset. I.E a tune does not need to happen Test Guidance: Refer Ticket Risk: Low Signed-off-by: Philip Stroffolino <[email protected]>
1 parent 2be7ac9 commit 9ef3cb0

File tree

3 files changed

+17
-50
lines changed

3 files changed

+17
-50
lines changed

priv_aamp.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12503,7 +12503,7 @@ void PrivateInstanceAAMP::SetPreferredTextLanguages(const char *param)
1250312503
{
1250412504
/**< Avoid retuning in case of HEMIIN and COMPOSITE IN*/
1250512505
}
12506-
else if (isSelectionChange) /**< call the tune only if there is a change in the language, rendition or accessibility.*/
12506+
else if (isSelectionChange && closedCaptionTrackId == -1) /* dont tune if we are using closedCaptions*/
1250712507
{
1250812508
discardEnteringLiveEvt = true;
1250912509
mOffsetFromTunetimeForSAPWorkaround = (double)(aamp_GetCurrentTimeMS() / 1000) - mLiveOffset;
@@ -12563,12 +12563,11 @@ void PrivateInstanceAAMP::SetPreferredTextLanguages(const char *param)
1256312563
discardEnteringLiveEvt = false;
1256412564
}
1256512565
ReleaseStreamLock();
12566-
12567-
if (closedCaptionTrackId >= 0)
12568-
{
12569-
TextTrackInfo track = trackInfo[closedCaptionTrackId];
12570-
SetClosedCaptionsFromTextTrack(track);
12571-
}
12566+
}
12567+
if (closedCaptionTrackId >= 0)
12568+
{
12569+
TextTrackInfo track = trackInfo[closedCaptionTrackId];
12570+
SetClosedCaptionsFromTextTrack(track);
1257212571
}
1257312572
}
1257412573
}

priv_aamp.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,14 @@ class PrivateInstanceAAMP : public DrmCallbacks, public std::enable_shared_from_
599599
* @return index of closed caption track otherwise -1 if not found
600600
*/
601601
int FindClosedCaptionTrackIndex(const std::vector<TextTrackInfo> &trackInfo) const;
602+
/**
603+
* @fn CheckPreferredTextLanguages
604+
* @param[in] trackInfo - Text track information
605+
* @param[out] isSelectionChange true if preferences now select a different track to the current selection
606+
* @param[out] isAvailableInManifest true if new selection is available in the manifest
607+
* @param[out] closedCaptionTrackIdx - closed caption track index
608+
*/
609+
void CheckPreferredTextLanguages(const std::vector<TextTrackInfo> &trackInfo,bool &isInManifest, bool &isPresent, int &closedCaptionTrackIdx);
602610

603611
public:
604612
/* @fn RecalculatePTS
@@ -859,14 +867,6 @@ class PrivateInstanceAAMP : public DrmCallbacks, public std::enable_shared_from_
859867
* This function is invoked continuously when ever there is an update in manifest
860868
*/
861869
void updateManifest(const char *manifestData);
862-
/**
863-
* @fn CheckPreferredTextLanguages
864-
* @param[in] trackInfo - Text track information
865-
* @param[out] isSelectionChange true if preferences now select a different track to the current selection
866-
* @param[out] isAvailableInManifest true if new selection is available in the manifest
867-
* @param[out] closedCaptionTrackIdx - closed caption track index
868-
*/
869-
void CheckPreferredTextLanguages(const std::vector<TextTrackInfo> &trackInfo,bool &isInManifest, bool &isPresent, int &closedCaptionTrackIdx);
870870

871871
bool mDiscontinuityFound;
872872
int mTelemetryInterval;

test/utests/tests/PreferredLanguages/SetPreferredTextLanguagesTests.cpp

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,8 @@ TEST_F(SetPreferredTextLanguagesTests, ChangePrefTextLangWithTSB)
783783

784784
/**
785785
* @brief Change between closed caption tracks
786-
* Check that a new closed caption track is selected in PlayerCCManager
787-
* There will be a channel change but this will be removed in future change
786+
* Check that a new closed caption track is selected in PlayerCCManagerBase
787+
* Check that there is no tune (Stop) called on StreamAbstractionAAMP
788788
*/
789789
TEST_F(SetPreferredTextLanguagesTests, ClosedCaptionTest1)
790790
{
@@ -803,9 +803,7 @@ TEST_F(SetPreferredTextLanguagesTests, ClosedCaptionTest1)
803803

804804
EXPECT_CALL(*g_mockStreamAbstractionAAMP, GetAvailableTextTracks(_))
805805
.WillOnce(ReturnRef(tracks));
806-
EXPECT_CALL(*g_mockStreamAbstractionAAMP, Stop(_))
807-
.WillOnce(Invoke(this, &SetPreferredTextLanguagesTests::Stop));
808-
806+
EXPECT_CALL(*g_mockStreamAbstractionAAMP, Stop(_)).Times(0);
809807
EXPECT_CALL(*g_mockPlayerCCManager, SetTrack("CC1",eCLOSEDCAPTION_FORMAT_608)).Times(1).WillRepeatedly(Return(0));
810808

811809
mPrivateInstanceAAMP->SetPreferredTextLanguages("lang1");
@@ -871,33 +869,3 @@ TEST_F(SetPreferredTextLanguagesTests, Accessibility2)
871869
mPrivateInstanceAAMP->SetPreferredTextLanguages("{\"accessibility\":{\"scheme\":\"return_from_mock\",\"string_value\":\"return_from_mock\"}}");
872870

873871
}
874-
/**
875-
* @brief Test new func pulled out through refactoring.
876-
* changing between closed caption tracks
877-
*/
878-
TEST_F(SetPreferredTextLanguagesTests, CheckPreferredTextLanguages1)
879-
{
880-
std::vector<TextTrackInfo> tracks;
881-
882-
//TextTrackInfo(std::string idx, std::string lang, bool cc, std::string rend, std::string trackName, std::string id, std::string cha, int pk):
883-
tracks.push_back(TextTrackInfo("idx0", "lang0", true, "rend0", "trackName0", "CC0", "cha0", 0));
884-
tracks.push_back(TextTrackInfo("idx1", "lang1", true, "rend1", "trackName1", "CC1", "cha1", 1));
885-
886-
bool isSelectionChange = false;
887-
bool isAvailableInManifest = false;
888-
int closedCaptionTrackId = -1;
889-
890-
/*
891-
* The mock for GetTextTrack() will return 0 I.E the first entry in tracks
892-
* set preferred language to lang1 so a change is expected
893-
*/
894-
mPrivateInstanceAAMP->preferredTextLanguagesString = "lang1";
895-
mPrivateInstanceAAMP->preferredTextLanguagesList.clear();
896-
mPrivateInstanceAAMP->preferredTextLanguagesList.push_back("lang1");
897-
mPrivateInstanceAAMP->subtitles_muted = false;
898-
899-
mPrivateInstanceAAMP->CheckPreferredTextLanguages(tracks, isAvailableInManifest, isSelectionChange, closedCaptionTrackId);
900-
901-
EXPECT_EQ(isAvailableInManifest, true);
902-
EXPECT_EQ(isSelectionChange, true);
903-
}

0 commit comments

Comments
 (0)