Fix segfault on recording with old FFmpeg
The AVPacket fields side_data and side_data_elems were not initialized by av_packet_ref() in old FFmpeg versions (prior to [1]). As a consequence, on av_packet_unref(), side_data was freed, causing a segfault. Fixes <https://github.com/Genymobile/scrcpy/issues/707> [1]: <http://git.videolan.org/gitweb.cgi/ffmpeg.git/?p=ffmpeg.git;a=commitdiff;h=3b4026e15110547892d5d770b6b43c9e34df458f>
This commit is contained in:
parent
20b3f101a4
commit
a9c8fa305d
1 changed files with 5 additions and 0 deletions
|
@ -33,6 +33,11 @@ record_packet_new(const AVPacket *packet) {
|
|||
if (!rec) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// av_packet_ref() does not initialize all fields in old FFmpeg versions
|
||||
// See <https://github.com/Genymobile/scrcpy/issues/707>
|
||||
av_init_packet(&rec->packet);
|
||||
|
||||
if (av_packet_ref(&rec->packet, packet)) {
|
||||
SDL_free(rec);
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue