androidx / androidx/media

Bandwidth meter reporting wrong speeds when used with HttpLoggingInterceptor

Open
#2,743 2 comments 0 reactions 1 assignee View on GitHub

@tianyif is already working on this.

Since Aug 26, 2025.

question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Hi, we have observed an issue where ABR doesn't work for our app's debug builds.

It seems this is caused by the bandwidth meter reporting insanely fast speeds when an OkHttp HttpLoggingInterceptor is present - up to 100x than normal. As a result ABR will always choose the highest quality regardless of network connection.

I've tested it on the demo app by adding the OkHttp data source and interceptor, then observing a Bitrate Estimate field that I added on the debug text. The branch on my changes can be found here. See the difference between the "Bitrate Estimate" on the two screenshots below:

No interceptor With interceptor
Image Image

I'm not 100% sure why it happens - but my guess is the bandwidth meter doesn't factor in the time it takes interceptor to read the response. By the time transferStarted is called, the subsequent read is significantly faster since it's stored in some buffer?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.