Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2017-08-23 00:11:51 +0300
committerHendrik Leppkes <h.leppkes@gmail.com>2017-08-23 00:11:51 +0300
commit69f840e35e73e9ae4425d96fbe6740147b94b6b0 (patch)
tree1f0b752c2618e21de2f0c26047fd71858a9fcbbc
parentfa0a5044a91186ed21b858ac2b9970ff777b19df (diff)
Avoid invalid aspect ratio values for avfilter parsing
-rw-r--r--decoder/LAVVideo/Filtering.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/decoder/LAVVideo/Filtering.cpp b/decoder/LAVVideo/Filtering.cpp
index c9f078c5..eeba8b76 100644
--- a/decoder/LAVVideo/Filtering.cpp
+++ b/decoder/LAVVideo/Filtering.cpp
@@ -81,6 +81,11 @@ HRESULT CLAVVideo::Filter(LAVFrame *pFrame)
av_opt_set(m_pFilterGraph, "thread_type", "slice", AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(m_pFilterGraph, "threads", FFMAX(1, av_cpu_count() / 2), AV_OPT_SEARCH_CHILDREN);
+ // 0/0 is not a valid value for avfilter, make sure it doesn't happen
+ AVRational aspect_ratio = pFrame->aspect_ratio;
+ if (aspect_ratio.num == 0 || aspect_ratio.den == 0)
+ aspect_ratio = { 0, 1 };
+
_snprintf_s(args, sizeof(args), "video_size=%dx%d:pix_fmt=%s:time_base=1/10000000:pixel_aspect=%d/%d", pFrame->width, pFrame->height, av_get_pix_fmt_name(ff_pixfmt), pFrame->aspect_ratio.num, pFrame->aspect_ratio.den);
ret = avfilter_graph_create_filter(&m_pFilterBufferSrc, buffersrc, "in", args, nullptr, m_pFilterGraph);
if (ret < 0) {