dolphin-emu/dolphin — pull request #1345 by sgadrat (2014-10-20 09:30:43+00:00)
Title: Fix timing of AVI files dumped on Linux

Scenario

* Uses a Linux build of Dolphin-Emu.
* Emulate a game that runs at 30 FPS instead of the targetted 60 FPS.
* Start dumping frames.
* Stop dumping frames after some times.
* Play the dumped AVI file with a media player.

Expected result

* The video is played at 30 FPS

Actual result

* The video is played at 60 FPS, making it accelerated.

The patch

The timing information is set on s_scaled_frame->pts, giving precise timing information to the encoder. Frames arriving too early (less than one tick after the previous frame) are droped.

The setting of packet's timestamps and flags is done after the call to avcodec_encode_video2()
as this function resets these fields according to its documentation.