Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 888637 - net-im/telegram-desktop need ffmpeg with libvpx
Summary: net-im/telegram-desktop need ffmpeg with libvpx
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Esteve Varela Colominas
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-12-27 13:00 UTC by xiaoming
Modified: 2023-02-22 23:03 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xiaoming 2022-12-27 13:00:21 UTC
telegram-desktop will crash when loading vp9 contents if ffmpeg emerged without libvpx.
In the source code file tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:

const AVCodec *FindDecoder(not_null<AVCodecContext*> context) {
	// Force libvpx-vp9, because we need alpha channel support.
	return (context->codec_id == AV_CODEC_ID_VP9)
		? avcodec_find_decoder_by_name("libvpx-vp9")
		: avcodec_find_decoder(context->codec_id);
}

It force libvpx-vp9, so if emerge ffmpeg without libvpx, AVCodec will be nullptr, which will cause segmentation fault.
Comment 1 Alexander Turenko 2022-12-27 13:32:09 UTC
I confirm it. Without "vpx" ffmpeg USE flag:

Thread 7 "telegram-deskto" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffdfc0a6c0 (LWP 8220)]
0x00007ffff5f2573e in avcodec_receive_frame () from /usr/lib64/libavcodec.so.58
(gdb) bt
#0  0x00007ffff5f2573e in avcodec_receive_frame () at /usr/lib64/libavcodec.so.58
#1  0x0000555556a0cb7c in FFmpeg::FrameGenerator::Impl::readNextFrame() (this=0x7fffd40070b0)
    at /var/tmp/portage-ondisk/portage/net-im/telegram-desktop-4.3.4-r1/work/tdesktop-4.3.4-full/Telegram/SourceFiles/ffmpeg/ffmpeg_frame_generator.cpp:313
#2  0x0000555556a0c4f5 in FFmpeg::FrameGenerator::Impl::renderNext(QImage, QSize, Qt::AspectRatioMode) (this=0x7fffd40070b0, storage=<incomplete type>, size=..., mode=Qt::KeepAspectRatio)
    at /var/tmp/portage-ondisk/portage/net-im/telegram-desktop-4.3.4-r1/work/tdesktop-4.3.4-full/Telegram/SourceFiles/ffmpeg/ffmpeg_frame_generator.cpp:258
#3  0x0000555556a0d333 in FFmpeg::FrameGenerator::renderNext(QImage, QSize, Qt::AspectRatioMode) (this=0x7fffd8044800, storage=<incomplete type>, size=..., mode=Qt::KeepAspectRatio)
    at /var/tmp/portage-ondisk/portage/net-im/telegram-desktop-4.3.4-r1/work/tdesktop-4.3.4-full/Telegram/SourceFiles/ffmpeg/ffmpeg_frame_generator.cpp:395
#4  0x000055555b145e97 in operator()() (__closure=0x555561488190) at /var/tmp/portage-ondisk/portage/net-im/telegram-desktop-4.3.4-r1/work/tdesktop-4.3.4-full/Telegram/lib_ui/ui/text/custom_emoji_instance.cpp:459
#5  0x000055555b14baab in operator()(void*) const (__closure=0x7fffdfc09287, passed=0x555561488190)
    at /var/tmp/portage-ondisk/portage/net-im/telegram-desktop-4.3.4-r1/work/tdesktop-4.3.4-full/Telegram/lib_crl/crl/dispatch/crl_dispatch_async.h:51
#6  0x000055555b14c4a5 in crl::details::EmptyWrapper::Invoke<crl::details::on_queue_invoke<EmptyWrapper, void (*)(void*, void (*)(void*), void*), Ui::CustomEmoji::Renderer::Renderer(Ui::CustomEmoji::RendererDescriptor&&)::<lambda()> >(void*, void (*)(void*, void (*)(void*), void*), Ui::CustomEmoji::Renderer::Renderer(Ui::CustomEmoji::RendererDescriptor&&)::<lambda()>&&)::<lambda(void*)>::<lambda(void*)> >(struct {...} &&, void *) (callable=..., argument=0x555561488190)
    at /var/tmp/portage-ondisk/portage/net-im/telegram-desktop-4.3.4-r1/work/tdesktop-4.3.4-full/Telegram/lib_crl/crl/dispatch/crl_dispatch_async.h:60
#7  0x000055555b14bb20 in operator()(void*) const (__closure=0x0, passed=0x555561488190) at /var/tmp/portage-ondisk/portage/net-im/telegram-desktop-4.3.4-r1/work/tdesktop-4.3.4-full/Telegram/lib_crl/crl/dispatch/crl_dispatch_async.h:48
#8  0x000055555b14bb54 in _FUN(void*) () at /var/tmp/portage-ondisk/portage/net-im/telegram-desktop-4.3.4-r1/work/tdesktop-4.3.4-full/Telegram/lib_crl/crl/dispatch/crl_dispatch_async.h:47
#9  0x00007ffff579793a in  () at /usr/lib64/libdispatch.so
#10 0x00007ffff3550845 in start_thread () at /lib64/libc.so.6
#11 0x00007ffff35d036c in clone3 () at /lib64/libc.so.6

It seems, the segfault occurs at attempt to display a sticker from the "Roflmoji" pack.

After rebuilding ffmpeg with the "vpx" USE flag the problem gone.

xiaoming, thank you for your report! It saves a lot of my time for trying different USE flags.
Comment 2 Erik 2023-02-22 01:46:04 UTC
*** Bug 891755 has been marked as a duplicate of this bug. ***
Comment 3 Larry the Git Cow gentoo-dev 2023-02-22 23:03:46 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=19bd77e8f59cc673936cbf52bd1eb749ddc1269f

commit 19bd77e8f59cc673936cbf52bd1eb749ddc1269f
Author:     Esteve Varela Colominas <esteve.varela@gmail.com>
AuthorDate: 2023-02-16 15:42:57 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2023-02-22 22:57:00 +0000

    net-im/telegram-desktop: Bump to 4.6.3
    
    Closes: https://bugs.gentoo.org/888637
    Closes: https://bugs.gentoo.org/891755
    Thanks-to: xiaoming <xiangluoming2015@outlook.com>
    Thanks-to: Alexander Turenko <totktonada.ru@gmail.com>
    Thanks-to: Erik <esigra@gmail.com>
    Thanks-to: Egor <egorr.berd@gmail.com>
    Signed-off-by: Esteve Varela Colominas <esteve.varela@gmail.com>
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 net-im/telegram-desktop/Manifest                   |   1 +
 net-im/telegram-desktop/metadata.xml               |   4 +-
 .../telegram-desktop/telegram-desktop-4.6.3.ebuild | 206 +++++++++++++++++++++
 3 files changed, 209 insertions(+), 2 deletions(-)