mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Correct FFmpeg API usage
FFmpeg docs say that you must return AVERROR_EOF from the read callback, not zero. Still, Telegram just propagates the return value from IODevice::read() call, which returns zero in case of EOF. I don't know whether this commit has any effect on the upstream build, but it fixes a bug in Debian build of Telegram, which is using FFmpeg 5.1 instead of 4.4. Still, it's also useful in the upstream, as it makes work with FFmpeg more correct.
This commit is contained in:
parent
9ac739c423
commit
ca4b5edf21
1 changed files with 7 additions and 1 deletions
|
@ -482,7 +482,13 @@ FFMpegReaderImplementation::PacketResult FFMpegReaderImplementation::readAndProc
|
|||
|
||||
int FFMpegReaderImplementation::_read(void *opaque, uint8_t *buf, int buf_size) {
|
||||
FFMpegReaderImplementation *l = reinterpret_cast<FFMpegReaderImplementation*>(opaque);
|
||||
return int(l->_device->read((char*)(buf), buf_size));
|
||||
FFMpegReaderImplementation *l = reinterpret_cast<FFMpegReaderImplementation*>(opaque);
|
||||
int ret = l->_device->read((char*)(buf), buf_size);
|
||||
switch (ret) {
|
||||
case -1: return AVERROR_EXTERNAL;
|
||||
case 0: return AVERROR_EOF;
|
||||
default: return ret;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t FFMpegReaderImplementation::_seek(void *opaque, int64_t offset, int whence) {
|
||||
|
|
Loading…
Add table
Reference in a new issue