@@ -304,8 +304,12 @@ void SESSION::CSession::InitializePeriod()
304304 else
305305 isManualStreamSelection = streamSelectionMode == CHOOSER::StreamSelection::MANUAL;
306306
307+ const bool isDefaultAdpSet{adp == defVideoAdpSet};
308+
307309 // Get the default initial stream repr. based on "adaptive repr. chooser"
308310 CRepresentation* defaultRepr{m_reprChooser->GetRepresentation (adp)};
311+ if (isDefaultAdpSet)
312+ m_reprChooser->LogDetails (defaultRepr);
309313
310314 if (isManualStreamSelection)
311315 {
@@ -320,9 +324,9 @@ void SESSION::CSession::InitializePeriod()
320324 if (!currentRepr->isPlayable )
321325 continue ;
322326
323- const bool isDefaultRepr{adp == defVideoAdpSet && currentRepr == defaultRepr}; // meant for video only
327+ const bool isDefaultVideoRepr{isDefaultAdpSet && currentRepr == defaultRepr};
324328
325- AddStream (adp, currentRepr, isDefaultRepr , uniqueId, audioLanguageOrig);
329+ AddStream (adp, currentRepr, isDefaultVideoRepr , uniqueId, audioLanguageOrig);
326330 }
327331 }
328332 else
@@ -335,16 +339,14 @@ void SESSION::CSession::InitializePeriod()
335339 uint32_t uniqueId{adpIndex};
336340 uniqueId |= reprIndex << 16 ;
337341
338- const bool isDefaultRepr{adp == defVideoAdpSet}; // meant for video only
339-
340- AddStream (adp, defaultRepr, isDefaultRepr, uniqueId, audioLanguageOrig);
342+ AddStream (adp, defaultRepr, isDefaultAdpSet, uniqueId, audioLanguageOrig);
341343 }
342344 }
343345}
344346
345347void SESSION::CSession::AddStream (PLAYLIST::CAdaptationSet* adp,
346348 PLAYLIST::CRepresentation* initialRepr,
347- bool isDefaultRepr ,
349+ bool isDefaultVideoRepr ,
348350 uint32_t uniqueId,
349351 std::string_view audioLanguageOrig)
350352{
@@ -360,7 +362,7 @@ void SESSION::CSession::AddStream(PLAYLIST::CAdaptationSet* adp,
360362 case StreamType::VIDEO:
361363 {
362364 stream.m_info .SetStreamType (INPUTSTREAM_TYPE_VIDEO);
363- if (isDefaultRepr )
365+ if (isDefaultVideoRepr )
364366 flags |= INPUTSTREAM_FLAG_DEFAULT;
365367 break ;
366368 }
@@ -1180,6 +1182,8 @@ PLAYLIST::CAdaptationSet* SESSION::CSession::DetermineDefaultAdpSet()
11801182 CODEC::FOURCC_HEVC, CODEC::FOURCC_AV01, CODEC::NAME_AV1, CODEC::FOURCC_VP09,
11811183 CODEC::NAME_VP9, CODEC::FOURCC_AVC_, CODEC::FOURCC_H264};
11821184
1185+ CAdaptationSet* defaultAdp{nullptr }; // Default determined by codec order
1186+
11831187 for (auto & codecCC : videoCodecOrder)
11841188 {
11851189 CAdaptationSet* currAdp{nullptr };
@@ -1189,10 +1193,16 @@ PLAYLIST::CAdaptationSet* SESSION::CSession::DetermineDefaultAdpSet()
11891193 if (currAdp->GetRepresentations ().empty () || currAdp->GetStreamType () != StreamType::VIDEO)
11901194 continue ;
11911195
1192- if (CODEC::Contains (currAdp->GetCodecs (), codecCC))
1196+ if (currAdp->IsDefault ()) // Override by manifest custom parameter
1197+ {
11931198 return currAdp;
1199+ }
1200+ else if (CODEC::Contains (currAdp->GetCodecs (), codecCC) && !defaultAdp)
1201+ {
1202+ defaultAdp = currAdp;
1203+ }
11941204 }
11951205 }
11961206
1197- return nullptr ;
1207+ return defaultAdp ;
11981208}
0 commit comments