Skip to content
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

RtspMediaTrack absolute path (URI) for track #9183

Closed
a-blekot opened this issue Jul 12, 2021 · 4 comments
Closed

RtspMediaTrack absolute path (URI) for track #9183

a-blekot opened this issue Jul 12, 2021 · 4 comments
Assignees
Labels

Comments

@a-blekot
Copy link

public RtspMediaTrack(MediaDescription mediaDescription, Uri sessionUri) {
    checkArgument(mediaDescription.attributes.containsKey(ATTR_CONTROL));
    payloadFormat = generatePayloadFormat(mediaDescription);
    uri =
        sessionUri
            .buildUpon()
            .appendEncodedPath(castNonNull(mediaDescription.attributes.get(ATTR_CONTROL)))
            .build();
  }

If mediaDescription.attributes.get(ATTR_CONTROL) - returns absolute path (started with rtsp://) we have invalid path.

So, I have made little checking to handle this case:

  public RtspMediaTrack(MediaDescription mediaDescription, Uri sessionUri) {
    checkArgument(mediaDescription.attributes.containsKey(ATTR_CONTROL));
    payloadFormat = generatePayloadFormat(mediaDescription);
    uri = absoluteUri(sessionUri, castNonNull(mediaDescription.attributes.get(ATTR_CONTROL)));
  }

  private static Uri absoluteUri(Uri sessionUri, String trackId) {
    if (trackId.startsWith("rtsp://") || trackId.startsWith("rtsps://")) {
      return Uri.parse(trackId);
    } else {
      return sessionUri
          .buildUpon()
          .appendEncodedPath(trackId)
          .build();
    }
  }
@claincly
Copy link
Contributor

claincly commented Jul 13, 2021

It seems your camera is not accepting a URL. Or your control attribute contains an rtsp:// prefix?

@claincly
Copy link
Contributor

We will have a fix for this, thanks for pointing out!

@a-blekot
Copy link
Author

Yes, our control attribute has an absolute path (starts with rtsp://123.123.....)
Again I'm not sure, maybe our camera responses implementation does not follow RTSP standards...

@claincly
Copy link
Contributor

claincly commented Jul 14, 2021 via email

ojw28 pushed a commit that referenced this issue Jul 14, 2021
Issue: #9183

RFC2326 Section C.1.1 specifies that the URI to identify a track can be either
absolute (like rtsp://example.com/path) or relative (like "path"). Currently
we don't handle absolute URI, and this CL is to add the support.

Note though, we don't currently use the Content-Base or Content-Location
headers for the session URI.

PiperOrigin-RevId: 384649818
icbaker pushed a commit that referenced this issue Jul 21, 2021
Issue: #9183

RFC2326 Section C.1.1 specifies that the URI to identify a track can be either
absolute (like rtsp://example.com/path) or relative (like "path"). Currently
we don't handle absolute URI, and this CL is to add the support.

Note though, we don't currently use the Content-Base or Content-Location
headers for the session URI.

PiperOrigin-RevId: 384649818
@google google locked and limited conversation to collaborators Sep 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants