You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Merging RTSP stream fails while RTSP alone works #577
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)
Set merging source on ExoPlayer
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!
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.
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?
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.
Activity
microkatz commentedon Aug 18, 2023
Hello @hasan-mohammadi,
Thank you for reporting your issue! The problem arises from how the encapsulating
MergingMediaPeriodqueries theRtspMediaPeriodfor if it can continue loading data. It got stuck in a never-ending loop as theRtspMediaPeriod.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 commentedon Aug 19, 2023
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?
Added condition to RtspMediaPeriod.isLoading to check RtspState
Added condition to RtspMediaPeriod.isLoading to check RtspState
microkatz commentedon Sep 5, 2023
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!
Added condition to RtspMediaPeriod.isLoading to check RtspState