Kaynağa Gözat

Fix crash on attempt to play audio from video without such stream

Ivan Savenko 1 yıl önce
ebeveyn
işleme
a273eb6413
1 değiştirilmiş dosya ile 5 ekleme ve 1 silme
  1. 5 1
      client/media/CVideoHandler.cpp

+ 5 - 1
client/media/CVideoHandler.cpp

@@ -494,7 +494,11 @@ std::pair<std::unique_ptr<ui8 []>, si64> CAudioInstance::extractAudio(const Vide
 	if (!openInput(videoToOpen))
 		return { nullptr, 0};
 	openContext();
-	openCodec(findAudioStream());
+
+	int audioStreamIndex = findAudioStream();
+	if (audioStreamIndex == -1)
+		return { nullptr, 0};
+	openCodec(audioStreamIndex);
 
 	const auto * codecpar = getCodecParameters();