Facing issue of auto-switching segment (720p->360p) as adaptive streaming on DASH
Edit: I tried for a few days already, I am curious that, am I using a wrong way to lead the video to drop as 240p? Since no matter how I modified the codes, it still doesn't work. Should I set Bandwidth Control to my player phone as 1Mbps by Router as the testing way to lead my live video to 240p?
p.s. I am a beginner of app developing and video stream, I'd highly appreciate your kind guidance.
Github PJ link This is the GitHub project I am studying and developing. https://github.com/MayurSolanki/AdaptiveStreamingExoplayer
Issue May I ask, what components might not be fixed correctly because the player cannot automatically switch to 240p when I limited my Wifi to 1mbps for my stream-audience phone. (During a live stream, my stream server is providing stream-out by DASH with 2 tracks which are [720p ~2.6mbps] and [240p ~0.5mbps]).
Searched I have googled for a while, I saw something might be related to my issue: BandwidthMeter or some alternative setup for the ExoPlayerFactory and AdaptiveTrackSelection. Unfortunately, I still cannot find a solution for achieving my Adaptive Streaming.
Used Device Player phone: play H265 video on DASH, [LG V20, Android 8.0 (SDK26)] Broadcaster phone: stream H264 video on RTMP, [Redmi 6, Android 8.1 (SDK27)] Server: receive H264 720p live video, and encode as H265(720p/240p), [Wowza Stream Engine]
Can you try creating the player without DefaultLoadControl. You are using one of the deprecated constructors for the same, which may be causing the described ABR behavior.
Can you try creating the player without DefaultLoadControl. You are using one of the deprecated constructors for the same, which may be causing the described ABR behavior.
Thank you for your advice! I have tried the replacement of this deprecated DefaultLoadControl, however, it still cannot adopt the stream. Below is my replacement code, I would be so grateful if a suggestion or mistake pointing-out would be given for fixing it.
DefaultLoadControl.Builder defaultLoadControlBuilder = new DefaultLoadControl.Builder();
defaultLoadControlBuilder.setAllocator(defaultAllocator);
defaultLoadControlBuilder.setBufferDurationsMs(
DefaultLoadControl.DEFAULT_MIN_BUFFER_MS,
DefaultLoadControl.DEFAULT_MAX_BUFFER_MS,
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_MS,
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS
); defaultLoadControlBuilder.setTargetBufferBytes(DefaultLoadControl.DEFAULT_TARGET_BUFFER_BYTES); defaultLoadControlBuilder.setPrioritizeTimeOverSizeThresholds(DefaultLoadControl.DEFAULT_PRIORITIZE_TIME_OVER_SIZE_THRESHOLDS);
DefaultLoadControl defaultLoadControl = defaultLoadControlBuilder.createDefaultLoadControl();
Use DEFAULT_BUFFER_SEGMENT_SIZE instead of DEFAULT_VIDEO_BUFFER_SIZE for the allocator.
DefaultAllocator defaultAllocator = new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE);
You were giving very large value to the allocator at link.
Use DEFAULT_BUFFER_SEGMENT_SIZE instead of DEFAULT_VIDEO_BUFFER_SIZE for the allocator.
DefaultAllocator defaultAllocator = new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE);You were giving very large value to the allocator at link.
Thank you for your further suggestion! I changed the parameter for the allocator as you mentioned, however, the player still stuck at 720p no matter I use my router to limit the bandwidth of my player mobile as 300or500kbps. I am so helpless in this situation.
Can you also try without attaching your own LoadAllocator. Create player
player = ExoPlayerFactory.newSimpleInstance(MainActivity.this, renderersFactory, trackSelector);
Also try playing some other HLS. Example - Apple Basic 4x3 (also part of Demo Player playlist)
Is the player going into buffer-underrun (buffering)? If not, then there is sufficient bandwidth available for it to continue 720p playback. Take a detailed bugreport and check EventLogger for downstreamFormatChanged events with different HLS URLs.
adb logcat EventLogger:V *:
As @umangsaini alrady pointed out, it would be helpful to see the output of the EventLogger. Especially, the list of available track groups.
Your code setup looks more or less right as far as I can see. Please note that if you use default parameters for everything, you can often just leave out the configuration. For example the LoadControl parameter is not needed at all, because the default looks exactly the same as the one you configured.
As @umangsaini alrady pointed out, it would be helpful to see the output of the EventLogger. Especially, the list of available track groups.
Your code setup looks more or less right as far as I can see. Please note that if you use default parameters for everything, you can often just leave out the configuration. For example the LoadControl parameter is not needed at all, because the default looks exactly the same as the one you configured.
debugLog.txt Brothers, would you mind taking a look at my debug log? I tried but I don't know where is the bug. Btw, I saw that "Renderer:0 [ Group:0, adaptive_supported=N/A", is it related? Thank you.
Enviorment = LG V20 mobile, Android 8.0 (SDK26), 1mbps wifi
That's the reason actually - The two formats don't seem to be in the same DASH adaptation set. That's why ExoPlayer can't switch between them.
That's the reason actually - The two formats don't seem to be in the same DASH adaptation set. That's why ExoPlayer can't switch between them.
Is the issue caused by my setup of the DASH playback (mpd file)? here is the file. manifes.txt
Yes, exactly. It has two adaptation sets for the video formats. You either need to put both representations into one adaptation set or specify the "urn:mpeg:dash:adaptation-set-switching:2016" property to specify the other adaptation set ids to allow switching.