-
Notifications
You must be signed in to change notification settings - Fork 574
RTSP H265 Aggregation packet support #2413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTSP H265 Aggregation packet support #2413
Conversation
Hi @tonihei, could you please help with review and moving forward with the change? |
int endOfData = data.bytesLeft(); | ||
int currentPosition = 2; // skipping payload header (2 bytes) | ||
do { | ||
int nalUnitSize = ((data.getData()[currentPosition] & 0xFF) << 8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this equivalent to data.readUnsignedShort()?
Hi @microkatz thank you for review and comment, could you please review again? |
68d2c66
to
af67e05
Compare
I'm going to send this for internal review now. You may see some more commits being added as I make changes in response to review feedback. Please refrain from pushing any more substantive changes as it will complicate the internal review - thanks! |
Would you be able to add a test for this? I believe that you would create a file and test similar to the one in RtpH263ReaderTest. Thank you! |
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH265Reader.java
Outdated
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH265Reader.java
Outdated
Show resolved
Hide resolved
Yes, sure, I can add tests for that |
Hi @microkatz I added unit tests, could you please take a look? |
.build(); | ||
} | ||
|
||
private static void consumeFirstPacket( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All your tests only consume one packet? Is this static method needed?
If you can please just move these lines to each test.
Side note: Maybe it would be beneficial to create a test with multiple packets similar to RtpH263ReaderTest::consume_outOfOrderPackets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it make sense to keep this method to not repeat h265Reader.onReceivingFirstPacket
in every test as it seems to be an expected call before first RTP packet is consumed.
I also added test with multiple packets
.build(), | ||
/* rtpPayloadType= */ 98, | ||
/* clockRate= */ (int) MEDIA_CLOCK_FREQUENCY, | ||
/* fmtpParameters= */ ImmutableMap.of(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the RtpH265Reader does not handle reading the decoder initialization data from the stream. It requires the addition of the fmtp parameters in the rtp transport layer.
If you copied these example packets from a stream, would you be so kind as to provide the fmtp parameter data from that stream into this format data as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The payloads are just dummy data, but I've tested on the real stream and added parameters and format from the real stream.
consumeFirstPacket(h265Reader, INVALID_AP_PACKET_EXTRA_BYTE); | ||
} | ||
|
||
@Test(expected = ParserException.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than utilize the (expected = thrownexception), the style is to use assertThrows with the specific line intending to provide the error. Would you update these unit tests using the following as an example?
assertThrows(ParserException.class, () -> consumeFirstPacket(h265Reader, INVALID_AP_PACKET_EXTRA_BYTE));
); | ||
} | ||
|
||
private static RtpPacket copyPacket(RtpPacket packet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently your tests are not re-using RtpPackets across multiple unit tests so I'm not sure you need to run copyPacket? Your tests don't seem to fail if copyPacket is not executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, removed this, just added based on the the H263 implementation, but doesn't seems to be required since packet is not being modified anywhere.
ParsableByteArray operations utilized instead of manual bytes manipulation
Got read of endOfData variable in favor of check based on bytesLeft
645cd0a
to
d3d32f1
Compare
d3d32f1
to
e04c3af
Compare
…acket-support PiperOrigin-RevId: 776088856 (cherry picked from commit 5dc4d94)
Aggregation packet support for H265 RTSP added according to the specification.
The implementation is based on the assumption that DONL won't be present in the packet since
sprop-max-don-diff != 0
is not supportedFixes issue: #1008