File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -273,9 +273,14 @@ void Frontend::Task::Interactive::ask_stream([[maybe_unused]]const FFprobe& prob
273273 }
274274 #endif
275275 }
276- else if (strm_id.first == FFprobe::stream::AUDIO) {
277- stream.m_channels = probe.get_stream (strm_id.first )[strm_id.second ].channels ;
278- }
276+ else if (strm_id.first == FFprobe::stream::AUDIO) {
277+ // Only access probe stream by index when a specific stream was selected
278+ if (strm_id.second >= 0 ) {
279+ auto const & audio_streams = probe.get_stream (strm_id.first );
280+ if (static_cast <size_t >(strm_id.second ) < audio_streams.size ())
281+ stream.m_channels = audio_streams[static_cast <size_t >(strm_id.second )].channels ;
282+ }
283+ }
279284 else if (strm_id.first == FFprobe::stream::SUBTITLE) {
280285 // Nothing yet
281286 }
@@ -287,11 +292,12 @@ void Frontend::Task::Interactive::ask_stream([[maybe_unused]]const FFprobe& prob
287292 // Else we could have before a -1 and now we want specific
288293 else if (strm_map.at (strm_id.first ).count (-1 ) == 1 ) {
289294 // In which case we need to copy that -1 as if it were specific
290- auto stream_info = strm_map.at (strm_id.first )[- 1 ];
295+ auto stream_info = strm_map.at (strm_id.first )[static_cast < short >(- 1 ) ];
291296 strm_map.at (strm_id.first ).clear ();
292- for (size_t i = 0 ; i < probe.get_stream (strm_id.first ).size (); i++) {
297+ auto const & streams = probe.get_stream (strm_id.first );
298+ for (int i = 0 ; i < static_cast <int >(streams.size ()); ++i) {
293299 stream_info.m_id = i;
294- strm_map.at (strm_id.first )[i ] = stream_info;
300+ strm_map.at (strm_id.first )[static_cast < short >(i) ] = stream_info;
295301 }
296302 }
297303
You can’t perform that action at this time.
0 commit comments