27 #include "AampUtils.h"
36 #define AAMP_BUFFER_MONITOR_GREEN_THRESHOLD 4 //2 fragments for MSO specific linear streams.
50 if(aamp_pthread_setname(pthread_self(),
"aampBuffHealth"))
52 AAMPLOG_WARN(
"aamp_pthread_setname failed");
54 track->MonitorBufferHealth();
63 const char* ret = NULL;
86 double bufferedTime = totalInjectedDuration - GetContext()->GetElapsedTime();
87 if ( (numberOfFragmentsCached <= 0) && (bufferedTime <= AAMP_BUFFER_MONITOR_GREEN_THRESHOLD))
89 AAMPLOG_WARN(
"[%s] bufferedTime %f totalInjectedDuration %f elapsed time %f",
90 name, bufferedTime, totalInjectedDuration, GetContext()->GetElapsedTime());
91 if (bufferedTime <= 0)
104 void MediaTrack::MonitorBufferHealth()
106 int bufferHealthMonitorDelay,bufferHealthMonitorInterval;
107 long discontinuityTimeoutValue;
111 assert(bufferHealthMonitorDelay >= bufferHealthMonitorInterval);
112 unsigned int bufferMontiorScheduleTime = bufferHealthMonitorDelay - bufferHealthMonitorInterval;
113 bool keepRunning =
false;
116 if(aamp->DownloadsAreEnabled() && !abort)
118 aamp->InterruptableMsSleep(bufferMontiorScheduleTime *1000);
121 int monitorInterval = bufferHealthMonitorInterval * 1000;
122 while(keepRunning && !abort)
124 aamp->InterruptableMsSleep(monitorInterval);
125 aamp->GetState(state);
130 pthread_mutex_lock(&mutex);
131 if (aamp->DownloadsAreEnabled() && !abort)
133 bufferStatus = GetBufferStatus();
134 if (bufferStatus != prevBufferStatus)
136 AAMPLOG_WARN(
"aamp: track[%s] buffering %s->%s", name, GetBufferHealthStatusString(prevBufferStatus),
137 GetBufferHealthStatusString(bufferStatus));
138 prevBufferStatus = bufferStatus;
143 GetBufferHealthStatusString(bufferStatus));
146 pthread_mutex_unlock(&mutex);
149 GetContext()->CheckForMediaTrackInjectionStall(type);
151 pthread_mutex_lock(&mutex);
152 if((!aamp->pipeline_paused) && aamp->IsDiscontinuityProcessPending() && discontinuityTimeoutValue)
154 aamp->CheckForDiscontinuityStall((
MediaType)type);
167 AAMPLOG_WARN(
"Possible deadlock with buffering. Enough buffers cached, un-pause pipeline!");
168 aamp->StopBuffering(
true);
178 pthread_mutex_unlock(&mutex);
187 pthread_mutex_lock(&mutex);
188 AAMPLOG_TRACE(
"[%s] Free cachedFragment[%d] numberOfFragmentsCached %d",
189 name, fragmentIdxToInject, numberOfFragmentsCached);
190 aamp_Free(&cachedFragment[fragmentIdxToInject].fragment);
191 memset(&cachedFragment[fragmentIdxToInject], 0,
sizeof(
CachedFragment));
192 fragmentIdxToInject++;
193 if (fragmentIdxToInject == maxCachedFragmentsPerTrack)
195 fragmentIdxToInject = 0;
197 numberOfFragmentsCached--;
198 #ifdef AAMP_DEBUG_FETCH_INJECT
199 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
201 AAMPLOG_WARN(
"[%s] updated fragmentIdxToInject = %d numberOfFragmentsCached %d",
202 name, fragmentIdxToInject, numberOfFragmentsCached);
205 pthread_cond_signal(&fragmentInjected);
206 pthread_mutex_unlock(&mutex);
214 pthread_mutex_lock(&mutex);
216 prevDownloadStartTime = cachedFragmentChunks[fragmentChunkIdxToInject].downloadStartTime;
217 aamp_Free(&cachedFragmentChunks[fragmentChunkIdxToInject].fragmentChunk);
224 fragmentChunkIdxToInject = (++fragmentChunkIdxToInject) % maxCachedFragmentChunksPerTrack;
225 if(numberOfFragmentChunksCached > 0) numberOfFragmentChunksCached--;
227 AAMPLOG_TRACE(
"[%s] updated fragmentChunkIdxToInject = %d numberOfFragmentChunksCached %d",
228 name, fragmentChunkIdxToInject, numberOfFragmentChunksCached);
230 pthread_cond_signal(&fragmentChunkInjected);
231 pthread_mutex_unlock(&mutex);
240 aamp->SendStreamTransfer(mediaType, buffer,
241 fpts, fdts, fDuration);
250 bool notifyCacheCompleted =
false;
251 pthread_mutex_lock(&mutex);
252 cachedFragment[fragmentIdxToFetch].profileIndex = GetContext()->profileIdxForBandwidthNotification;
253 GetContext()->UpdateStreamInfoBitrateData(cachedFragment[fragmentIdxToFetch].profileIndex, cachedFragment[fragmentIdxToFetch].cacheFragStreamInfo);
254 #ifdef AAMP_DEBUG_FETCH_INJECT
255 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
257 AAMPLOG_WARN(
"[%s] before update fragmentIdxToFetch = %d numberOfFragmentsCached %d",
258 fragmentIdxToFetch, numberOfFragmentsCached);
261 totalFetchedDuration += cachedFragment[fragmentIdxToFetch].duration;
262 #ifdef AAMP_DEBUG_FETCH_INJECT
263 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
265 if (numberOfFragmentsCached == 0)
267 AAMPLOG_WARN(
"## [%s] Caching fragment for track when numberOfFragmentsCached is 0 ##", name);
271 numberOfFragmentsCached++;
272 assert(numberOfFragmentsCached <= maxCachedFragmentsPerTrack);
273 currentInitialCacheDurationSeconds += cachedFragment[fragmentIdxToFetch].duration;
276 && aamp->IsFragmentCachingRequired()
277 && !cachingCompleted)
279 const int minInitialCacheSeconds = aamp->GetInitialBufferDuration();
280 if(currentInitialCacheDurationSeconds >= minInitialCacheSeconds)
282 AAMPLOG_WARN(
"##[%s] Caching Complete cacheDuration %d minInitialCacheSeconds %d##",
283 name, currentInitialCacheDurationSeconds, minInitialCacheSeconds);
284 notifyCacheCompleted =
true;
285 cachingCompleted =
true;
287 else if (sinkBufferIsFull && numberOfFragmentsCached == maxCachedFragmentsPerTrack)
289 AAMPLOG_WARN(
"## [%s] Cache is Full cacheDuration %d minInitialCacheSeconds %d, aborting caching!##",
290 name, currentInitialCacheDurationSeconds, minInitialCacheSeconds);
291 notifyCacheCompleted =
true;
292 cachingCompleted =
true;
296 AAMPLOG_INFO(
"## [%s] Caching Ongoing cacheDuration %d minInitialCacheSeconds %d##",
297 name, currentInitialCacheDurationSeconds, minInitialCacheSeconds);
300 fragmentIdxToFetch++;
301 if (fragmentIdxToFetch == maxCachedFragmentsPerTrack)
303 fragmentIdxToFetch = 0;
305 #ifdef AAMP_DEBUG_FETCH_INJECT
306 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
308 AAMPLOG_WARN(
"[%s] updated fragmentIdxToFetch = %d numberOfFragmentsCached %d",
309 name, fragmentIdxToFetch, numberOfFragmentsCached);
312 totalFragmentsDownloaded++;
313 pthread_cond_signal(&fragmentFetched);
314 pthread_mutex_unlock(&mutex);
315 if(notifyCacheCompleted)
317 aamp->NotifyFragmentCachingComplete();
326 pthread_mutex_lock(&mutex);
328 numberOfFragmentChunksCached++;
330 AAMPLOG_TRACE(
"[%s] numberOfFragmentChunksCached++ [%d]", name,numberOfFragmentChunksCached);
333 assert(numberOfFragmentChunksCached <= maxCachedFragmentChunksPerTrack);
335 fragmentChunkIdxToFetch = (fragmentChunkIdxToFetch+1) % maxCachedFragmentChunksPerTrack;
337 AAMPLOG_TRACE(
"[%s] updated fragmentChunkIdxToFetch [%d] numberOfFragmentChunksCached [%d]",
338 name, fragmentChunkIdxToFetch, numberOfFragmentChunksCached);
340 totalFragmentChunksDownloaded++;
341 pthread_cond_signal(&fragmentChunkFetched);
342 pthread_mutex_unlock(&mutex);
344 AAMPLOG_TRACE(
"[%s] pthread_cond_signal(fragmentChunkFetched)", name);
354 int pthreadReturnValue = 0;
356 int preplaybuffercount=0;
367 pthread_mutex_lock(&aamp->mMutexPlaystart);
368 aamp->GetState(state);
369 if(state ==
eSTATE_PREPARED && totalFragmentsDownloaded > preplaybuffercount
370 && !aamp->IsFragmentCachingRequired() )
374 struct timespec tspec;
377 pthreadReturnValue = pthread_cond_timedwait(&aamp->waitforplaystart, &aamp->mMutexPlaystart, &tspec);
379 if (ETIMEDOUT == pthreadReturnValue)
383 else if (0 != pthreadReturnValue)
385 AAMPLOG_WARN(
"[%s] pthread_cond_timedwait returned %s", name, strerror(pthreadReturnValue));
389 pthread_mutex_unlock(&aamp->mMutexPlaystart);
392 pthread_mutex_lock(&mutex);
393 if ( ret && (numberOfFragmentsCached == maxCachedFragmentsPerTrack) )
399 pthreadReturnValue = pthread_cond_timedwait(&fragmentInjected, &mutex, &tspec);
401 if (ETIMEDOUT == pthreadReturnValue)
405 else if (0 != pthreadReturnValue)
407 AAMPLOG_WARN(
"[%s] pthread_cond_timedwait returned %s", name, strerror(pthreadReturnValue));
413 #ifdef AAMP_DEBUG_FETCH_INJECT
414 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
416 AAMPLOG_WARN(
"[%s] waiting for fragmentInjected condition", name);
419 pthreadReturnValue = pthread_cond_wait(&fragmentInjected, &mutex);
421 if (0 != pthreadReturnValue)
423 AAMPLOG_WARN(
"[%s] pthread_cond_wait returned %s", name, strerror(pthreadReturnValue));
426 #ifdef AAMP_DEBUG_FETCH_INJECT
427 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
429 AAMPLOG_WARN(
"[%s] wait complete for fragmentInjected", name);
435 #ifdef AAMP_DEBUG_FETCH_INJECT
436 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
438 AAMPLOG_WARN(
"[%s] abort set, returning false", name);
444 #ifdef AAMP_DEBUG_FETCH_INJECT
445 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
447 AAMPLOG_WARN(
"[%s] fragmentIdxToFetch = %d numberOfFragmentsCached %d",
448 name, fragmentIdxToFetch, numberOfFragmentsCached);
451 pthread_mutex_unlock(&mutex);
461 pthread_mutex_lock(&mutex);
462 if ((numberOfFragmentsCached == 0) && !(abort || abortInject))
464 #ifdef AAMP_DEBUG_FETCH_INJECT
465 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
467 AAMPLOG_WARN(
"## [%s] Waiting for CachedFragment to be available, eosReached=%d ##", name, eosReached);
472 pthread_cond_wait(&fragmentFetched, &mutex);
475 #ifdef AAMP_DEBUG_FETCH_INJECT
476 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
478 AAMPLOG_WARN(
"[%s] fragmentIdxToInject = %d numberOfFragmentsCached %d",
479 name, fragmentIdxToInject, numberOfFragmentsCached);
482 ret = !(abort || abortInject || (numberOfFragmentsCached == 0));
483 pthread_mutex_unlock(&mutex);
493 int pthreadReturnValue = 0;
494 pthread_mutex_lock(&mutex);
496 if ((numberOfFragmentChunksCached == maxCachedFragmentChunksPerTrack) && !(abort || abortInjectChunk))
502 pthreadReturnValue = pthread_cond_timedwait(&fragmentChunkInjected, &mutex, &tspec);
504 if (ETIMEDOUT == pthreadReturnValue)
508 else if (0 != pthreadReturnValue)
510 AAMPLOG_WARN(
"[%s] pthread_cond_timedwait returned %s", name, strerror(pthreadReturnValue));
516 AAMPLOG_TRACE(
"[%s] waiting for fragmentChunkInjected condition", name);
517 pthreadReturnValue = pthread_cond_wait(&fragmentChunkInjected, &mutex);
519 if (0 != pthreadReturnValue)
521 AAMPLOG_WARN(
"[%s] pthread_cond_wait returned %s", name, strerror(pthreadReturnValue));
524 AAMPLOG_TRACE(
"[%s] wait complete for fragmentChunkInjected", name);
527 if(abort || abortInjectChunk)
533 AAMPLOG_TRACE(
"[%s] fragmentChunkIdxToFetch = %d numberOfFragmentChunksCached %d",
534 name, fragmentChunkIdxToFetch, numberOfFragmentChunksCached);
536 pthread_mutex_unlock(&mutex);
546 pthread_mutex_lock(&mutex);
548 AAMPLOG_TRACE(
"[%s] Acquired MUTEX ==> fragmentChunkIdxToInject = %d numberOfFragmentChunksCached %d ret = %d abort = %d abortInjectChunk = %d ", name, fragmentChunkIdxToInject, numberOfFragmentChunksCached, ret, abort, abortInjectChunk);
550 if ((numberOfFragmentChunksCached == 0) && !(abort || abortInjectChunk ))
552 AAMPLOG_TRACE(
"## [%s] Waiting for CachedFragment to be available, eosReached=%d ##", name, eosReached);
556 int pthreadReturnValue = 0;
557 pthreadReturnValue = pthread_cond_wait(&fragmentChunkFetched, &mutex);
558 if (0 != pthreadReturnValue)
560 AAMPLOG_WARN(
"[%s] pthread_cond_wait(fragmentChunkFetched) returned %s", name, strerror(pthreadReturnValue));
562 AAMPLOG_TRACE(
"[%s] wait complete for fragmentChunkFetched", name);
567 ret = !(abort || abortInjectChunk);
569 AAMPLOG_TRACE(
"[%s] fragmentChunkIdxToInject = %d numberOfFragmentChunksCached %d ret = %d abort = %d abortInjectChunk = %d",
570 name, fragmentChunkIdxToInject, numberOfFragmentChunksCached, ret, abort, abortInjectChunk);
572 pthread_mutex_unlock(&mutex);
581 pthread_mutex_lock(&mutex);
585 #ifdef AAMP_DEBUG_FETCH_INJECT
586 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
588 AAMPLOG_WARN(
"[%s] signal fragmentInjected condition", name);
591 pthread_cond_signal(&fragmentInjected);
592 if(aamp->GetLLDashServiceData()->lowLatencyMode)
594 AAMPLOG_TRACE(
"[%s] signal fragmentChunkInjected condition", name);
595 pthread_cond_signal(&fragmentChunkInjected);
598 if(aamp->GetLLDashServiceData()->lowLatencyMode)
600 AAMPLOG_TRACE(
"[%s] signal fragmentChunkFetched condition", name);
601 pthread_cond_signal(&fragmentChunkFetched);
603 pthread_cond_signal(&aamp->waitforplaystart);
604 pthread_cond_signal(&fragmentFetched);
605 pthread_mutex_unlock(&mutex);
607 GetContext()->AbortWaitForDiscontinuity();
616 pthread_mutex_lock(&mutex);
618 if(aamp->GetLLDashServiceData()->lowLatencyMode)
620 abortInjectChunk =
true;
621 AAMPLOG_TRACE(
"[%s] signal fragmentChunkFetched condition", name);
622 pthread_cond_signal(&fragmentChunkFetched);
626 #ifdef AAMP_DEBUG_FETCH_INJECT
627 if ((1 << type) & AAMP_DEBUG_FETCH_INJECT)
629 AAMPLOG_WARN(
"[%s] signal fragmentFetched condition", name);
632 pthread_cond_signal(&fragmentFetched);
633 pthread_mutex_unlock(&mutex);
635 GetContext()->AbortWaitForDiscontinuity();
644 CachedFragmentChunk* cachedFragmentChunk = &this->cachedFragmentChunks[fragmentChunkIdxToInject];
645 if(cachedFragmentChunk != NULL && NULL == cachedFragmentChunk->
fragmentChunk.
ptr)
650 if((cachedFragmentChunk->
downloadStartTime != prevDownloadStartTime) && (unparsedBufferChunk.ptr != NULL))
652 AAMPLOG_WARN(
"[%s] clean up curl chunk buffer, since prevDownloadStartTime[%lld] != currentdownloadtime[%lld]", name,prevDownloadStartTime,cachedFragmentChunk->
downloadStartTime);
657 size_t requiredLength = cachedFragmentChunk->
fragmentChunk.
len + unparsedBufferChunk.len;
658 AAMPLOG_TRACE(
"[%s] cachedFragmentChunk->fragmentChunk.len [%zu] to unparsedBufferChunk.len [%zu] Required Len [%zu]", name, cachedFragmentChunk->
fragmentChunk.
len, unparsedBufferChunk.len, requiredLength);
663 #if 0 //enable to avoid small buffer processing
672 const Box *pBox = NULL;
673 std::vector<Box*> *pBoxes;
674 size_t mdatCount = 0;
675 size_t parsedBoxCount = 0;
676 char *unParsedBuffer = NULL;
677 size_t parsedBufferSize = 0, unParsedBufferSize = 0;
679 unParsedBuffer = unparsedBufferChunk.ptr;
680 unParsedBufferSize = parsedBufferSize = unparsedBufferChunk.len;
682 isobuf.
setBuffer(
reinterpret_cast<uint8_t *
>(unparsedBufferChunk.ptr), unparsedBufferChunk.len);
684 AAMPLOG_TRACE(
"[%s] Unparsed Buffer Size: %zu", name,unparsedBufferChunk.len);
691 catch( std::bad_alloc& ba)
693 AAMPLOG_ERR(
"Bad allocation: %s", ba.what() );
695 catch( std::exception &e)
697 AAMPLOG_ERR(
"Unhandled exception: %s", e.what() );
701 AAMPLOG_ERR(
"Unknown exception");
705 AAMPLOG_INFO(
"[%s] No Box available in cache chunk: fragmentChunkIdxToInject %d", name, fragmentChunkIdxToInject);
716 AAMPLOG_INFO(
"[%s] noMDATCount=%d ChunkIndex=%d totchunklen=%zu", name,noMDATCount, fragmentChunkIdxToInject,unParsedBufferSize);
723 totalMdatCount += mdatCount;
724 AAMPLOG_TRACE(
"[%s] MDAT count found: %zu, Total Found: %d", name, mdatCount, totalMdatCount );
727 parsedBoxCount = pBoxes->size();
735 AAMPLOG_TRACE(
"[%s] MDAT Chunk Found - Actual Parsed Box Count: %zu", name,parsedBoxCount);
740 int lastMDatIndex = -1;
742 for(
int i=parsedBoxCount-1;i>=0;i--)
744 Box *box = pBoxes->at(i);
745 if (IS_TYPE(box->
getType(), Box::MDAT))
749 AAMPLOG_TRACE(
"[%s] Last MDAT Index : %d", name,lastMDatIndex);
755 parsedBufferSize -= unParsedBufferSize;
757 AAMPLOG_TRACE(
"[%s] parsedBufferSize : %zu updated unParsedBufferSize: %zu Total Buf Size processed: %lu", name,parsedBufferSize,unParsedBufferSize,parsedBufferSize+unParsedBufferSize);
765 uint64_t fDuration = 0;
766 double fduration = 0.0;
767 uint64_t totalChunkDuration = 0.0;
773 for(
int i=0;i<lastMDatIndex;i++)
775 Box *box = pBoxes->at(i);
776 #ifdef AAMP_DEBUG_INJECT_CHUNK
777 AAMPLOG_WARN(
"[%s] Type: %s", name,box->
getType());
779 if (IS_TYPE(box->
getType(), Box::MOOF))
782 totalChunkDuration += fDuration;
783 #ifdef AAMP_DEBUG_INJECT_CHUNK
784 AAMPLOG_WARN(
"[%s] fDuration = %lld, totalChunkDuration = %lld", name,fDuration, totalChunkDuration);
795 uint32_t timeScale = 0;
798 timeScale = aamp->GetVidTimeScale();
802 timeScale = aamp->GetAudTimeScale();
808 timeScale = GetContext()->GetCurrPeriodTimeScale();
811 timeScale = 10000000.0;
812 AAMPLOG_WARN(
"[%s] Empty timeScale!!! Using default timeScale=%d", name, timeScale);
816 fpts = fPts/(timeScale*1.0);
817 fduration = totalChunkDuration/(timeScale*1.0);
820 aamp_AppendBytes(&parsedBufferChunk, unparsedBufferChunk.ptr, parsedBufferSize);
821 #ifdef AAMP_DEBUG_INJECT_CHUNK
824 isobufTest.
setBuffer(
reinterpret_cast<uint8_t *
>(parsedBufferChunk.ptr), parsedBufferChunk.len);
828 AAMPLOG_WARN(
"[%s] CHUNK Found in parsed buffer. Something is wrong", name);
832 AAMPLOG_WARN(
"[%s] No CHUNK Found in parsed buffer. All Good to Send", name);
837 AAMPLOG_INFO(
"Injecting chunk for %s br=%d,chunksize=%ld fpts=%f fduration=%f",name,bandwidthBitsPerSecond,parsedBufferChunk.len,fpts,fduration);
838 InjectFragmentChunkInternal((
MediaType)type,&parsedBufferChunk , fpts, fpts, fduration);
839 totalInjectedChunksDuration += fduration;
845 if(unParsedBufferSize)
847 AAMPLOG_TRACE(
"[%s] unparsed[%p] unparsed_size[%zu]", name,unParsedBuffer,unParsedBufferSize);
860 AAMPLOG_TRACE(
"[%s] Set Unparsed Buffer chunk Empty...", name);
877 if (WaitForCachedFragmentChunkAvailable())
880 bIgnore = ProcessFragmentChunk();
882 UpdateTSAfterChunkInject();
886 AAMPLOG_WARN(
"WaitForCachedFragmentChunkAvailable %s aborted", name);
898 if(!aamp->GetLLDashServiceData()->lowLatencyMode)
900 aamp->BlockUntilGstreamerWantsData(NULL, 0, type);
903 if (WaitForCachedFragmentAvailable())
905 bool stopInjection =
false;
906 bool fragmentDiscarded =
false;
907 CachedFragment* cachedFragment = &this->cachedFragment[fragmentIdxToInject];
909 AAMPLOG_WARN(
"[%s] - fragmentIdxToInject %d cachedFragment %p ptr %p",
910 name, fragmentIdxToInject, cachedFragment, cachedFragment->
fragment.
ptr);
915 #ifdef AAMP_DEBUG_INJECT
916 if ((1 << type) & AAMP_DEBUG_INJECT)
920 AAMPLOG_WARN(
"[%s] Discontinuity present. uri %s", name, cachedFragment->uri);
926 AAMPLOG_WARN(
"[%s] notifying discontinuity to parser!", name);
927 if (mSubtitleParser) mSubtitleParser->reset();
928 stopInjection =
true;
929 discontinuityProcessed =
true;
933 else if ((cachedFragment->
discontinuity || ptsError) && (AAMP_NORMAL_PLAY_RATE == context->aamp->rate))
935 bool isDiscoIgnoredForOtherTrack = aamp->IsDiscontinuityIgnoredForOtherTrack((
MediaType)!type);
936 AAMPLOG_WARN(
"track %s - encountered aamp discontinuity @position - %f, isDiscoIgnoredForOtherTrack - %d", name, cachedFragment->
position, isDiscoIgnoredForOtherTrack);
944 if (totalInjectedDuration == 0 && !aamp->mpStreamAbstractionAAMP->GetESChangeStatus())
946 stopInjection =
false;
948 if (!isDiscoIgnoredForOtherTrack)
951 aamp->SetTrackDiscontinuityIgnoredStatus((
MediaType)type);
956 aamp->ResetTrackDiscontinuityIgnoredStatus();
957 aamp->UnblockWaitForDiscontinuityProcessToComplete();
960 AAMPLOG_WARN(
"ignoring %s discontinuity since no buffer pushed before!", name);
962 else if (isDiscoIgnoredForOtherTrack && !aamp->mpStreamAbstractionAAMP->GetESChangeStatus())
964 AAMPLOG_WARN(
"discontinuity ignored for other AV track , no need to process %s track", name);
965 stopInjection =
false;
968 aamp->ResetTrackDiscontinuityIgnoredStatus();
969 aamp->UnblockWaitForDiscontinuityProcessToComplete();
973 stopInjection = context->ProcessDiscontinuity(type);
979 discontinuityProcessed =
true;
980 AAMPLOG_WARN(
"track %s - stopping injection @position - %f", name, cachedFragment->
position);
984 AAMPLOG_WARN(
"track %s - continuing injection", name);
989 SignalTrickModeDiscontinuity();
994 #ifdef AAMP_DEBUG_INJECT
995 if ((1 << type) & AAMP_DEBUG_INJECT)
997 AAMPLOG_WARN(
"[%s] Inject uri %s", name, cachedFragment->uri);
1007 InjectFragmentInternal(cachedFragment, fragmentDiscarded);
1009 if (
eTRACK_VIDEO == type && GetContext()->GetProfileCount())
1014 if (!fragmentDiscarded)
1016 totalInjectedDuration += cachedFragment->
duration;
1017 mSegInjectFailCount = 0;
1021 AAMPLOG_WARN(
"[%s] - Not updating totalInjectedDuration since fragment is Discarded", name);
1022 mSegInjectFailCount++;
1023 int SegInjectFailCount;
1025 if(SegInjectFailCount <= mSegInjectFailCount)
1028 AAMPLOG_ERR(
"[%s] Reached max inject failure count: %d, stopping playback", name, SegInjectFailCount);
1033 UpdateTSAfterInject();
1043 if(pContext != NULL)
1045 int rate = GetContext()->aamp->rate;
1046 aamp->EndOfStreamReached((
MediaType)type);
1050 if (audio && !audio->
enabled && rate == AAMP_NORMAL_PLAY_RATE)
1057 AAMPLOG_WARN(
"GetContext is null");
1062 AAMPLOG_WARN(
"%s - NULL ptr to inject. fragmentIdxToInject %d", name, fragmentIdxToInject);
1069 AAMPLOG_WARN(
"WaitForCachedFragmentAvailable %s aborted", name);
1074 int rate = GetContext()->aamp->rate;
1075 aamp->EndOfStreamReached((
MediaType)type);
1079 if (audio && !audio->
enabled && rate == AAMP_NORMAL_PLAY_RATE)
1099 if(aamp_pthread_setname(pthread_self(),
"aampInjector"))
1101 AAMPLOG_WARN(
"aamp_pthread_setname failed");
1118 bFlag = aamp_pthread_setname(pthread_self(),
"VideoChunkInjector");
1122 bFlag = aamp_pthread_setname(pthread_self(),
"AudioChunkInjector");
1126 AAMPLOG_WARN(
"aamp_pthread_setname failed");
1139 abortInject =
false;
1140 discontinuityProcessed =
false;
1141 assert(!fragmentInjectorThreadStarted);
1142 if (0 == pthread_create(&fragmentInjectorThreadID, NULL, &
FragmentInjector,
this))
1144 fragmentInjectorThreadStarted =
true;
1148 AAMPLOG_WARN(
"Failed to create FragmentInjector thread");
1158 abortInjectChunk =
false;
1159 discontinuityProcessed =
false;
1160 assert(!fragmentChunkInjectorThreadStarted);
1163 fragmentChunkInjectorThreadStarted =
true;
1167 AAMPLOG_WARN(
"Failed to create FragmentChunkInjector thread");
1176 AAMPLOG_WARN(
"fragment injector started. track %s", name);
1177 bool notifyFirstFragment =
true;
1178 bool keepInjecting =
true;
1179 if ((AAMP_NORMAL_PLAY_RATE == aamp->rate) && !bufferMonitorThreadStarted )
1184 bufferMonitorThreadStarted =
true;
1188 AAMPLOG_WARN(
"Failed to create BufferHealthMonitor thread errno = %d, %s", errno, strerror(errno));
1191 totalInjectedDuration = 0;
1192 while (aamp->DownloadsAreEnabled() && keepInjecting)
1194 if (!InjectFragment())
1196 keepInjecting =
false;
1200 notifyFirstFragment =
false;
1201 GetContext()->NotifyFirstFragmentInjected();
1209 if(pContext != NULL)
1230 AAMPLOG_WARN(
"GetContext is null");
1235 AAMPLOG_WARN(
"fragment injector done. track %s", name);
1244 AAMPLOG_WARN(
"fragment Chunk injector started. track %s", name);
1245 bool notifyFirstFragmentChunk =
true;
1246 bool keepInjectingChunk =
true;
1248 totalInjectedChunksDuration = 0;
1249 while (aamp->DownloadsAreEnabled() && keepInjectingChunk)
1251 if (!InjectFragmentChunk())
1253 keepInjectingChunk =
false;
1256 abortInjectChunk =
true;
1257 AAMPLOG_WARN(
"fragment chunk injector done. track %s", name);
1265 if (fragmentInjectorThreadStarted)
1267 int rc = pthread_join(fragmentInjectorThreadID, NULL);
1270 AAMPLOG_WARN(
"***pthread_join fragmentInjectorThread returned %d(%s)", rc, strerror(rc));
1275 AAMPLOG_WARN(
"joined fragmentInjectorThread");
1279 fragmentInjectorThreadStarted =
false;
1287 if (fragmentChunkInjectorThreadStarted)
1289 int rc = pthread_join(fragmentChunkInjectorThreadID, NULL);
1292 AAMPLOG_WARN(
"***pthread_join fragmentInjectorChunkThread returned %d(%s)", rc, strerror(rc));
1297 AAMPLOG_WARN(
"joined fragmentInjectorChunkThread");
1301 fragmentChunkInjectorThreadStarted =
false;
1319 CachedFragment* cachedFragment = &this->cachedFragment[fragmentIdxToFetch];
1324 AAMPLOG_WARN(
"fragment.ptr already set - possible memory leak");
1328 return cachedFragment;
1336 if(fragmentChunkIdxToFetch <0 || fragmentChunkIdxToFetch >= maxCachedFragmentChunksPerTrack)
1338 AAMPLOG_WARN(
"[%s] OUT OF RANGE => fragmentChunkIdxToFetch: %d",name,fragmentChunkIdxToFetch);
1343 cachedFragmentChunk = &this->cachedFragmentChunks[fragmentChunkIdxToFetch];
1345 AAMPLOG_TRACE(
"[%s] fragmentChunkIdxToFetch: %d cachedFragmentChunk: %p",name, fragmentChunkIdxToFetch, cachedFragmentChunk);
1347 if(initialize && cachedFragmentChunk)
1355 return cachedFragmentChunk;
1363 this->bandwidthBitsPerSecond = bandwidthBps;
1371 return GetContext()->GetProfileIndexForBandwidth(mTsbBandwidth);
1379 return this->bandwidthBitsPerSecond;
1389 for (
int i = 0; i < maxCachedFragmentsPerTrack; i++)
1394 fragmentIdxToInject = 0;
1395 fragmentIdxToFetch = 0;
1396 numberOfFragmentsCached = 0;
1397 totalFetchedDuration = 0;
1398 totalFragmentsDownloaded = 0;
1399 totalInjectedDuration = 0;
1407 AAMPLOG_WARN(
"[%s]", name);
1409 for (
int i = 0; i < maxCachedFragmentChunksPerTrack; i++)
1411 aamp_Free(&cachedFragmentChunks[i].fragmentChunk);
1419 fragmentChunkIdxToInject = 0;
1420 fragmentChunkIdxToFetch = 0;
1421 pthread_mutex_lock(&mutex);
1422 numberOfFragmentChunksCached = 0;
1423 totalFragmentChunksDownloaded = 0;
1424 totalInjectedChunksDuration = 0;
1425 pthread_mutex_unlock(&mutex);
1433 eosReached(false), enabled(false), numberOfFragmentsCached(0), numberOfFragmentChunksCached(0), fragmentIdxToInject(0), fragmentChunkIdxToInject(0),
1434 fragmentIdxToFetch(0), fragmentChunkIdxToFetch(0), abort(false), fragmentInjectorThreadID(0), fragmentChunkInjectorThreadID(0),bufferMonitorThreadID(0), totalFragmentsDownloaded(0), totalFragmentChunksDownloaded(0),
1435 fragmentInjectorThreadStarted(false), fragmentChunkInjectorThreadStarted(false),bufferMonitorThreadStarted(false), totalInjectedDuration(0), totalInjectedChunksDuration(0), currentInitialCacheDurationSeconds(0),
1436 sinkBufferIsFull(false), cachingCompleted(false), fragmentDurationSeconds(0), segDLFailCount(0),segDrmDecryptFailCount(0),mSegInjectFailCount(0),
1438 bandwidthBitsPerSecond(0), totalFetchedDuration(0),
1439 discontinuityProcessed(false), ptsError(false), cachedFragment(NULL), name(name), type(type), aamp(aamp),
1440 mutex(), fragmentFetched(), fragmentInjected(), abortInject(false),
1441 mSubtitleParser(), refreshSubtitles(false), maxCachedFragmentsPerTrack(0),
1442 totalMdatCount(0), cachedFragmentChunks{}, unparsedBufferChunk{}, parsedBufferChunk{}, fragmentChunkFetched(), fragmentChunkInjected(), abortInjectChunk(
false), maxCachedFragmentChunksPerTrack(0),
1443 noMDATCount(0), mLogObj(logObj) ,prevDownloadStartTime(-1)
1447 for(
int X =0; X< maxCachedFragmentsPerTrack; ++X){
1451 if(aamp->GetLLDashServiceData()->lowLatencyMode)
1454 for(
int X =0; X< maxCachedFragmentChunksPerTrack; ++X)
1457 pthread_cond_init(&fragmentChunkFetched, NULL);
1458 pthread_cond_init(&fragmentChunkInjected, NULL);
1461 pthread_cond_init(&fragmentFetched, NULL);
1462 pthread_cond_init(&fragmentInjected, NULL);
1463 pthread_mutex_init(&mutex, NULL);
1477 AAMPLOG_WARN(
"***pthread_join bufferMonitorThreadID returned %d(%s)", rc, strerror(rc));
1482 AAMPLOG_WARN(
"joined bufferMonitorThreadID");
1490 AAMPLOG_WARN(
"In MediaTrack destructor - fragmentInjectorThreads are still running, signalling cond variable");
1495 AAMPLOG_WARN(
"In MediaTrack destructor - fragmentChunkInjectorThreads are still running, signalling cond variable");
1500 AAMPLOG_INFO(
"LL-Mode flushing chunks");
1506 for (
int j = 0; j < maxCachedFragmentsPerTrack; j++)
1516 pthread_mutex_destroy(&
mutex);
1527 if( audio && video )
1529 pthread_mutex_lock(&
mLock);
1534 pthread_cond_signal(&
mCond);
1535 #ifdef AAMP_DEBUG_FETCH_INJECT
1536 AAMPLOG_WARN(
"signalling cond - audioDuration %f videoDuration %f",
1537 audioDuration, videoDuration);
1546 #ifdef AAMP_DEBUG_FETCH_INJECT
1547 AAMPLOG_WARN(
"signalling cond - auxDuration %f videoDuration %f",
1548 auxDuration, videoDuration);
1552 pthread_mutex_unlock(&
mLock);
1571 pthread_mutex_lock(&
mLock);
1577 #ifdef AAMP_DEBUG_FETCH_INJECT
1578 AAMPLOG_WARN(
"waiting for cond - audioDuration %f videoDuration %f video->fragmentDurationSeconds %f",
1583 ret = pthread_cond_timedwait(&
mCond, &
mLock, &ts);
1589 if (ret != ETIMEDOUT)
1591 AAMPLOG_WARN(
"error while calling pthread_cond_timedwait - %s", strerror(ret));
1597 AAMPLOG_WARN(
"video is null");
1599 pthread_mutex_unlock(&
mLock);
1607 trickplayMode(false), currentProfileIndex(0), mCurrentBandwidth(0),currentAudioProfileIndex(-1),currentTextTrackProfileIndex(-1),
1608 mTsbBandwidth(0),mNwConsistencyBypass(true), profileIdxForBandwidthNotification(0),
1609 hasDrm(false), mIsAtLivePoint(false), mESChangeStatus(false),mAudiostateChangeCount(0),
1610 mNetworkDownDetected(false), mTotalPausedDurationMS(0), mIsPaused(false), mProgramStartTime(-1),
1611 mStartTimeStamp(-1),mLastPausedTimeStamp(-1), aamp(aamp),
1612 mIsPlaybackStalled(false), mCheckForRampdown(false), mTuneType(), mLock(),
1613 mCond(), mLastVideoFragCheckedforABR(0), mLastVideoFragParsedTimeMS(0),
1614 mSubCond(), mAudioTracks(), mTextTracks(),mABRHighBufferCounter(0),mABRLowBufferCounter(0),mMaxBufferCountCheck(0),
1616 mRampDownLimit(-1), mRampDownCount(0),mABRMaxBuffer(0), mABRCacheLength(0), mABRMinBuffer(0), mABRNwConsistency(0),
1617 mBitrateReason(eAAMP_BITRATE_CHANGE_BY_TUNE),
1618 mAudioTrackIndex(), mTextTrackIndex(),
1619 mAuxCond(), mFwdAudioToAux(false), mLogObj(logObj)
1622 mTsbMaxBitrateProfileIndex(-1)
1626 pthread_mutex_init(&
mLock, NULL);
1627 pthread_cond_init(&
mCond, NULL);
1628 pthread_cond_init(&
mSubCond, NULL);
1629 pthread_cond_init(&
mAuxCond, NULL);
1649 mBitrateReason = (
aamp->
rate != AAMP_NORMAL_PLAY_RATE) ? eAAMP_BITRATE_CHANGE_BY_TRICKPLAY : eAAMP_BITRATE_CHANGE_BY_SEEK;
1660 pthread_cond_destroy(&
mCond);
1663 pthread_mutex_destroy(&
mLock);
1667 AAMPLOG_INFO(
"Exit StreamAbstractionAAMP");
1683 int desiredProfileIndex = 0;
1692 desiredProfileIndex =
aamp->
mhAbrManager.getInitialProfileIndex(getMidProfile);
1699 if(streamInfo != NULL)
1705 AAMPLOG_WARN(
"GetStreamInfo is null");
1714 return desiredProfileIndex;
1747 if(streamInfo != NULL)
1749 bool lGetBWIndex =
false;
1769 AAMPLOG_WARN(
"StreamInfo is null");
1780 return (video && video->
enabled);
1808 int desiredProfileIndex = 0;
1819 if(streamInfo != NULL)
1827 AAMPLOG_WARN(
"GetStreamInfo is null");
1848 double bufferValue = video->GetBufferedDuration();
1850 aamp->
mhAbrManager.GetDesiredProfileOnBuffer(currProfileIndex,newProfileIndex,bufferValue,minBufferNeeded);
1859 double bufferValue = video->GetBufferedDuration();
1860 if(bufferValue > 0 && currProfileIndex == newProfileIndex)
1862 AAMPLOG_INFO(
"buffer:%f currProf:%d nwBW:%ld",bufferValue,currProfileIndex,nwBandwidth);
1869 int nProfileIdx =
aamp->
mhAbrManager.getRampedUpProfileIndex(currProfileIndex);
1873 aamp->
mhAbrManager.CheckRampupFromSteadyState(currProfileIndex,newProfileIndex,nwBandwidth,bufferValue,newBandwidth,mhBitrateReason,mMaxBufferCountCheck);
1880 if(nwBandwidth == -1 && bufferValue < mABRMinBuffer && !video->IsInjectionAborted())
1911 double vBufferDuration = video->GetBufferedDuration();
1912 if(vBufferDuration > 0)
1914 long timeoutMs = (long)(vBufferDuration*1000); ;
1917 timeoutMs =
aamp->mNetworkTimeoutMs;
1921 timeoutMs = std::min(timeoutMs/2,(
long)(
mABRMaxBuffer*1000));
1922 timeoutMs = std::max(timeoutMs ,
aamp->mNetworkTimeoutMs);
1925 AAMPLOG_INFO(
"Setting Video timeout to :%ld %f",timeoutMs,vBufferDuration);
1932 double aBufferDuration = audio->GetBufferedDuration();
1933 if(aBufferDuration > 0)
1935 long timeoutMs = (long)(aBufferDuration*1000);
1938 timeoutMs =
aamp->mNetworkTimeoutMs;
1942 timeoutMs = std::min(timeoutMs/2,(
long)(
mABRMaxBuffer*1000));
1943 timeoutMs = std::max(timeoutMs ,
aamp->mNetworkTimeoutMs);
1946 AAMPLOG_INFO(
"Setting Audio timeout to :%ld %f",timeoutMs,aBufferDuration);
1963 if(tmpIframeProfile != ABRManager::INVALID_PROFILE)
1969 desiredProfileIndex = tmpIframeProfile;
1981 currentBandwidth, networkBandwidth, nwConsistencyCnt);
1983 AAMPLOG_INFO(
"currBW:%ld NwBW=%ld currProf:%d desiredProf:%d",currentBandwidth,networkBandwidth,
currentProfileIndex,desiredProfileIndex);
2010 AAMPLOG_WARN(
"video is null");
2012 return desiredProfileIndex;
2028 if (desiredProfileIndex != lowestIframeProfile)
2030 if (ABRManager::INVALID_PROFILE != lowestIframeProfile)
2032 desiredProfileIndex = lowestIframeProfile;
2036 AAMPLOG_WARN(
"lowestIframeProfile Invalid - Stream does not has an iframe track!! ");
2048 stAbrInfo.abrCalledFor = AAMPAbrFragmentDownloadFailed;
2050 stAbrInfo.desiredProfileIndex = desiredProfileIndex;
2053 if((streamInfocurrent != NULL) && (streamInfodesired != NULL))
2059 stAbrInfo.errorCode = (int)http_error;
2061 AAMP_LOG_ABR_INFO(&stAbrInfo);
2087 AAMPLOG_WARN(
"GetStreamInfo is null");
2121 long ret = http_error;
2123 if (http_error >= PARTIAL_FILE_CONNECTIVITY_AAMP && http_error <= PARTIAL_FILE_START_STALL_TIMEOUT_AAMP)
2125 if (http_error == OPERATION_TIMEOUT_CONNECTIVITY_AAMP)
2127 ret = CURLE_OPERATION_TIMEDOUT;
2131 ret = CURLE_PARTIAL_FILE;
2145 bool retValue =
false;
2156 if (http_error == 404 || http_error == 502 || http_error == 500 || http_error == 503 || http_error == CURLE_PARTIAL_FILE)
2160 AAMPLOG_INFO(
"StreamAbstractionAAMP: Condition Rampdown Success");
2165 else if (http_error == CURLE_OPERATION_TIMEDOUT)
2211 if (checkProfileChange)
2218 AAMPLOG_WARN(
"Video is null");
2247 pthread_mutex_lock(&
mLock);
2263 AAMPLOG_WARN(
"StreamAbstractionAAMP: mLastPausedTimeStamp -1");
2266 pthread_mutex_unlock(&
mLock);
2278 if (!audioTrack || !videoTrack)
2284 if (videoBufferIsEmpty || audioBufferIsEmpty)
2286 AAMPLOG_WARN(
"StreamAbstractionAAMP: Stall detected. Buffer status is RED!");
2297 bool retVal =
false;
2303 AAMPLOG_WARN(
"**aamp changing profile: %d->%d [%ld->%ld]",
2306 GetStreamInfo(desiredProfileIndex)->bandwidthBitsPerSecond);
2310 stAbrInfo.abrCalledFor = AAMPAbrBandwidthUpdate;
2312 stAbrInfo.desiredProfileIndex = desiredProfileIndex;
2318 AAMP_LOG_ABR_INFO(&stAbrInfo);
2360 if(mediatrack != NULL)
2363 GETCONFIGVALUE(eAAMPConfig_StallTimeoutMS,stalltimeout);
2366 AAMPLOG_INFO(
"StreamAbstractionAAMP: Didn't download a new fragment for a long time(%f) and cache empty!", timeElapsedSinceLastFragment);
2370 AAMPLOG_WARN(
"StreamAbstractionAAMP: Stall detected!. Time elapsed since fragment parsed(%f), caches are all empty!", timeElapsedSinceLastFragment);
2377 AAMPLOG_WARN(
"GetMediaTrack is null");
2388 pthread_mutex_lock(&
mLock);
2393 pthread_mutex_unlock(&
mLock);
2402 pthread_mutex_lock(&
mLock);
2412 pthread_mutex_unlock(&
mLock);
2464 if(iter->characteristics ==
"muxed-audio")
2476 for(
auto iter : vector)
2478 char* currentId =
const_cast<char*
>(iter.rendition.c_str());
2479 char* currentLanguage =
const_cast<char*
>(iter.language.c_str());
2482 { return ((temp.language == currentLanguage) && (temp.rendition == currentId)); });
2488 language->characteristics = iter.characteristics;
2489 language->codec = iter.codec;
2490 language->index = iter.index;
2497 if(vector.size() > 0)
2515 if(subtitle == NULL)
2517 AAMPLOG_WARN(
"subtitle is null");
2531 AAMPLOG_WARN(
"audio is null");
2534 pthread_mutex_lock(&
mLock);
2540 AAMPLOG_TRACE(
"Blocked on Inside mSubCond with sub:%f and audio:%f", subtitleDuration, audioDuration);
2541 #ifdef AAMP_DEBUG_FETCH_INJECT
2542 AAMPLOG_WARN(
"waiting for mSubCond - subtitleDuration %f audioDuration %f",
2543 subtitleDuration, audioDuration);
2553 if (ret != ETIMEDOUT)
2555 AAMPLOG_WARN(
"error while calling pthread_cond_timedwait - %s", strerror(ret));
2559 pthread_mutex_unlock(&
mLock);
2568 if (subtitle && subtitle->
enabled)
2570 pthread_mutex_lock(&
mLock);
2574 #ifdef AAMP_DEBUG_FETCH_INJECT
2575 AAMPLOG_WARN(
"signalling mSubCond");
2578 pthread_mutex_unlock(&
mLock);
2612 AAMPLOG_WARN(
"EOS not seen by track: %s, skip check for rest of the tracks", track->
name);
2633 AAMPLOG_INFO(
"Last Injected fragment Position : %f", pos);
2644 pthread_mutex_lock(&
mutex);
2655 AAMPLOG_WARN(
"Found discontinuity for track %s at index: %d and position - %f",
name, start,
cachedFragment[start].position);
2659 if (++start == maxCachedFragmentsPerTrack)
2666 pthread_mutex_unlock(&
mutex);
2682 bool notifyCacheCompleted =
false;
2684 pthread_mutex_lock(&
mutex);
2692 AAMPLOG_WARN(
"## [%s] Cache is Full cacheDuration %d minInitialCacheSeconds %d, aborting caching!##",
2694 notifyCacheCompleted =
true;
2697 pthread_mutex_unlock(&
mutex);
2699 if(notifyCacheCompleted)
2712 bool isMuxedAndAudioDiscoIgnored =
false;
2731 AAMPLOG_WARN(
"muxed track audio discontinuity/EOS processing ignored!");
2732 isMuxedAndAudioDiscoIgnored =
true;
2748 bool aborted =
false;
2757 AAMPLOG_WARN(
"track[%d] Going into wait for processing discontinuity in other track!", type);
2796 AAMPLOG_WARN(
"track:%d discontinuity processing ignored! reset mTrackState to: %d!", type,
mTrackState);
2798 else if (isMuxedAndAudioDiscoIgnored && type ==
eTRACK_VIDEO)
2801 AAMPLOG_WARN(
"set muxed track audio discontinuity flag to true since video discontinuity processing succeeded.");
2833 bool bProcessFlag =
false;
2847 if (track && track->
enabled && otherTrack && otherTrack->
enabled)
2853 if (isDiscontinuitySeen)
2855 double cachedDuration = 0;
2856 bool isDiscontinuityPresent;
2859 double diff = otherTrackDuration - duration;
2860 AAMPLOG_WARN(
"Discontinuity encountered in track:%d with injectedDuration:%f and other track injectedDuration:%f, fragmentDurationSeconds:%f, diff:%f",
2862 if (otherTrackDuration >= duration)
2866 if (isDiscontinuityPresent)
2871 AAMPLOG_WARN(
"For discontinuity in track:%d, other track has injectedDuration:%f and future discontinuity, signal mCond var!",
2872 type, otherTrackDuration);
2873 pthread_mutex_lock(&
mLock);
2874 pthread_cond_signal(&
mCond);
2875 pthread_mutex_unlock(&
mLock);
2882 AAMPLOG_WARN(
"Discontinuity in track:%d does not have a discontinuity in other track (diff: %f, injectedDuration: %f, cachedDuration: %f)",
2883 type, diff, otherTrackDuration, cachedDuration);
2884 bProcessFlag =
true;
2895 AAMPLOG_WARN(
"Discontinuity in track:%d does not have a discontinuity in other track (diff is negative: %f, injectedDuration: %f)",
2896 type, diff, otherTrackDuration);
2898 bProcessFlag =
true;
2905 if(
aamp->GetBufUnderFlowStatus())
2907 AAMPLOG_WARN(
"Schedule retune since for discontinuity in track:%d other track doesn't have a discontinuity (diff: %f, injectedDuration: %f, cachedDuration: %f)",
2908 type, diff, otherTrackDuration, cachedDuration);
2919 AAMPLOG_WARN(
"Ignoring discontinuity in track:%d since other track doesn't have a discontinuity (diff: %f, injectedDuration: %f, cachedDuration: %f)",
2920 type, diff, otherTrackDuration, cachedDuration);
2927 AAMPLOG_WARN(
"Ignoring discontinuity in DASH period for track:%d",type);
2952 AAMPLOG_WARN(
"Rampdown limit reached, Limit is %d",
mRampDownLimit);
2963 if(AAMP_NORMAL_PLAY_RATE !=
aamp->
rate)
2977 bool bFound =
false;
2999 bool bFound =
false;
3060 AAMPLOG_WARN(
"Setting refreshSubtitles");
3077 pthread_mutex_lock(&
mLock);
3083 #ifdef AAMP_DEBUG_FETCH_INJECT
3084 AAMPLOG_WARN(
"waiting for cond - auxDuration %f videoDuration %f video->fragmentDurationSeconds %f",
3096 if (ret != ETIMEDOUT)
3098 AAMPLOG_WARN(
"error while calling pthread_cond_timedwait - %s", strerror(ret));
3105 AAMPLOG_WARN(
"video is null");
3107 pthread_mutex_unlock(&
mLock);
3117 bool stream4K =
false;
3145 AAMPLOG_WARN(
"4K playback disabled by User!!");
3151 if (bandwidth > maxBitrate)
3153 AAMPLOG_WARN(
"Maxbitrate (%ld) set by user is less than 4K bitrate (%ld);", maxBitrate, bandwidth);
3161 AAMPLOG_WARN(
"Ignoring display resolution check due to invalid display height 0");
3167 AAMPLOG_WARN(
"Display resolution (%d) doesn't support the 4K resolution (%d)",
aamp->
mDisplayHeight, height);
3178 AAMPLOG_INFO(
"Updated live offset for 4K stream %lf",
aamp->mLiveOffset);
3194 bool retVal =
false;
3199 AAMPLOG_INFO(
"Calling SubtitleParser::SetTextStyle(%s)", options.c_str());