-
Notifications
You must be signed in to change notification settings - Fork 409
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
Add support for RTSP H263 #63
Conversation
Added H263 RTP Packet reader and added support for H263 playback through RTSP. Change-Id: I348cc4d8e974b5275409b816a9d52aa29f593233
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.
Please make sure you sync to the newest head in main.
P.S. Take a look at the style guide for future reference.
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java
Outdated
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Outdated
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Outdated
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Outdated
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Outdated
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Show resolved
Hide resolved
Change-Id: I987baf379ecf3ba3f387cb38f22646023739addb
Change-Id: If1f80a369b47319251e262c8f171091bb37e90c5
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Outdated
Show resolved
Hide resolved
|
||
if (pBitIsSet == true) { | ||
int startCodePayload = data.peekUnsignedByte() & 0xfc; | ||
// Packets that begin with a Picture Start Code(100000). Refer RFC4629 Section 6.1.1. |
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 have difficulty understanding here: if picture start code is 0b100000
which is 64, then it'll always fail the check startCodePayload < PICTURE_START_CODE
. Maybe you quoted a wrong RFC section?
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.
Picture start code is "100000" from msb, so it is 128. If startCodePayload is less than 128 then packet is follow-On.
@@ -168,7 +170,7 @@ public void seek(long nextRtpTimestamp, long timeUs) { | |||
private void getBufferFlagsAndResolutionFromVop(ParsableByteArray data, boolean gotResolution) { | |||
// Picture Segment Packets (RFC4629 Section 6.1). | |||
// Search for SHORT_VIDEO_START_MARKER (0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0). | |||
int currPosition = data.getPosition(); | |||
int currDataOffset = data.getPosition(); | |||
long shortHeader = data.readUnsignedInt(); |
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.
what is the reason to name this shortHeader
? It's not of type short
and I can't find reference to any 'short' in the RFC
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.
Its taken from h263 decoder. Added link for the same in javaDoc.
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Outdated
Show resolved
Hide resolved
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH263Reader.java
Show resolved
Hide resolved
@@ -190,11 +192,11 @@ private void getBufferFlagsAndResolutionFromVop(ParsableByteArray data, boolean | |||
height = (short) (144 << (sourceFormat - 2)); |
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.
Can you explain a bit here? I'm particularly lost why the shift bits are derived from a sourceFormat
. Is the related logic in the H263 spec? I can't find it in RFC4629.
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.
https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/codecs/m4v_h263/dec/src/vop.cpp;l=1128. According to this logic :
sourceFormat 2 is 176x144, sourceFormat 3 is 1762x1442, sourceFormat 4 is 17622x14422 and so on.
} | ||
|
||
if (fragmentedSampleSizeBytes == 0) { | ||
getBufferFlagsAndResolutionFromVop(data, isOutputFormatSet); |
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.
Again, if the method does not return anything, can you rename it to parseVopHeader
and specify it sets width/height/flags in the javadoc.
Change-Id: I0d728c695c9e11c5a50ef6f211bde614df4bbe71
Change-Id: I6ae45dc710245769f36130ead4077d8e9980bf54
Can you do a merge with head? I can't merge the PR internally until then. |
PiperOrigin-RevId: 455347182 (cherry picked from commit dc0e5c4)
PiperOrigin-RevId: 455347182
PiperOrigin-RevId: 455347182 (cherry picked from commit e220f53)
Added H263 RTP Packet reader and added support for H263 playback through
RTSP.
Change-Id: I348cc4d8e974b5275409b816a9d52aa29f593233