samiamwork / Movist

Movie Player for Mac OS X based on QuickTime & FFmpeg. (Fork of original project on Google Code as it seems to have died)
GNU General Public License v3.0
206 stars 54 forks source link

Fix crash when seeking close to end of media file #57

Closed andersm closed 5 years ago

andersm commented 5 years ago

Movist has for a long time had a problem where seeking forward when the play position was very close to the end of the file could make the app crash. The reason turned out to be that in order to flush the FFmpeg decoder buffer queue, a special statically allocated marker packet was inserted into the queue. If the queue itself was dealloc:ed when this packet was in the queue, the marker packet would be passed to av_free_packet which would then trigger the OS malloc checks.

Also lock the mutex in [PacketQueue putPacket:], because it's used everywhere else.

samiamwork commented 5 years ago

Nice! This looks great.