Stagefright makes multiple HTTP requests for the same audio file.

I work with a application that produces audio. The way the application works is that a request are done to a server where the request is handled and then a redirect is done to point to where the audio can be found (and then streamed back to the (often browser) where the initial request came from).
Many users are browsing the web through mobiles these days and lately I've discovered that there's some issues with Android's audio playback in their browsers and I'm thinking it can be Stagefright that are the "bad" component, or that I don't supply Stagefright with the correct information which makes it behave bad.

Why I believe Stagefright is behaving bad is because one of the user-agents used are "stagefright/1.2 (Linux;Android 4.4.2)" and seen in the access logs of the servers, on to the problem:
It makes between 1 (which is what I expect) up to a couple of hundreds of requests for the same audio file.
When I connect a android device through a proxy server to see the requests made from the device, I can confirm this behavior and determine a pattern on how the device is making the requests.
The requests is done in the following pattern:
Request 1: trying to determine where the audio file can be found. (Normal)
Request 2: fetching the audio file, which is pointed out by the redirect. (This request is successful, the whole audio file is transferred (at least through the proxy) to the device).

If this is done once, everything works as expected, but when the pattern repeats a number of times (1- hundreds) it causes the audio file to load very slowly. I have no idea why this occurs, I have tested to give different headers and http status codes back in the answer that contains the location header (the redirect) without success.

I have tried to look at the source code for where Stagefright are fetching the audio file, but I have not found the correct place.

Basically, I'm looking for a way to make Stagefright (android in general) happy with the first response I'm giving it so it doesn't have to fetch the same audio file 2 or more times in a row.

Show Accepted Answer

Guest Quick Reply (No URL, BBcode or HTML)

Last post by orn.enrique
27 minutes ago
Last post by wbatz
3 hours ago
Last post by mbruen
4 hours ago
Last post by monahan.reagan
1 hour ago
Last post by maddison.grady
3 hours ago
Last post by bell29
4 hours ago
Last post by nora44
4 hours ago