Skip to content
This repository was archived by the owner on Jan 26, 2023. It is now read-only.
/ rdk-aamp Public archive

Commit cb889c4

Browse files
aahmed878Paulpandian Mariappan
authored and
Paulpandian Mariappan
committed
DELIA-58758: [Coverity] Various medium impact issues identified in aamp - part 1
Reason for change: Coverity issues are addressed as requested from security team. Signed-off-by: Deepan Ragunathan <[email protected]> Change-Id: I3b0d426710c0baf384d5d82b084a4223e82d46ae (cherry picked from commit b5a29d7)
1 parent 4a16fec commit cb889c4

File tree

4 files changed

+33
-21
lines changed

4 files changed

+33
-21
lines changed

fragmentcollector_mpd.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#define MEDIATYPE_IMAGE "image"
8787

8888
// weights used for autio/subtitle track-selection heuristic
89-
#define AAMP_LANGUAGE_SCORE 1000000000L /**< Top priority: matching language **/
89+
#define AAMP_LANGUAGE_SCORE 1000000000UL /**< Top priority: matching language **/
9090
#define AAMP_SCHEME_ID_SCORE 100000000L /**< 2nd priority to scheme id matching **/
9191
#define AAMP_LABEL_SCORE 10000000L /**< 3rd priority to label matching **/
9292
#define AAMP_ROLE_SCORE 1000000L /**< 4th priority to role/rendition matching **/
@@ -6614,7 +6614,7 @@ std::vector<AudioTrackInfo> &ac4Tracks, std::string &audioTrackIndex)
66146614
/**< No valid representation found in this Adaptation, discard this adaptation */
66156615
score = 0;
66166616
}
6617-
AAMPLOG_INFO( "track#%d::%d - score = %d", iAdaptationSet, audioRepresentationIndex, score );
6617+
AAMPLOG_INFO( "track#%d::%d - score = %llu", iAdaptationSet, audioRepresentationIndex, score );
66186618
if( score > bestScore )
66196619
{
66206620
bestScore = score;
@@ -6627,7 +6627,7 @@ std::vector<AudioTrackInfo> &ac4Tracks, std::string &audioTrackIndex)
66276627
if (CodecType == eAUDIO_DOLBYAC4)
66286628
{
66296629
/* TODO: Cuurently current Audio track is updating only for AC4 need mechanism to update for other tracks also */
6630-
AAMPLOG_INFO( "Audio Track selected index - %s - language : %s rendition : %s - codec - %s score = %d", selectedAudioTrack.index.c_str(),
6630+
AAMPLOG_INFO( "Audio Track selected index - %s - language : %s rendition : %s - codec - %s score = %llu", selectedAudioTrack.index.c_str(),
66316631
selectedAudioTrack.language.c_str(), selectedAudioTrack.rendition.c_str(), selectedAudioTrack.codec.c_str(), bestScore );
66326632
}
66336633
return bestTrack;
@@ -12287,9 +12287,9 @@ AAMPStatusType StreamAbstractionAAMP_MPD::EnableAndSetLiveOffsetForLLDashPlayba
1228712287
stLLServiceData.targetLatency = TargetLatency*1000;
1228812288
}
1228912289
}
12290-
double latencyOffsetMin = stLLServiceData.minLatency/1000;
12291-
double latencyOffsetMax = stLLServiceData.maxLatency/1000;
12292-
double TargetLatencyWrtWallClockTime = stLLServiceData.targetLatency/1000;
12290+
double latencyOffsetMin = stLLServiceData.minLatency/(double)1000;
12291+
double latencyOffsetMax = stLLServiceData.maxLatency/(double)1000;
12292+
double TargetLatencyWrtWallClockTime = stLLServiceData.targetLatency/(double)1000;
1229312293
AAMPLOG_WARN("StreamAbstractionAAMP_MPD:[LL-Dash] Min Latency: %ld Max Latency: %ld Target Latency: %ld",(long)latencyOffsetMin,(long)latencyOffsetMax,(long)TargetLatency);
1229412294

