Skip to content

Commit 6c40988

Browse files
committed
VPLAY-11969 GetTextTrackInfo returns stale information
If the text track is changed without a re-tune then priv_aamps mPreferredTextTrack, and stream abstractions mTextTrackIndex are not updated to reflect the current track The manifest url can be set to null due to an issue with passing the same string into cache handler methods as multiple params by reference. The specified language set via SetTextTrack() is ignored in perference to the prefferedTextLanguage list.
1 parent 15fef7f commit 6c40988

File tree

3 files changed

+9
-28
lines changed

3 files changed

+9
-28
lines changed

AampCacheHandler.cpp

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,14 @@ void AampCacheHandler::StopPlaylistCache( void )
5959
mCondVar.notify_one();
6060
}
6161

62-
bool AampCacheHandler::RetrieveFromPlaylistCache( const std::string &url, AampGrowableBuffer* buffer, std::string& effectiveUrl, AampMediaType mediaType )
62+
bool AampCacheHandler::RetrieveFromPlaylistCache(std::string url, AampGrowableBuffer* buffer, std::string& effectiveUrl, AampMediaType mediaType)
6363
{
6464
bool ret = false;
6565
std::lock_guard<std::mutex> lock(mCacheAccessMutex);
6666
AampCachedData *cachedData = mPlaylistCache.Find(url);
67-
if( cachedData )
67+
if (cachedData)
6868
{
69-
// Create a local copy to prevent aliasing bug when url and effectiveUrl reference the same string
70-
// This can happen when callers pass GetManifestUrl() for both parameters
71-
std::string urlCopy = url;
72-
73-
effectiveUrl = cachedData->effectiveUrl;
74-
if (effectiveUrl.empty())
75-
{
76-
effectiveUrl = urlCopy;
77-
}
69+
effectiveUrl = cachedData->effectiveUrl.empty() ? url : cachedData->effectiveUrl;
7870
buffer->Clear();
7971
buffer->AppendBytes(cachedData->buffer->GetPtr(), cachedData->buffer->GetLen());
8072
// below fails when playing an HLS playlist directly, then seeking or retuning
@@ -123,26 +115,15 @@ void AampCacheHandler::InsertToInitFragCache( const std::string &url, const Aamp
123115
mInitFragmentCache.Insert( url, buffer, effectiveUrl, mediaType );
124116
}
125117

126-
bool AampCacheHandler::RetrieveFromInitFragmentCache(const std::string &url, AampGrowableBuffer* buffer, std::string& effectiveUrl)
118+
bool AampCacheHandler::RetrieveFromInitFragmentCache(std::string url, AampGrowableBuffer* buffer, std::string& effectiveUrl)
127119
{
128120
bool ret = false;
129121
std::lock_guard<std::mutex> lock(mCacheAccessMutex);
130122
AampCachedData *cachedData = mInitFragmentCache.Find(url);
131123
if (cachedData)
132124
{
133125
std::shared_ptr<AampGrowableBuffer> buf = cachedData->buffer;
134-
135-
// Create a local copy to prevent aliasing bug when url and effectiveUrl reference the same string
136-
std::string urlCopy = url;
137-
138-
if (cachedData->effectiveUrl.empty())
139-
{
140-
effectiveUrl = urlCopy;
141-
}
142-
else
143-
{
144-
effectiveUrl = cachedData->effectiveUrl;
145-
}
126+
effectiveUrl = cachedData->effectiveUrl.empty() ? url : cachedData->effectiveUrl;
146127
buffer->Clear();
147128
buffer->AppendBytes(buf->GetPtr(), buf->GetLen());
148129
AAMPLOG_INFO("%s %s found", GetMediaTypeName(cachedData->mediaType), url.c_str());

AampCacheHandler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ class AampCacheHandler
447447
* @param[out] effectiveUrl - Final URL
448448
* @return true: found, false: not found
449449
*/
450-
bool RetrieveFromPlaylistCache( const std::string &url, AampGrowableBuffer* buffer, std::string& effectiveUrl, AampMediaType mediaType );
450+
bool RetrieveFromPlaylistCache(std::string url, AampGrowableBuffer* buffer, std::string& effectiveUrl, AampMediaType mediaType);
451451

452452
/**
453453
* @brief Remove playlist from cache
@@ -493,7 +493,7 @@ class AampCacheHandler
493493
*
494494
* @return true: found, false: not found
495495
*/
496-
bool RetrieveFromInitFragmentCache(const std::string &url, AampGrowableBuffer* buffer, std::string& effectiveUrl);
496+
bool RetrieveFromInitFragmentCache(std::string url, AampGrowableBuffer* buffer, std::string& effectiveUrl);
497497

498498
/**
499499
* @brief set max initialization fragments allowed in cache (per track)

test/utests/fakes/FakeAampCacheHandler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void AampCacheHandler::StopPlaylistCache()
3939
{
4040
}
4141

42-
bool AampCacheHandler::RetrieveFromPlaylistCache(const std::string &url, AampGrowableBuffer* buffer, std::string& effectiveUrl, AampMediaType mediaType)
42+
bool AampCacheHandler::RetrieveFromPlaylistCache(std::string url, AampGrowableBuffer* buffer, std::string& effectiveUrl, AampMediaType mediaType)
4343
{
4444
return false;
4545
}
@@ -65,7 +65,7 @@ void AampCacheHandler::InsertToInitFragCache( const std::string &url, const Aamp
6565
{
6666
}
6767

68-
bool AampCacheHandler::RetrieveFromInitFragmentCache(const std::string &url, AampGrowableBuffer* buffer, std::string& effectiveUrl)
68+
bool AampCacheHandler::RetrieveFromInitFragmentCache(std::string url, AampGrowableBuffer* buffer, std::string& effectiveUrl)
6969
{
7070
return false;
7171
}

0 commit comments

Comments
 (0)