media icon indicating copy to clipboard operation
media copied to clipboard

missing attribute fmtp

Open Don0429 opened this issue 1 year ago • 1 comments

Version

Media3 1.3.1

More version details

How to fix this bug: image image

Devices that reproduce the issue

看上面的图

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

No

Reproduction steps

看上面的图

Expected result

看上面的图

Actual result

看上面的图

Media

看上面的图

Bug Report

  • [X] You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

Don0429 avatar Jun 13 '24 10:06 Don0429

The reason why this fails is that your RTSP Describe Response does not contain the fmtp attribute required for decoding H265 for RTSP. For ExoPlayer in streaming H265 via RTSP, it requires the information contained in the sprop-vps, sprop_pps, and sprop-pps parameters sets. Exoplayer currently requires these parameters in the Describe Response and does not read them further down the pipeline when handling the stream.

This is similar to the request to read sprop values from within the H264 bitstream. https://github.com/google/ExoPlayer/issues/10971

If you would like to test reading them from the stream, you can clone the repo and try the following changes.

  • Comment out the fmtp related check in RtspMediaTrack::generatePayloadFormat
  • Comment out the sps related checks and code in RtspMediaTrack::processH265FmtpAttribute. Instead you will add these sprop-related attributes to the RtpPayloadFormat.format variable when parsing the bitstream in RtpH265Reader
  • You will need to parse for the vps, sps and pps data in RtpH265Reader. You can use the code in H265Reader as a basis as that extracts the vps, sps, and pps data from the NAL units from the bitstream. You can update payloadFormat.format with the Format.Builder::buildUpon method after extracting the required data.
  • Comment out the line trackOutput.format(payloadFormat.format) in RtpH265Reader::createTracks. This method outputs the format onto the SampleQueue which will create the decoder. You want to postpone this method call until after you have extracted the required vps, sps and pps data.
  • Just like in H265Reader::endNalUnit, once you have extracted the required vps/sps/pps data in RtpH265Reader, you will then invoke trackOutput.format(payloadFormat.format) to put the format onto the SampleQueue to configure the decoder.

If you are successful, you are more than welcome to make a contribution to Exoplayer with these changes. We consider high quality pull requests. These should merge into the main branch. Before a pull request can be accepted you must submit a Contributor License Agreement.

I'll leave this open as an enhancement but please feel free to comment back with questions.

microkatz avatar Jun 13 '24 13:06 microkatz