Skip to content

[video_player] Fix crash when videoTrack has zero-duration minFrameDuration - #12796

Merged
auto-submit[bot] merged 3 commits into
flutter:mainfrom
Dennisaurus-Rex:video-player-ios-fix
Oct 8, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:mainfrom
Dennisaurus-Rex:video-player-ios-fix

Conversation

@Dennisaurus-Rex

@Dennisaurus-Rex Dennisaurus-Rex commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes a crash on iOS caused by a zero-duration frame duration. When creating the AVMutableVideoComposition a check is made against CMTIME_IS_VALID but this doesn't guard against a frame duration of 0. I just added one more check to make sure the frame duration is > 0.

Part of flutter/flutter#151031

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@google-cla

google-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a crash in FVPVideoPlayer.m by ensuring that videoTrack.minFrameDuration is greater than zero before assigning it to videoComposition.frameDuration. The reviewer suggested using CMTimeCompare instead of CMTimeGetSeconds to compare CMTime structures, which is more idiomatic and avoids potential precision issues.

@Dennisaurus-Rex Dennisaurus-Rex changed the title Fix crash when videoTrack has zero-duration minFrameDuration [video_player] Fix crash when videoTrack has zero-duration minFrameDuration Sep 9, 2026
@Dennisaurus-Rex
Dennisaurus-Rex force-pushed the video-player-ios-fix branch 2 times, most recently from 375057e to 3101f31 Compare September 9, 2026 11:53
@elliette elliette added the triage-ios Should be looked at in iOS triage label Sep 22, 2026
@Dennisaurus-Rex
Dennisaurus-Rex force-pushed the video-player-ios-fix branch 2 times, most recently from 5d54d93 to cc551c5 Compare September 23, 2026 09:17

@LouiseHsu LouiseHsu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flutter/flutter#151031 was originally filed for a different exception, video composition must have a positive renderSize. The crash this PR fixes was commented later in the thread. Could you change Fixes to Part of so the issue stays open for the renderSize case?


/// Returns true if the given CMTime is valid and strictly positive.
BOOL FVPFrameDurationIsValid(CMTime frameDuration);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Rather than adding a free function to the FVPVideoPlayer class header, could this go next to FVPGetStandardizedTrackTransform in AVAssetTrackUtils.h / AVAssetTrackUtils.m? That's where the other AVAssetTrack helpers live, and we already import that header.

## 2.12.1

* Fixes crash when `videoTrack.minFrameDuration` is zero.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 2.12.1
* Fixes a crash when a video track reports a zero `minFrameDuration`.
* Updates minimum supported SDK version to Flutter 3.41/Dart 3.11.

@LouiseHsu LouiseHsu added the CICD Run CI/CD label Oct 6, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Oct 7, 2026
@Dennisaurus-Rex

Copy link
Copy Markdown
Contributor Author

I removed the NEXT section since it was already merged with the 2.12.1 release notes to fix the CHANGELOG validation in repo_checks. Could you re-add the CICD label when you get a chance, @LouiseHsu? 😊

@LouiseHsu LouiseHsu added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Oct 8, 2026
@auto-submit
auto-submit Bot merged commit 5d34573 into flutter:main Oct 8, 2026
14 checks passed
jmagman pushed a commit to jmagman/flutter that referenced this pull request Oct 9, 2026
flutter/packages@54706bd...d8d9e97

2026-10-09 [email protected] [pigeon] Reject unsupported native
interop features and fix generated code that doesn't compile
(flutter/packages#13153)
2026-10-09 [email protected] [material_ui] Fix
ExpansionTile WidgetSpan semantics assertion (flutter/packages#12765)
2026-10-08 [email protected] [in_app_purchase_storekit] Complete
StoreKit 2 `finish` when the transaction is not found
(flutter/packages#13037)
2026-10-08 [email protected] [video_player] Fix crash when
videoTrack has zero-duration minFrameDuration (flutter/packages#12796)
2026-10-08 [email protected]
[google_maps_flutter_platform_interface] Add map background color
configuration (flutter/packages#13014)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
flutter/packages@54706bd...d8d9e97

2026-10-09 [email protected] [pigeon] Reject unsupported native
interop features and fix generated code that doesn't compile
(flutter/packages#13153)
2026-10-09 [email protected] [material_ui] Fix
ExpansionTile WidgetSpan semantics assertion (flutter/packages#12765)
2026-10-08 [email protected] [in_app_purchase_storekit] Complete
StoreKit 2 `finish` when the transaction is not found
(flutter/packages#13037)
2026-10-08 [email protected] [video_player] Fix crash when
videoTrack has zero-duration minFrameDuration (flutter/packages#12796)
2026-10-08 [email protected]
[google_maps_flutter_platform_interface] Add map background color
configuration (flutter/packages#13014)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: video_player platform-ios platform-macos triage-ios Should be looked at in iOS triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants