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

Merging RTSP stream fails while RTSP alone works #577

Closed
hasan-mohammadi opened this issue Aug 13, 2023 · 3 comments
Closed

Merging RTSP stream fails while RTSP alone works #577

hasan-mohammadi opened this issue Aug 13, 2023 · 3 comments

Comments

@hasan-mohammadi
Copy link

I am trying to merge an RTSP stream along with other media sources using a MergingMediaSource, but while the RTSP stream plays correctly by itself, the video fails to render when part of the merged source.

To reproduce:

1.Create RTSP media source:
val rtspSource = RtspMediaSource.Factory().createMediaSource(mediItem)

2.Create MergingMediaSource
val mergingSource = MergingMediaSource(rtspSource, audioSource)

  1. Set merging source on ExoPlayer
  2. Video track fails to render

I have tried:

Simplifying to just RTSP + audio and just RTSP
Confirming audio, text sources merge correctly alone
It seems to be an issue specifically merging this type of RTSP stream, while other formats work fine. Please advise if I am missing anything or if this could be a bug.

Let me know if any other details would be helpful!

@microkatz
Copy link
Contributor

Hello @hasan-mohammadi,

Thank you for reporting your issue! The problem arises from how the encapsulating MergingMediaPeriod queries the RtspMediaPeriod for if it can continue loading data. It got stuck in a never-ending loop as the RtspMediaPeriod.isLoading() only checked if it's loadables finished executing, not if it had sent its RTSP SETUP/PLAY requests.

I'm working on committing a fix and will update this thread when the fix has been pushed to the main branch.

In addition, may I ask about why you are using a MergingMediaSource? A requirement is that the media being merged have the same duration. Even after this fix to allow RtspMediaSource with MergingMediaSource, you might still run into some issues in use.

@hasan-mohammadi
Copy link
Author

thank you for answering, I'm trying to add external dubb audios and multiple subtitles to the video streamed by RTSP.
considering I can change the stream protocol, which protocol is better to use for this use case with Exoplayer on older android api versions and low config devices?

copybara-service bot pushed a commit that referenced this issue Aug 30, 2023
If a RtspMediaSource is used within a combining source like MergingMediaSource, then it could become stuck in a loop of calling continueLoading when the source has not actually started loading yet.

Issue: #577
PiperOrigin-RevId: 561322900
copybara-service bot pushed a commit to google/ExoPlayer that referenced this issue Aug 30, 2023
If a RtspMediaSource is used within a combining source like MergingMediaSource, then it could become stuck in a loop of calling continueLoading when the source has not actually started loading yet.

Issue: androidx/media#577
PiperOrigin-RevId: 561322900
@microkatz
Copy link
Contributor

If the additional streams have the same duration as the RTSP video then it may still work. cf3fd1f has been pushed to the androidx/media main branch. Hopefully that commit addresses the MergingMediaSource incompatibility.

I'm going to close this issue as the commit fixed the specific problem of MergingMediaSource being incompatible with RtspMediaSource.

If you have additional queries or problems then please create a new issue.

Thank you!

microkatz added a commit to hugohlln/media that referenced this issue Sep 29, 2023
If a RtspMediaSource is used within a combining source like MergingMediaSource, then it could become stuck in a loop of calling continueLoading when the source has not actually started loading yet.

Issue: androidx#577
PiperOrigin-RevId: 561322900
@androidx androidx locked and limited conversation to collaborators Nov 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants