Repository navigation
fix: play live video whose size comes with the first keyframe - #600
Merged
Merged
Conversation
An IP camera that sends its parameter sets only in band, joined between keyframes, says nothing about its picture size before FFmpeg stops looking. MediaInfo then reported no video, so MediaFileSource made no video source, and the undecodable pictures ahead of the first keyframe stopped the player with a decoding error. hasVideo() now goes by the stream, and those pictures are passed over until the first one decodes. Refs #598
MediaReaderOptions sets the timeout, the analysis duration and the probe size of a reader, so that a camera whose keyframes come further apart than FFmpeg's 5 seconds reports its video size when it opens. Opening gets the analysis duration on top of the timeout. MediaFileSource takes a reader opened that way. Refs #598
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Live H.264 whose picture size is only known from the first keyframe now plays through
MediaFileSource:MediaInfo.hasVideo()goes by the video stream (its codec) instead of a known size, so a0x0stream still gets a video source.VideoDecoderpasses overAVERROR_INVALIDDATAuntil its first picture, so the undecodable pictures ahead of the first keyframe no longer stop the player. Once there are pictures, the error is a fault as before.MediaReaderOptionssets the timeout, the analysis duration and the probe size of aMediaReader, so a camera whose keyframes come further apart than FFmpeg's 5 seconds reports its size when it opens. Opening gets the analysis duration on top of the timeout. The newMediaFileSource(MediaReader, boolean)plays a reader opened that way.Motivation and Context
An IP camera that sends SPS/PPS only in band, joined between keyframes, gives FFmpeg no size before it stops looking ("Could not find codec parameters ... unspecified size"). The stream was then reported as having no video, and playback failed with "Decoding failed: Invalid data found when processing input".
Refs #598
Type of Change
fix)feat)Affected Modules
webrtc-mediadocsBreaking Changes (if applicable)
MediaInfo.hasVideo()is nowtruefor a video stream whose size is not known yet;getVideoWidth()/getVideoHeight()are0then.How Has This Been Tested?
Tested on:
Java version: 25
Checklist
main.docs/guideif behavior changed.CHANGELOG.md, it is generated from the commits.