mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-11-12 22:47:15 +00:00
Invoke avcodec_receive_frame() during decoder testing
This commit is contained in:
parent
a0151fbc04
commit
2e0bd2ec28
1 changed files with 21 additions and 0 deletions
|
@ -289,6 +289,8 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM
|
|||
return false;
|
||||
}
|
||||
|
||||
// Most FFmpeg decoders process input using a "push" model.
|
||||
// We'll see those fail here if the format is not supported.
|
||||
err = avcodec_send_packet(m_VideoDecoderCtx, &m_Pkt);
|
||||
if (err < 0) {
|
||||
char errorstring[512];
|
||||
|
@ -297,6 +299,25 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM
|
|||
"Test decode failed: %s", errorstring);
|
||||
return false;
|
||||
}
|
||||
|
||||
AVFrame* frame = av_frame_alloc();
|
||||
if (!frame) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to allocate frame");
|
||||
return false;
|
||||
}
|
||||
|
||||
// A few FFmpeg decoders (h264_mmal) process here using a "pull" model.
|
||||
// Those decoders will fail here if the format is not supported.
|
||||
err = avcodec_receive_frame(m_VideoDecoderCtx, frame);
|
||||
av_frame_free(&frame);
|
||||
if (err < 0) {
|
||||
char errorstring[512];
|
||||
av_strerror(err, errorstring, sizeof(errorstring));
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Test decode failed: %s", errorstring);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((params->videoFormat & VIDEO_FORMAT_MASK_H264) &&
|
||||
|
|
Loading…
Reference in a new issue