You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempt to play an MP4 or MKV file with an HEVC stream where the configuration record's first SPS NAL contains an 0x000003 escape sequence
Expected result
The configuration is parsed and the media plays successfully.
Actual result
HevcConfig.parse throws an exception when trying to parse the SPS because it fails to remove 0x000003 sequences. The error comes from parseH265SpsNalUnitPayload, called via parseH265SpsNalUnit:
parseH265SpsNalUnitPayload only has this single caller, while parseH265SpsNalUnit has 2: HevcConfig.parse and RtspMediaTrack.processH264FmtpAttribute. As far as I can tell, both callers pass in escaped buffers, so it should be appropriate to put the unescape in parseH265SpsNalUnit. This can be easily solved by making a copy of the input buffer, then using the existing unescapeStream routine to remove the escape sequences before proceeding to actually parse the payload.
Same thing, just with parseSpsNalUnit and parseSpsNalUnitPayload. Note there that parseSpsNalUnit is also called from H264Reader, and I think the data passed there is also escaped, I'm not positive. I don't have an H264 sample with 0x000003 in SPS conveniently on-hand, but I've seen one in the past, and I can dig it up if needed.
@rcombsparseH265SpsNalUnitPayload uses ParsableNalUnitBitArray which unescapes the data and as such there is no requirement to call unescapeStream again.
I tried playing the attached mp4 file using our demo app and it runs without throwing any exception. Can you please provide a media file which throws exception or explain more in detail on what exactly we are doing incorrectly here.
Ah, I see, I'd misinterpreted what was going on with the original sample file (it was actually #10316, which wasn't yet fixed in the version in the report I'd looked at). This does seem to be behaving fine now; apologies for the confusion!
ExoPlayer Version
2.18.0
Devices that reproduce the issue
N/A
Devices that do not reproduce the issue
N/A
Reproducible in the demo app?
Not tested
Reproduction steps
Attempt to play an MP4 or MKV file with an HEVC stream where the configuration record's first SPS NAL contains an 0x000003 escape sequence
Expected result
The configuration is parsed and the media plays successfully.
Actual result
HevcConfig.parse
throws an exception when trying to parse the SPS because it fails to remove 0x000003 sequences. The error comes fromparseH265SpsNalUnitPayload
, called viaparseH265SpsNalUnit
:ExoPlayer/library/extractor/src/main/java/com/google/android/exoplayer2/util/NalUnitUtil.java
Line 482 in 03569f9
parseH265SpsNalUnitPayload
only has this single caller, whileparseH265SpsNalUnit
has 2:HevcConfig.parse
andRtspMediaTrack.processH264FmtpAttribute
. As far as I can tell, both callers pass in escaped buffers, so it should be appropriate to put the unescape inparseH265SpsNalUnit
. This can be easily solved by making a copy of the input buffer, then using the existingunescapeStream
routine to remove the escape sequences before proceeding to actually parse the payload.Media
1-frame MP4 example attached: escape-clip.mp4.zip
Bug Report
adb bugreport
to dev.exoplayer@gmail.com after filing this issue.The text was updated successfully, but these errors were encountered: