Validate that the codec is functional before using it. Fixes streaming failure with VAAPI if hardware lacks codec support

This commit is contained in:
Cameron Gutman
2018-08-02 21:37:46 -07:00
parent 979ba2dab7
commit c18e99c9ec
6 changed files with 187 additions and 125 deletions
+10 -9
View File
@@ -23,15 +23,13 @@ public:
virtual void dropFrame(SDL_UserEvent* event) override;
private:
bool
chooseDecoder(
StreamingPreferences::VideoDecoderSelection vds,
SDL_Window* window,
int videoFormat,
int width, int height,
AVCodec*& chosenDecoder,
const AVCodecHWConfig*& chosenHwConfig,
IFFmpegRenderer*& newRenderer);
bool completeInitialization(AVCodec* decoder, int videoFormat, int width, int height, bool testOnly);
void reset();
static
enum AVPixelFormat ffGetFormat(AVCodecContext* context,
const enum AVPixelFormat* pixFmts);
AVPacket m_Pkt;
AVCodecContext* m_VideoDecoderCtx;
@@ -39,4 +37,7 @@ private:
const AVCodecHWConfig* m_HwDecodeCfg;
IFFmpegRenderer* m_Renderer;
SDL_atomic_t m_QueuedFrames;
static const uint8_t k_H264TestFrame[];
static const uint8_t k_HEVCTestFrame[];
};