avcodec_decode_video2:额外的字节阻止什么? [英] avcodec_decode_video2: what do the extra bytes prevent?

查看:261
本文介绍了avcodec_decode_video2:额外的字节阻止什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

avcodec_decode_video2 的文档中,它提供以下警告:

In the documentation for avcodec_decode_video2 it gives the following warning:


警告:

Warning:

输入缓冲区必须大于
实际值为FF_INPUT_BUFFER_PADDING_SIZE读取字节,因为一些优化的比特流
读取器一次读取32或64位,并且可以读取结束。输入缓冲区buf的
结束应设置为0,以确保损坏的MPEG流不会发生
超程。

The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end. The end of the input buffer buf should be set to 0 to ensure that no overreading happens for damaged MPEG streams.

如果没有实现,这会在重写过程中造成分段错误?还是可能会造成怪异的腐败?我只是好奇,因为我有腐败,我不知道这是否可能导致我的问题。

If this were not implemented would this cause segmentation faults when overreading occurs? Or would it potentially cause weird corruption? I'm just curious as I have corruption and I'm not sure if this could potentially be causing my problem.

推荐答案

它不一定会导致分段错误,但它将是未定义的行为,因为这些读者将会读取未分配的内存。这可能会使程序立即崩溃,或者工作一段时间,甚至似乎工作正常:您无法确定何时涉及未定义的行为

It wouldn't necessarily cause segmentation faults, but it would be undefined behavior, since these readers would be reading unallocated memory. This could make the program crash immediately, or work for a while, or even appear to work fine: you can never be sure when it comes to undefined behavior.

这篇关于avcodec_decode_video2:额外的字节阻止什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