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

Audio only HLS/DASH/SS playbacks are not adaptive by default #1975

Closed
HungamaSurat opened this issue Oct 20, 2016 · 35 comments
Closed

Audio only HLS/DASH/SS playbacks are not adaptive by default #1975

HungamaSurat opened this issue Oct 20, 2016 · 35 comments
Assignees

Comments

@HungamaSurat
Copy link

Hi,

I have update ExoPlayer and facing some issue.
In older version, When i play audio HLS link, It was start playing with low bit-rate (low quality) and After 4 or 5 sec It was automatically playing with high bit-rate (high quality).
But in new version, It's never start playing with high bit-rate automatically.

Please provide me solution for same.

@AquilesCanta
Copy link
Contributor

Please provide all information requested in the issue template.

@HungamaSurat
Copy link
Author

HungamaSurat commented Oct 20, 2016

Hi

This is my HLS playback url which i am trying to play through new exoplayer library.
http://hungama.bc-s.cdn.bitgravity.com/cdn/_definst_/hungama/secure/audio/e/a4/amlst:20253814_,b32_a2,b64_a2,b96_a2,b128_a2,b196_a2,.mp4.smil/playlist.m3u8?e=1477388100&h=cadc72cbc1bda2359b880b94e9c569e6

You can also check both apk in android device.
ExoPlayerDemo with old library (v1.5.X) (it's updating to high quality stream after playing 10 second)
https://drive.google.com/file/d/0B-BQCZwMuQ81SWxFaXJ4NTJiYUE/view?usp=sharing

ExoPlayerDemo with new library. (Not updating to high quality stream after playing 10 second)
https://drive.google.com/file/d/0B-BQCZwMuQ81b3gtTjBrUkd3cE0/view?usp=sharing

Currently, I am using provided ExoPlayer demo application.
Please let me know if you need more details.

@HungamaSurat
Copy link
Author

Hello Exoplayer developer,

Did you check my demo apks or HLS link which i provided in last comment?
Please update me on this as soon as possible.

Thanks

@ojw28
Copy link
Contributor

ojw28 commented Nov 24, 2016

The HLS link provided gives me a http 403 (forbidden). It's likely that it requires authentication or is geo-restricted (e.g. based on IP address). Providing a stream that we're able to access will help us investigate the issue.

Is the stream audio only (i.e. no video)? If so then I think I know what's changed, and this is really a feature request to adapt audio (for DASH, SmoothStreaming and HLS) in the case that there's no video stream.

Please confirm whether the stream is audio only and if possible provide a working URL, and we'll take a look at getting this done. Thanks!

@ojw28
Copy link
Contributor

ojw28 commented Nov 24, 2016

Please also confirm exactly what "newer version" you're using. "newer version" and "older version" are not useful descriptions when filing issues. Please always state the exact version numbers used ;). The clearer and more complete the issue is, the more likely we'll look at it quickly.

@HungamaSurat
Copy link
Author

I am trying to play HLS audio here. I just checked with latest exoplayer sdk v2.1.1, but still I am facing issue with it. Below is link to testing version:
https://drive.google.com/file/d/0B-BQCZwMuQ81WmFNQzE3bjdxeEU/view?usp=sharing

And below is link to test HLS audio link, which I have integrated in demo:
http://hungcomiosta-vh.akamaihd.net/i/VideoS3/r/ms2/20673450/4/1235/Purza_,32001,64001,96001,128001,196001,.mp4.csmil/master.m3u8?hdnea=exp=1485516786~acl=/i/VideoS3/r/ms2/20673450/4/1235/*~hmac=2b5df3f5fbde1b2634dcffdaf91e6f938aee14a8758552f2520f83e42a348fe6

In older ExoPlayer sdk(v1.5.x) it was automatically switching stream based on network bandwidth with default configuration, but with newer version(v2.0.x & v2.1.1) it continue playing with single stream for default config. But when I checked by enabling random adaption mode, it switches stream but I am not sure, whether it's going in proper way or not.

So, can you please check and let me know, what is the correct way to do HLS audio streaming with latest(v2.1.1) sdk, I need to switch between available bandwidth base on network speed?

@ojw28
Copy link
Contributor

ojw28 commented Jan 2, 2017

We moved HLS behavior to be in line with what we do for DASH/SmoothStreaming in V2. For DASH/SmoothStreaming we didn't ever adapt audio only playbacks by default, and so we moved HLS behavior to be in line with that.

It's somewhat unclear whether this should be considered a bug of enhancement, so I've marked with both labels for now.

@ojw28 ojw28 changed the title HLS Player sound quility update not working in new version Audio only HLS/DASH/SS playbacks are not adaptive by default Jan 2, 2017
@HungamaSurat
Copy link
Author

Hi exoplayer team,

Is there any update on this bug? Issue is still there with latest v2.2.0 sdk.

@AquilesCanta
Copy link
Contributor

I am working on this. Sorry for the delay on the answer.

I don't have permission to access the link provided above. Is it possible for you to fix that? You can always send private links to dev.exoplayer@gmail.com.

ojw28 pushed a commit that referenced this issue Mar 15, 2017
This will allow us to make a single adaptive selection prioritizing
video selections.

Issue:#1975

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150185086
@HungamaSurat
Copy link
Author

I have mailed working streaming link as you mentioned. Please update us once you check it.

ojw28 pushed a commit that referenced this issue Mar 16, 2017
This will allow us to use the same class for Audio adaptation.

Issue:#1975

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150302561
@AquilesCanta
Copy link
Contributor

Received, thanks. Support for audio only adaptation should be available soon.

@AquilesCanta AquilesCanta self-assigned this Mar 29, 2017
ojw28 pushed a commit that referenced this issue Apr 11, 2017
When no video tracks or renderers are present, attempt audio adaptation.

Issue:#1975

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152708422
@ojw28
Copy link
Contributor

ojw28 commented Apr 11, 2017

Fixed in dev-v2. Please give it a try!

@ojw28 ojw28 closed this as completed Apr 11, 2017
@HungamaSurat
Copy link
Author

I have tried with dev-v2 and dev-v2-r2.3.1, but still issue seems to be there. No changes seems to be there in streaming. Please check demo app from below link with dev-v2:
https://drive.google.com/file/d/0B-BQCZwMuQ81alBnOUpxZ1VzMkU/view?usp=sharing

Please check and let me know. Also, let me know, if any thing needs to added in code for adaptive audio streaming.

@ojw28
Copy link
Contributor

ojw28 commented Apr 25, 2017

Please provide a stream URL rather than an apk if you're still seeing an issue. Thanks.

@HungamaSurat
Copy link
Author

@ojw28
Copy link
Contributor

ojw28 commented Apr 28, 2017

Adaptive audio is being enabled properly for the test stream in the demo app. If you look at the logging, you can see all five streams being selected:

EventLogger:     Group:0, adaptive_supported=YES_NOT_SEAMLESS [
EventLogger:       [X] Track:0, id=0, mimeType=audio/mp4a-latm, bitrate=31000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:1, id=1, mimeType=audio/mp4a-latm, bitrate=63000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:2, id=2, mimeType=audio/mp4a-latm, bitrate=96000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:3, id=3, mimeType=audio/mp4a-latm, bitrate=128000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:4, id=4, mimeType=audio/mp4a-latm, bitrate=195000, channels=2, sample_rate=44100, supported=YES
EventLogger:     ]

So I'm unclear what the issue is that you're seeing. What do you expect to happen that's not happening?

@ojw28
Copy link
Contributor

ojw28 commented Apr 28, 2017

Perhaps you've concluded that the format is not adapting because you're not seeing any logging that looks like:

EventLogger: audioFormatChanged [3.48, id=1/15, mimeType=audio/mp4a-latm, channels=2, sample_rate=44100]

This is because the five streams are so similar, they actually look identical to the audio renderer that reports these format change events. If you want to see when the format changes, you can use onDownstreamFormatChanged instead, which is triggered whenever the format changes for this use case. If you add a log line to that method in EventLogger in the demo app, you should be able to see the format changing.

@kapoorvivek
Copy link

@ojw28 Thanks, we will check.

@marcbaechinger
Copy link
Contributor

Hi Vivek

I tested with the stream you sent me with ExoPlayer v2.4.0.
I added some log statements to make track selection visible:

When testing without network throttling I see this selection:

measured effective bitrate is 25030856 so it always select the highest quality available:
195000 -> .../segment4_4_a.ts (_4_a.ts)

04-28 15:36:09.693 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: getSelectedIndex: 0
04-28 15:36:09.693 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: bitrateEstimate: 33374476
04-28 15:36:09.693 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: effectiveBitrate: 25030856
04-28 15:36:09.693 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: available formats: 5
04-28 15:36:09.694 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: check format with bitrate: 195000
04-28 15:36:09.694 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: updateSelectedTrack: 0
04-28 15:36:09.694 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: getSelectedIndex: 0
04-28 15:36:09.698 7322-7753/com.google.android.exoplayer2.demo D/adaptiveaudio: http://hungcomiosta-vh.akamaihd.net/i/VideoS3/r/ms2/20673450/4/1235/Purza_,32001,64001,96001,128001,196001,.mp4.csmil/segment4_4_a.ts
04-28 15:36:10.510 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: getSelectedIndex: 0
04-28 15:36:10.510 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: bitrateEstimate: 33374476
04-28 15:36:10.511 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: effectiveBitrate: 25030856
04-28 15:36:10.511 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: available formats: 5
04-28 15:36:10.511 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: check format with bitrate: 195000
04-28 15:36:10.511 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: updateSelectedTrack: 0
04-28 15:36:10.511 7322-7749/com.google.android.exoplayer2.demo D/adaptiveaudio: getSelectedIndex: 0
04-28 15:36:10.514 7322-7753/com.google.android.exoplayer2.demo D/adaptiveaudio: http://hungcomiosta-vh.akamaihd.net/i/VideoS3/r/ms2/20673450/4/1235/Purza_,32001,64001,96001,128001,196001,.mp4.csmil/segment5_4_a.ts

When throttling the network it selects segments for 128000 bitrate. It checks the highest quality, recognizes it's above the available bitrate, checks he next which is ok and hence selected:

128000 -> ../segment2_3_a.ts (_3_a.ts)

4-28 15:40:23.522 7322-7888/com.google.android.exoplayer2.demo D/adaptiveaudio: effectiveBitrate: 178064
04-28 15:40:23.522 7322-7888/com.google.android.exoplayer2.demo D/adaptiveaudio: available formats: 5
04-28 15:40:23.522 7322-7888/com.google.android.exoplayer2.demo D/adaptiveaudio: check format with bitrate: 195000
04-28 15:40:23.522 7322-7888/com.google.android.exoplayer2.demo D/adaptiveaudio: check format with bitrate: 128000
04-28 15:40:23.522 7322-7888/com.google.android.exoplayer2.demo D/adaptiveaudio: updateSelectedTrack: 1
04-28 15:40:23.522 7322-7888/com.google.android.exoplayer2.demo D/adaptiveaudio: getSelectedIndex: 1
04-28 15:40:23.529 7322-7891/com.google.android.exoplayer2.demo D/adaptiveaudio: http://hungcomiosta-vh.akamaihd.net/i/VideoS3/r/ms2/20673450/4/1235/Purza_,32001,64001,96001,128001,196001,.mp4.csmil/segment2_3_a.ts

@marcbaechinger
Copy link
Contributor

When playing the stream with the APK you sent I see you are using ExoPlayer 2.3.1.

Init ExoPlayerLib/2.3.1

Can you please upgrade to 2.4.0 and confirm?

@HungamaSurat
Copy link
Author

HungamaSurat commented May 11, 2017

Hi Marc,
I have mailed updated demo apk link and streaming link on dev.exoplayer@gmail.com.

We have noticed some changes in behavior of latest Exoplayer sdk. Below are our findings:

  1. Exoplayer v2 does not suppoet adaptive streaming by default. We need to change it manually(by enabling random adaption mode).
  2. When we enable random adaption mode for HLS streaming it pauses playing and resume again. It pauses for around 2 seconds, so streaming does not seems to be smooth as Exoplayer v1 version.
  3. With Exoplayer v2 random adaption mode, it switches bitrate many times. So, it streaming is not good as Exoplayer v1. Many times it goes to low bitrate stream in between. Check below logs for dev-v2 version(Logs taken for streaming link Add support for avc3 boxes in fragmented mp4 streams. #1 and track bitrrate marked in bold).
    05-11 18:43:45.140 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(4, application/x-mpegURL, null, 195000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [1], trackSelectionData = [null], mediaTimeMs = [0]
    05-11 18:43:53.060 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(0, application/x-mpegURL, null, 31000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [5000]
    05-11 18:43:55.784 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(1, application/x-mpegURL, null, 63000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [10000]
    05-11 18:44:00.785 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(2, application/x-mpegURL, null, 95000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [15000]
    05-11 18:44:15.792 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(3, application/x-mpegURL, null, 127000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [30000]
    05-11 18:44:25.789 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(1, application/x-mpegURL, null, 63000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [40000]
    05-11 18:44:30.832 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(4, application/x-mpegURL, null, 195000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [45000]
    05-11 18:44:40.790 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(3, application/x-mpegURL, null, 127000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [55000]
    05-11 18:44:45.786 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(0, application/x-mpegURL, null, 31000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [60000]
    05-11 18:44:50.785 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(3, application/x-mpegURL, null, 127000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [65000]
    05-11 18:44:55.791 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(0, application/x-mpegURL, null, 31000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [70000]
    05-11 18:45:00.743 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(3, application/x-mpegURL, null, 127000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [75000]
    05-11 18:45:05.745 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(4, application/x-mpegURL, null, 195000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [80000]
    05-11 18:45:10.750 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(3, application/x-mpegURL, null, 127000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [85000]
    05-11 18:45:15.790 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(2, application/x-mpegURL, null, 95000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [90000]
    05-11 18:45:25.745 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(4, application/x-mpegURL, null, 195000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [100000]
    05-11 18:45:35.791 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(3, application/x-mpegURL, null, 127000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [110000]
    05-11 18:45:40.785 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(4, application/x-mpegURL, null, 195000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [115000]
    05-11 18:45:45.783 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(0, application/x-mpegURL, null, 31000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [120000]
    05-11 18:45:50.786 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(3, application/x-mpegURL, null, 127000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [125000]
    05-11 18:46:00.785 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(2, application/x-mpegURL, null, 95000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [135000]
    05-11 18:46:05.792 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(3, application/x-mpegURL, null, 127000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [140000]
    05-11 18:46:10.785 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(2, application/x-mpegURL, null, 95000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [145000]
    05-11 18:46:15.789 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(1, application/x-mpegURL, null, 63000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [150000]
    05-11 18:46:20.791 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(0, application/x-mpegURL, null, 31000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [155000]
    05-11 18:46:25.749 23020-23020/com.google.android.exoplayer2.demo I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(3, application/x-mpegURL, null, 127000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [160000]

@AquilesCanta
Copy link
Contributor

Hello @hungamademo. I'll try to help as best as I can:

does not suppoet adaptive streaming by default

This is the intended behavior, so if it's not happening please file a new issue (don't forget to complete the issue template).

We need to change it manually(by enabling random adaption mode).

Note that random adaptation has only debugging purposes (as far as I know). It basically randomly chooses a variant every time a selection update is made. This is not intended to be used on production environments. However, the fact that turning it on triggers adaptations, suggests that the adaptive selection is actually being made.

Since the default bitrate (See AdaptiveTrackSelection#DEFAULT_MAX_INITIAL_BITRATE) is 800kbps, it is likely that the highest audio quality is the default every time and, unless the network bandwidth is not sufficient, adaptation will not be triggered. You should be able to test this by throttling down the network speed.

The stuttering you observe in Random adaptation may be caused by the fact that HLS requires overlapping segments downloads for adaptation (unlike DASH, for example). So, when the chunk downloader needs to choose the next segment to download, if random, it is likely that the variant gets changed, resulting in the buffered position not advancing. Let me know if you don't think this is the case.

A fast way to check adaptation is working is making sure the lowest bitrate variant is selected at first. For example, by using a low maxInitialBitrate in the AdaptiveTrackSelection.Factory you pass to the DefaultTrackSelector. Let me know if you run into any issues.

@HungamaSurat
Copy link
Author

@AquilesCanta we need to give adaptive streaming support for Audio only HLS playbacks and issue was reported for same. It was working very well with ExoPlayer v1.5.x, but with ExoPlayer v2.X, Audio only HLS playback sticks to particular bit-rate and not changing with network connectivity. We checked with ExoPlayer demo with v2.4.0 but Audio only HLS streaming is still not adaptive.

Initially loading high bitrate stream takes more time in loading, so we first need to load stream with low bitrate and then need to move for high. Please suggest way to do so with ExoPlayer v2.4.0 for Audio only HLS streams.

@ojw28
Copy link
Contributor

ojw28 commented May 15, 2017

Just recapping what we've already said in this thread:

  1. "Random adaptation mode" is for debugging purposes only, and adapts at random ignoring current network conditions. You should not be enabling this, ever, for actual playbacks. It's for testing purposes only.

  2. ExoPlayer 2.4.0 and later do support adaptive streaming by default, without the need to do anything like enabling random adaptation mode. When using the demo app, this is indicated in the logs by [X] appearing next to multiple streams such as in the sample log output below. Do you see this type of logging in your own tests, or not?

EventLogger:     Group:0, adaptive_supported=YES_NOT_SEAMLESS [
EventLogger:       [X] Track:0, id=0, mimeType=audio/mp4a-latm, bitrate=31000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:1, id=1, mimeType=audio/mp4a-latm, bitrate=63000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:2, id=2, mimeType=audio/mp4a-latm, bitrate=96000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:3, id=3, mimeType=audio/mp4a-latm, bitrate=128000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:4, id=4, mimeType=audio/mp4a-latm, bitrate=195000, channels=2, sample_rate=44100, supported=YES
EventLogger:     ]
  1. @marcbaechinger tested your streams under network variation and found that adaptation did occur. Please can you clearly explain how you're concluding that adaptation is not occurring in your testing?

There is currently no good evidence in this discussion thread that supports the claim that adaptation is not working. Our tests show that it is working. Please answer the specific questions above, else there's nothing actionable for us to do here.

@HungamaSurat
Copy link
Author

Hello @ojw28. Below are our responses:

  1. We are not going to use "Random adaptation mode". We had only used it for testing purpose as Audio only HLS streaming was not adaptive by default for v2.0.x - 2.3.x.

  2. Yes we can see tracks selected logs with ExoPlayer v2.4.0.

EventLogger: Tracks [
EventLogger:   Renderer:1 [
EventLogger:     Group:0, adaptive_supported=YES_NOT_SEAMLESS [
EventLogger:       [X] Track:0, id=0, mimeType=audio/mp4a-latm, bitrate=31000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:1, id=1, mimeType=audio/mp4a-latm, bitrate=63000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:2, id=2, mimeType=audio/mp4a-latm, bitrate=96000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:3, id=3, mimeType=audio/mp4a-latm, bitrate=128000, channels=2, sample_rate=44100, supported=YES
EventLogger:       [X] Track:4, id=4, mimeType=audio/mp4a-latm, bitrate=195000, channels=2, sample_rate=44100, supported=YES
EventLogger:     ]
EventLogger:   ]
EventLogger:   Renderer:3 [
EventLogger:     Group:0, adaptive_supported=N/A [
EventLogger:       [X] Track:0, id=1/21, mimeType=application/id3, supported=YES
EventLogger:     ]
EventLogger:   ]
EventLogger: ]
  1. As mentioned, we have tested streams again under network variation with ExoPlayer v2.4.0, but most probably it starts playback with highest bitrate track available even on slow network.
    onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(4, application/x-mpegURL, null, 195000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [1], trackSelectionData = [null], mediaTimeMs = [0]

And for network variation during streaming, it only plays tracks with lower and higher bitrate. It never adopts track with middle bitrate(Track 1,2,3 as in point 2). Please check below logs.

05-16 11:54:43.554 16214-16214/? I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(4, application/x-mpegURL, null, 195000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [1], trackSelectionData = [null], mediaTimeMs = [0]
05-16 11:55:16.537 16214-16214/? I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(0, application/x-mpegURL, null, 31000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [0]
05-16 11:58:16.701 16214-16214/? I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(4, application/x-mpegURL, null, 195000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [100000]
05-16 12:00:58.464 16214-16214/? I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(0, application/x-mpegURL, null, 31000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [95000]
05-16 12:01:59.158 16214-16214/? I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(4, application/x-mpegURL, null, 195000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [155000]
05-16 12:04:06.404 16214-16214/? I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(0, application/x-mpegURL, null, 31000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [75000]
05-16 12:05:21.737 16214-16214/? I/System.out: onDownstreamFormatChanged :: trackType = [0], trackFormat = [Format(4, application/x-mpegURL, null, 195000, null, [-1, -1, -1.0], [-1, -1])], trackSelectionReason = [3], trackSelectionData = [null], mediaTimeMs = [145000]

Also, it takes almost 40-60 seconds during track switching.

Please check this and let us know your response. Also, let us know if we need to do any changes in demo app for resolving this issue.

@ojw28
Copy link
Contributor

ojw28 commented May 22, 2017

So playback is adaptive, and your issues are actually:

  1. The initial selection is different to what it used to be.
  2. Adaptation is too slow during playback.

Tackling each of these:

  • Make sure you're using a singleton instance of BandwidthMeter like the demo app does. This means that for all but the first playback, the bandwidth estimate derived from previous playbacks will be carried over to make the initial selection for the next playback. For the very first playback we have no bandwidth information, and so make the selection using an assumed bandwidth (800kbit/s by default). You are most likely instantiating an AdaptiveTrackSelection.Factory somewhere in your code. You can pass a different assumed bandwidth value through the 8-argument constructor if 800kbit/s is too high for your use case, which will result in a different initial selection, and hence solve this problem. It is true that basing initial selection on an assumed bandwidth is a change in behavior from earlier versions of ExoPlayer, which simply selected the first variant in the master playlist.
  • For slow adaptation, I'd guess that the way you're simulating the bandwidth restriction is not indicative of what real networks do. I'd suggest instrumenting your application so that you can see how adaptation is performing for real users under real conditions.

@TarifHatoum
Copy link

hi AquilesCanta, is there a way to press default for example to make the player adaptive like the old exoplayer without selecting any bitrates manually ?

@AquilesCanta
Copy link
Contributor

@Tarif-Hatoum, could you explain a bit better?

ExoPlayer is, in most cases, adaptive by default. Are you speaking about the demo app? What does the media you are playing look like? If the media is HLS/DASH/SS, and provides multiple variants, it should be adaptive by default.

@TarifHatoum
Copy link

TarifHatoum commented Jul 12, 2017 via email

@AquilesCanta
Copy link
Contributor

The demo app should be adaptive between all supported "bitrates" by default. Unless there are some video/audio bitrates, along with audio only ones, in which case it will only be adaptive between the ones that contain video.

@TarifHatoum
Copy link

TarifHatoum commented Jul 12, 2017 via email

@TarifHatoum
Copy link

TarifHatoum commented Jul 13, 2017 via email

@AquilesCanta
Copy link
Contributor

The demo app is not adaptive unless we enable the adaptive checkbox

This should not be the case. But according to what you describe, it is most likely not. If this is happening, please report an issue as this is a bug (don't forget to include all the information required in the issue template).

I guess that with "adaptive checkbox" you mean "default checkbox". The default checkbox provides the default behavior, which means it is what you'll get if you don't manually modify it (for example, by setting overrides). If you have manaully set overrides, you can call selector.clearSelectionOverrides(rendererIndex); which is exactly what the demo app does when you select the default checkbox. If you open the demo app (without modifications) and play an adaptive stream, and press default, it will not do anything. As a matter of fact, the "Default" radio button should already be selected.

Just in case, It's worth mentioning again: "Enable random adaptation" just makes the player jump randomly between the selected tracks in the stream. It is not intended for use in production environment. If pressing that makes the app change resolution, then it means the app is already "being adaptive".

@TarifHatoum
Copy link

TarifHatoum commented Jul 13, 2017 via email

@ojw28
Copy link
Contributor

ojw28 commented Jul 13, 2017

@Tarif-Hatoum - For audio only streams, the demo app is adaptive by default, without you having to select any kind of check box. It should be clear from the logging that multiple audio streams are being selected as part of an adaptive selection (look for [X] marks next to multiple audio tracks in the logs, as can be seen in examples further up in this issue thread). You do not have to do anything to turn this functionality on.

I'm going to lock this issue, since it's really just getting noisy at this point and the information we need to help has not been provided. If you believe audio only streams are not being adapted by default in the demo app, please report this as a new issue, including a proper bug report (or at least logging output) and the test stream for which adaptive audio is not being enabled. Thanks.

@google google locked and limited conversation to collaborators Jul 13, 2017
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

6 participants