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

getMeanAudioFormatBitrate() API from PlaybackStats return -1 for HLS Content #9175

Closed
pmaurya74 opened this issue Jul 10, 2021 · 2 comments
Closed
Assignees
Labels

Comments

@pmaurya74
Copy link

HI There,
I am using getMeanAudioFormatBitrate() API from PlaybackStats that return -1 for HLS Content.
But return correct value for progressive mp4 content.

Other than above API i used below APIs as well for HLS content (AV or Audio Only), but all returns -1 for audio bit rate .
1)onDownstreamFormatChanged. (from audio track format)
2)onLodeStared
3)onLoadCompleted
4)audioTracks.get(0).format.bitrate

Device information:
ExoPlayer version number - ExoPlayerLib/2.12.3-1.0-dev
Android version - Android 7.1.2(Amazon/mantis/mantis:6.0/NS6280/3236N:user/amz-p,release-keys)
Android device -Fire TV Stick 4K

HLS Content Logs Analysis for -1 audio bitrte:
2021-07-10 17:14:56.970 7639-7874/com.tivo.exoplayer.demo I/MediaCodecLogger: 7639.SW.audio.mp4a.bitrateInKbps = 61
2021-07-10 17:15:08.991 7639-7880/com.tivo.exoplayer.demo I/MediaCodecLogger: 7639.4K.HW.video.avc Resolution change from 0x0 to 1280x720 took = 0
2021-07-10 17:15:09.005 7639-7880/com.tivo.exoplayer.demo I/MediaCodecLogger: 7639.4K.HW.video.avc.bitrateInKbps = 688

021-07-10 17:15:12.713 7639-7639/com.tivo.exoplayer.demo I/ManagePlaybackMetrics: session end stats, URL: null stats: {"avgBandwidthMbps":3.103492,"initialPlaybackStartDelay":5811,"totalTimeMs":23533,"totalPlayingTimeMs":5723,"totalElapsedTimeMs":23533,"videoFramesDropped":0,"totalRebufferingTimeMs":11987,"profileShiftCount":2,"rebufferCount":1,"avgVideoBitrate":4.079073,"endedFor":"USER_ENDED","avgAudioBitrate":-1.0E-6,"totalTrickPlayTimeMs":0,"timeInFormats":{"0 - 720x480@2300000":2034,"2 - 1280x720@5060000":3689}}

I will send HLS url in mail . for that URL MediaCodecLogger is able to get audio bit rate but getMeanAudioFormatBitrate or other API returns -1 .

Progressive MP4 content Analysis:

3:44.366 7639-7639/com.tivo.exoplayer.demo I/ManagePlaybackMetrics: session end stats, URL: null stats: {"avgBandwidthMbps":-1.0E-6,"initialPlaybackStartDelay":6428,"totalTimeMs":10590,"totalPlayingTimeMs":4149,"totalElapsedTimeMs":10590,"videoFramesDropped":0,"totalRebufferingTimeMs":0,"profileShiftCount":0,"rebufferCount":0,"avgVideoBitrate":-1.0E-6,"endedFor":"USER_ENDED","avgAudioBitrate":0.032,"totalTrickPlayTimeMs":0,"timeInFormats":{}}

I will send url in mail but here audiobitrate value is proper for progressive mp4 url.

Request you to fix this issue in getMeanAudioFormatBitrate API for HLS content or let us know by any other callback or API we can get proper audio bitrate.
I will other url and content information in mail to dev.exoplayer@gmail.com with issue number subject.
BugReport:

bugreport-NS6280-2021-07-10-17-26-58.zip

.

@pmaurya74
Copy link
Author

I have send url and content information in mail to dev.exoplayer@gmail.com with issue number subject.
Issue #9175

christosts added a commit that referenced this issue Aug 4, 2021
For audio-only playlists, when formats are communicated to the app with
AnalyticsListener.onDownstreamFormatChanged(), the passed MediaLoadData
do not indicate this is an audio track and therefore the
PlaybackStatsListener cannot derive audio format-related information.

This change sets the main SampleStreamWrappers track type to AUDIO, if
the master playlist contains only audio variants.

Issue: #9175

#minor-release

PiperOrigin-RevId: 388676060
@christosts
Copy link
Contributor

Thank you for reporting this.

PlaybackStats.getMeanAudioFormatBitrate() returns -1 (=> C.LENGTH_UNSET) because the player cannot derive accurate audio bitrate information from the HLS playlist.

According to the HLS spec, bitrate information can be derived from the BANDWIDTH attribute of the EXT-X-STREAM-INF tag, however in most cases this refers to the aggregate bitrate of a stream and this includes video and audio. This same rule applies when audio and video are either muxed or demuxed (the playlist you provided has audio muxed with video). Considering that video bitrates are typically much higher than audio, the player assumes that BANDWIDTH information regards video bitrate and not audio.

The player uses the BANDWIDTH information for audio-only HLS playlists to derive audio bitrate. However, there was a bug and the audio bitrate was not propagated to PlaybackStats for audio-only HLS playlists. This is fixed in 4b1609d and will be included in the next release, 2.15.0.

The link provided for the progressive case: the audio stream has ICY metadata which clearly point to the audio bitrate and the player uses those correctly.

christosts added a commit that referenced this issue Aug 11, 2021
For audio-only playlists, when formats are communicated to the app with
AnalyticsListener.onDownstreamFormatChanged(), the passed MediaLoadData
do not indicate this is an audio track and therefore the
PlaybackStatsListener cannot derive audio format-related information.

This change sets the main SampleStreamWrappers track type to AUDIO, if
the master playlist contains only audio variants.

Issue: #9175

#minor-release

PiperOrigin-RevId: 388676060
@google google locked and limited conversation to collaborators Oct 9, 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