Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packaging/frame/mpv-export-release.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# as its frames are done with. Apply after mpv-v4l2-interrupt.patch.
--- a/video/out/gpu/libmpv_gpu.c
+++ b/video/out/gpu/libmpv_gpu.c
@@ -152,10 +152,26 @@ static bool check_format(struct render_b
@@ -155,10 +155,26 @@ static bool check_format(struct render_b
return gl_video_check_format(p->renderer, imgfmt);
}

Expand Down
6 changes: 3 additions & 3 deletions packaging/frame/mpv-v4l2-av1.patch
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[source && source->comp[0].depth > 8];
}

@@ -703,7 +704,9 @@ static void select_and_set_hwdec(struct
@@ -721,7 +722,9 @@ static void select_and_set_hwdec(struct
} else {
const AVCodecParameters *par = ctx->codec->lav_codecpar;
bool large_v4l2 = false;
Expand All @@ -29,7 +29,7 @@
for (int n = 0; n < ctx->num_attempted_hwdecs; n++) {
if (bstr_find0(ctx->attempted_hwdecs[n], "v4l2m2m") >= 0)
large_v4l2 = true;
@@ -890,12 +893,17 @@ static void init_avctx(struct mp_filter
@@ -913,12 +916,17 @@ static void init_avctx(struct mp_filter
spare += 3;
av_opt_set_int(avctx->priv_data, "capture_spare", spare, 0);
}
Expand All @@ -48,7 +48,7 @@
const AVCodecParameters *par = c->lav_codecpar;
ctx->v4l2_smallest_pool = (int64_t)par->width * par->height >= atomic_load(v4l2_refused(par));
if (ctx->v4l2_smallest_pool)
@@ -1377,7 +1385,8 @@ static void handle_err(struct mp_filter
@@ -1431,7 +1439,8 @@ static void handle_err(struct mp_filter
const AVCodecParameters *par = ctx->codec->lav_codecpar;
int64_t refused = 0;
bool smaller = false;
Expand Down
14 changes: 7 additions & 7 deletions packaging/frame/mpv-v4l2-hardware-only.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Do not start a software decoder after V4L2 fails on large VR video.
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -669,10 +669,19 @@ static void select_and_set_hwdec(struct
@@ -709,10 +709,19 @@ static void select_and_set_hwdec(struct
MP_VERBOSE(vd, "Using underlying hw-decoder '%s'\n",
ctx->hwdec.codec->name);
} else {
Expand All @@ -23,7 +23,7 @@
ctx->force_eof = true;
} else {
MP_VERBOSE(vd, "Using software decoding.\n");
@@ -755,10 +764,10 @@ static void reinit(struct mp_filter *vd)
@@ -795,10 +804,10 @@ static void reinit(struct mp_filter *vd)

bool use_hwdec = ctx->use_hwdec;
init_avctx(vd);
Expand All @@ -34,9 +34,9 @@
- } while (!ctx->avctx);
+ } while (!ctx->avctx && !ctx->force_eof);
}
}

@@ -774,6 +783,9 @@ static void init_avctx(struct mp_filter
// Wait for the first keyframe after reinit to ensure the decoder state is
@@ -820,6 +829,9 @@ static void init_avctx(struct mp_filter
m_config_cache_update(ctx->opts_cache);

mp_assert(!ctx->avctx);
Expand All @@ -46,7 +46,7 @@

const AVCodec *lavc_codec = NULL;

@@ -1369,6 +1381,8 @@ static bool send_mvc_queue(struct mp_fil
@@ -1469,6 +1481,8 @@ static bool send_mvc_queue(struct mp_fil
static int send_packet(struct mp_filter *vd, struct demux_packet *pkt)
{
vd_ffmpeg_ctx *ctx = vd->priv;
Expand All @@ -55,7 +55,7 @@
if (ctx->reopen_v4l2) {
if (!pkt)
return AVERROR_EOF;
@@ -1607,7 +1621,7 @@ static int receive_frame(struct mp_filte
@@ -1716,7 +1730,7 @@ static int receive_frame(struct mp_filte

int ret = decode_frame(vd);

Expand All @@ -64,7 +64,7 @@
// Failed hardware decoding? Try the next one, and eventually software.
struct demux_packet **pkts = ctx->sent_packets;
int num_pkts = ctx->num_sent_packets;
@@ -1626,7 +1640,7 @@ static int receive_frame(struct mp_filte
@@ -1735,7 +1749,7 @@ static int receive_frame(struct mp_filte
*/
do {
force_fallback(vd);
Expand Down
40 changes: 20 additions & 20 deletions packaging/frame/mpv-v4l2-interrupt.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# for frames that only the locking thread returns. Apply after mpv-v4l2-reset.patch.
--- a/filters/f_decoder_wrapper.c
+++ b/filters/f_decoder_wrapper.c
@@ -225,6 +225,12 @@ struct priv {
@@ -227,6 +227,12 @@ struct priv {
bool dec_thread_valid;
mp_mutex cache_lock;

Expand All @@ -15,7 +15,7 @@
// --- Protected by cache_lock.
char *cur_hwdec;
bool try_spdif;
@@ -290,8 +296,26 @@ static void thread_unlock(struct priv *p
@@ -303,8 +309,26 @@ static void thread_unlock(struct priv *p
mp_assert(p->dec_thread_lock);
p->dec_thread_lock = false;

Expand Down Expand Up @@ -43,7 +43,7 @@
}

// This resets only the decoder. Unlike a full reset(), this doesn't imply a
@@ -371,8 +395,9 @@ static void decf_destroy(struct mp_filte
@@ -397,8 +421,9 @@ static void decf_destroy(struct mp_filte

if (p->decoder) {
MP_DBG(f, "Uninit decoder.\n");
Expand All @@ -55,7 +55,7 @@
p->codec->decoder = NULL;
p->codec->decoder_desc = NULL;
}
@@ -397,9 +422,10 @@ struct mp_decoder_list *audio_decoder_li
@@ -423,9 +448,10 @@ struct mp_decoder_list *audio_decoder_li

static bool reinit_decoder(struct priv *p)
{
Expand All @@ -69,24 +69,24 @@

reset_decoder(p);
p->has_broken_packet_pts = -10; // needs 10 packets to reach decision
@@ -453,7 +479,7 @@ static bool reinit_decoder(struct priv *
@@ -487,7 +513,7 @@ static bool reinit_decoder(struct priv *
struct mp_decoder_entry *sel = &list->entries[n];
MP_VERBOSE(p, "Opening decoder %s\n", sel->decoder);

- p->decoder = driver->create(p->decf, p->codec, sel->decoder);
+ set_decoder(p, driver->create(p->decf, p->codec, sel->decoder));
if (p->decoder) {
p->codec->decoder = talloc_strdup(p, sel->decoder);
p->codec->decoder_desc = talloc_strdup(p, sel->desc && sel->desc[0] ? sel->desc : NULL);
@@ -1183,6 +1209,7 @@ static void public_f_destroy(struct mp_f
p->codec->decoder = talloc_strdup(p->codec, sel->decoder);
p->codec->decoder_desc = talloc_strdup(p->codec, sel->desc && sel->desc[0] ? sel->desc : NULL);
@@ -1268,6 +1294,7 @@ static void public_f_destroy(struct mp_f
talloc_free(p->dec_root_filter);
talloc_free(p->queue);
mp_mutex_destroy(&p->cache_lock);
+ mp_mutex_destroy(&p->decoder_lock);
}

static const struct mp_filter_info decf_filter = {
@@ -1211,6 +1238,14 @@ static void onlock_dec_thread(void *ptr)
@@ -1296,6 +1323,14 @@ static void onlock_dec_thread(void *ptr)
struct priv *p = ptr;

mp_filter_graph_interrupt(p->dec_root_filter);
Expand All @@ -100,8 +100,8 @@
+ mp_mutex_unlock(&p->decoder_lock);
}

struct mp_decoder_wrapper *mp_decoder_wrapper_create(struct mp_filter *parent,
@@ -1224,6 +1259,7 @@ struct mp_decoder_wrapper *mp_decoder_wr
// Build the multi-decoder + libavfilter merge subgraph for a stream group
@@ -1384,6 +1419,7 @@ struct mp_decoder_wrapper *mp_decoder_wr
p->public.f = public_f;

mp_mutex_init(&p->cache_lock);
Expand All @@ -111,7 +111,7 @@
p->header = src;
--- a/filters/f_decoder_wrapper.h
+++ b/filters/f_decoder_wrapper.h
@@ -98,6 +98,11 @@ struct mp_decoder {
@@ -104,6 +104,11 @@ struct mp_decoder {

// Can be set by decoder impl. on init for "special" functionality.
int (*control)(struct mp_filter *f, enum dec_ctrl cmd, void *arg);
Expand All @@ -133,7 +133,7 @@
#include <stdbool.h>

#include <libavcodec/avcodec.h>
@@ -61,6 +62,9 @@ void frame_ubwc_decoder_closed(void);
@@ -82,6 +83,9 @@ static void v4l2_note_refused(const AVCo

#include "options/m_option.h"

Expand All @@ -143,7 +143,7 @@
static void init_avctx(struct mp_filter *vd);
static void uninit_avctx(struct mp_filter *vd);

@@ -276,6 +280,12 @@ typedef struct lavc_ctx {
@@ -305,6 +309,12 @@ typedef struct lavc_ctx {
struct mp_image_pool *dr_pool;
int dr_imgfmt, dr_w, dr_h, dr_stride_align;

Expand All @@ -156,7 +156,7 @@
struct mp_decoder public;
} vd_ffmpeg_ctx;

@@ -986,6 +996,12 @@ static void init_avctx(struct mp_filter
@@ -1044,6 +1054,12 @@ static void init_avctx(struct mp_filter
if (avcodec_open2(avctx, lavc_codec, NULL) < 0)
goto error;

Expand All @@ -169,7 +169,7 @@
// Sometimes, the first packet contains information required for correct
// decoding of the rest of the stream. The only currently known case is the
// x264 build number (encoded in a SEI element), needed to enable a
@@ -1063,6 +1079,9 @@ static void uninit_avctx(struct mp_filte
@@ -1124,6 +1140,9 @@ static void uninit_avctx(struct mp_filte

const char *wrapper = ctx->avctx && ctx->avctx->codec ? ctx->avctx->codec->wrapper_name : NULL;
bool v4l2 = wrapper && strcmp(wrapper, "v4l2m2m") == 0;
Expand All @@ -179,7 +179,7 @@
avcodec_free_context(&ctx->avctx);
// Before a new session allocates its capture buffers (a seek reopens
// the decoder), so the old ones are not still kept by the converter.
@@ -1655,6 +1674,12 @@ static int receive_frame(struct mp_filte
@@ -1764,6 +1783,12 @@ static int receive_frame(struct mp_filte
if (ret == AVERROR(EAGAIN) && ctx->mvc && vd_mvc_next(ctx->mvc, &mvc_pkt))
return 0; // force retry, so send_mvc_queue() gets called

Expand All @@ -192,7 +192,7 @@
if (ctx->num_delay_queue <= ctx->max_delay_queue && ret != AVERROR_EOF)
return ret;

@@ -1764,6 +1789,17 @@ static void vd_lavc_reset(struct mp_filt
@@ -1876,6 +1901,17 @@ static void vd_lavc_reset(struct mp_filt
ctx->framedrop_flags = 0;
}

Expand All @@ -210,15 +210,15 @@
static void vd_lavc_destroy(struct mp_filter *vd)
{
vd_ffmpeg_ctx *ctx = vd->priv;
@@ -1771,6 +1807,7 @@ static void vd_lavc_destroy(struct mp_fi
@@ -1883,6 +1919,7 @@ static void vd_lavc_destroy(struct mp_fi
uninit_avctx(vd);

mp_mutex_destroy(&ctx->dr_lock);
+ mp_mutex_destroy(&ctx->interrupt_lock);
}

static const struct mp_filter_info vd_lavc_filter = {
@@ -1807,8 +1844,11 @@ static struct mp_decoder *create(struct
@@ -1919,8 +1956,11 @@ static struct mp_decoder *create(struct

ctx->public.f = vd;
ctx->public.control = control;
Expand Down
Loading