Improved file duration detection by correctly tracking the last media frame's type.