1229512295
//Ignore Low latency setting
@@ -12366,13 +12366,13 @@ bool StreamAbstractionAAMP_MPD::GetLowLatencyParams(const MPD* mpd,AampLLDashSer
1236612366
for (unsigned iPeriod = 0; iPeriod < numPeriods; iPeriod++)
1236712367
{
1236812368
IPeriod *period = mpd->GetPeriods().at(iPeriod);
12369-
if(IsEmptyPeriod(period, mIsFogTSB))
12370-
{
12371-
// Empty Period . Ignore processing, continue to next.
12372-
continue;
12373-
}
1237412369
if(NULL != period )
1237512370
{
12371+
if(IsEmptyPeriod(period, mIsFogTSB))
12372+
{
12373+
// Empty Period . Ignore processing, continue to next.
12374+
continue;
12375+
}
1237612376
const std::vector<IAdaptationSet *> adaptationSets = period->GetAdaptationSets();
1237712377
if (adaptationSets.size() > 0)
1237812378
{

isobmff/isobmffbuffer.cpp

+20-8
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,20 @@ bool IsoBmffBuffer::getTimeScaleInternal(const std::vector<Box*> *boxes, uint32_
274274
Box *box = boxes->at(i);
275275
if (IS_TYPE(box->getType(), Box::MVHD))
276276
{
277-
timeScale = dynamic_cast<MvhdBox *>(box)->getTimeScale();
278-
ret = true;
277+
MvhdBox *mvhdBox = dynamic_cast<MvhdBox *>(box);
278+
if(mvhdBox){
279+
timeScale = mvhdBox->getTimeScale();
280+
ret = true;
281+
}
279282
}
280283
else if (IS_TYPE(box->getType(), Box::MDHD))
281284
{
282-
timeScale = dynamic_cast<MdhdBox *>(box)->getTimeScale();
283-
ret = true;
284-
foundMdhd = true;
285+
MdhdBox *mdhdBox = dynamic_cast<MdhdBox *>(box);
286+
if(mdhdBox) {
287+
timeScale = mdhdBox->getTimeScale();
288+
ret = true;
289+
foundMdhd = true;
290+
}
285291
}
286292
if (box->hasChildren())
287293
{
@@ -311,15 +317,21 @@ void IsoBmffBuffer::printBoxesInternal(const std::vector<Box*> *boxes)
311317
AAMPLOG_WARN("Offset[%u] Type[%s] Size[%u]", box->getOffset(), box->getType(), box->getSize());
312318
if (IS_TYPE(box->getType(), Box::TFDT))
313319
{
314-
AAMPLOG_WARN("****Base Media Decode Time: %lld", dynamic_cast<TfdtBox *>(box)->getBaseMDT());
320+
if(dynamic_cast<TfdtBox *>(box)) {
321+
AAMPLOG_WARN("****Base Media Decode Time: %lld", dynamic_cast<TfdtBox *>(box)->getBaseMDT());
322+
}
315323
}
316324
else if (IS_TYPE(box->getType(), Box::MVHD))
317325
{
318-
AAMPLOG_WARN("**** TimeScale from MVHD: %u", dynamic_cast<MvhdBox *>(box)->getTimeScale());
326+
if(dynamic_cast<MvhdBox *>(box)) {
327+
AAMPLOG_WARN("**** TimeScale from MVHD: %u", dynamic_cast<MvhdBox *>(box)->getTimeScale());
328+
}
319329
}
320330
else if (IS_TYPE(box->getType(), Box::MDHD))
321331
{
322-
AAMPLOG_WARN("**** TimeScale from MDHD: %u", dynamic_cast<MdhdBox *>(box)->getTimeScale());
332+
if(dynamic_cast<MdhdBox *>(box)) {
333+
AAMPLOG_WARN("**** TimeScale from MDHD: %u", dynamic_cast<MdhdBox *>(box)->getTimeScale());
334+
}
323335
}
324336

325337
if (box->hasChildren())

main_aamp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ void PlayerInstanceAAMP::SetRateInternal(float rate,int overshootcorrection)
599599
//Hack For DELIA-51318 convert the incoming rates into acceptable rates
600600
if(ISCONFIGSET(eAAMPConfig_RepairIframes))
601601
{
602-
AAMPLOG_WARN("mRepairIframes is true, setting actual rate %d for the received rate %f", getWorkingTrickplayRate(rate), rate);
602+
AAMPLOG_WARN("mRepairIframes is true, setting actual rate %f for the received rate %f", getWorkingTrickplayRate(rate), rate);
603603
rate = getWorkingTrickplayRate(rate);
604604
}
605605

priv_aamp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2409,7 +2409,7 @@ void PrivateInstanceAAMP::NotifySpeedChanged(float rate, bool changeState)
24092409
//Hack For DELIA-51318 convert the incoming rates into acceptable rates
24102410
if(ISCONFIGSET_PRIV(eAAMPConfig_RepairIframes))
24112411
{
2412-
AAMPLOG_WARN("mRepairIframes is set, sending pseudo rate %d for the actual rate %d", getPseudoTrickplayRate(rate), rate);
2412+
AAMPLOG_WARN("mRepairIframes is set, sending pseudo rate %f for the actual rate %f", getPseudoTrickplayRate(rate), rate);
24132413
SendEvent(std::make_shared<SpeedChangedEvent>(getPseudoTrickplayRate(rate)),AAMP_EVENT_ASYNC_MODE);
24142414
}
24152415
else

0 commit comments

Comments
 (0)