ffmpegdecoder: check if instance open before validating pix fmt

This commit is contained in:
itsmattkc
2022-05-22 15:30:20 -07:00
parent cab62ba5d1
commit d68cce17f6
2 changed files with 10 additions and 3 deletions
+5 -3
View File
@@ -950,9 +950,11 @@ void FFmpegDecoder::RemoveFirstFrame()
VideoParams FFmpegDecoder::GetParamsForTexture(const Decoder::RetrieveVideoParams &p)
{
if (native_pix_fmt_ == VideoParams::kFormatInvalid) {
instance_.GetFrame(working_packet_, working_frame_);
InitScaler(working_frame_, p);
av_frame_unref(working_frame_);
if (instance_.IsOpen()) {
instance_.GetFrame(working_packet_, working_frame_);
InitScaler(working_frame_, p);
av_frame_unref(working_frame_);
}
}
return VideoParams(instance_.avstream()->codecpar->width,
+5
View File
@@ -87,6 +87,11 @@ private:
bool Open(const char* filename, int stream_index);
bool IsOpen() const
{
return fmt_ctx_;
}
void Close();
/**