summaryrefslogtreecommitdiff
path: root/src/codec
diff options
context:
space:
mode:
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/ffmpeg/decoder.c5
-rw-r--r--src/codec/ffmpeg/demuxer.c1
2 files changed, 4 insertions, 2 deletions
diff --git a/src/codec/ffmpeg/decoder.c b/src/codec/ffmpeg/decoder.c
index 0462090..d3c9f41 100644
--- a/src/codec/ffmpeg/decoder.c
+++ b/src/codec/ffmpeg/decoder.c
@@ -9,6 +9,7 @@
#include "decoder.h"
#ifndef CAMU_SINK_NO_VIDEO
+#ifdef CAMU_FF_DECODER_HWACCEL
static s32 get_buffer2(AVCodecContext *context, AVFrame *pic, s32 flags)
{
struct camu_ff_decoder *av = (struct camu_ff_decoder *)context->opaque;
@@ -18,7 +19,6 @@ static s32 get_buffer2(AVCodecContext *context, AVFrame *pic, s32 flags)
return ret;
}
-#ifdef CAMU_FF_DECODER_HWACCEL
static s32 init_hwframe_context(struct camu_ff_decoder *av, AVCodecContext *context, AVBufferRef *hw_device_context)
{
AVBufferRef *hw_frames_ref;
@@ -245,9 +245,10 @@ static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *rend
#ifndef CAMU_SINK_NO_VIDEO
if (codecpar->codec_type == AVMEDIA_TYPE_VIDEO && renderer && renderer->get_buffer2) {
av->renderer = renderer;
+ // libplacebo's get_buffer2 take a really long time to discard frames on opengl + no hwaccel.
+#ifdef CAMU_FF_DECODER_HWACCEL
av->codec_context->opaque = av;
av->codec_context->get_buffer2 = get_buffer2;
-#ifdef CAMU_FF_DECODER_HWACCEL
if (av->hw_device_type != AV_HWDEVICE_TYPE_NONE) {
av->codec_context->get_format = get_hw_format;
}
diff --git a/src/codec/ffmpeg/demuxer.c b/src/codec/ffmpeg/demuxer.c
index b3e5873..5cb3ceb 100644
--- a/src/codec/ffmpeg/demuxer.c
+++ b/src/codec/ffmpeg/demuxer.c
@@ -162,6 +162,7 @@ static bool ff_demuxer_seek(struct camu_demuxer *demux, u64 pos)
al_assert(pos <= INT64_MAX);
if (pos > av->duration) pos = av->duration;
if (av->eof) {
+ // avio_flush() here probably does nothing.
avio_flush(av->io_context);
avformat_flush(av->format_context);
av->eof = false;