这是indexloc提供的服务,不要输入任何密码
Skip to content

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

Conversation

ArtsemKurantsou
Copy link

@ArtsemKurantsou ArtsemKurantsou commented May 12, 2025

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 supported

Fixes issue: #1008

@ArtsemKurantsou ArtsemKurantsou marked this pull request as ready for review May 12, 2025 00:09
@ArtsemKurantsou
Copy link
Author

Hi @tonihei, could you please help with review and moving forward with the change?

@microkatz microkatz self-requested a review May 16, 2025 12:23
@microkatz microkatz self-assigned this May 16, 2025
int endOfData = data.bytesLeft();
int currentPosition = 2; // skipping payload header (2 bytes)
do {
int nalUnitSize = ((data.getData()[currentPosition] & 0xFF) << 8)
Copy link
Contributor

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()?

@ArtsemKurantsou ArtsemKurantsou requested a review from microkatz May 20, 2025 16:21
@ArtsemKurantsou
Copy link
Author

Hi @microkatz thank you for review and comment, could you please review again?

@microkatz microkatz force-pushed the rtap-h265-aggregation-packet-support branch from 68d2c66 to af67e05 Compare May 22, 2025 10:46
@microkatz
Copy link
Contributor

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!

@microkatz
Copy link
Contributor

microkatz commented May 22, 2025

@ArtsemKurantsou

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!

@ArtsemKurantsou
Copy link
Author

@ArtsemKurantsou

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!

Yes, sure, I can add tests for that

@ArtsemKurantsou
Copy link
Author

Hi @microkatz I added unit tests, could you please take a look?

.build();
}

private static void consumeFirstPacket(
Copy link
Contributor

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.

Copy link
Author

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(),
Copy link
Contributor

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?

Copy link
Author

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)
Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Author

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.

@microkatz microkatz force-pushed the rtap-h265-aggregation-packet-support branch 4 times, most recently from 645cd0a to d3d32f1 Compare June 26, 2025 09:52
@microkatz microkatz force-pushed the rtap-h265-aggregation-packet-support branch from d3d32f1 to e04c3af Compare June 26, 2025 10:08
@copybara-service copybara-service bot merged commit 5dc4d94 into androidx:main Jun 26, 2025
1 check passed
shahdDaghash pushed a commit that referenced this pull request Jul 7, 2025
…acket-support

PiperOrigin-RevId: 776088856
(cherry picked from commit 5dc4d94)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants