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

MediaManager takes too much time to generate the media url #91

Open
kunall17 opened this issue Apr 2, 2019 · 2 comments
Open

MediaManager takes too much time to generate the media url #91

kunall17 opened this issue Apr 2, 2019 · 2 comments
Assignees
Labels

Comments

@kunall17
Copy link

kunall17 commented Apr 2, 2019

This is the tracing of a bindViewHolder in a recyclerView for displaying videos using ExoPlayer.
Where the methods to generate the URL's are taking a lot of time, which was unexpected.

A snippet of the code is here, this method is taking 20.41 ms which seems to be a lot for generating an URL.

    public static String getVideoPostTransformedUrl(String postUrl) {
        return MediaManager.get().url().
                transformation(new Transformation().streamingProfile("hd_portrait"))
                .resourceType("video").secure(true).generate(postUrl + ".m3u8");
    }

Screenshot 2019-04-02 at 4 00 34 PM

Is there something which we are doing wrong?

EDIT: Also the device from which this was is Oneplus 5

@yakirp
Copy link
Contributor

yakirp commented Apr 3, 2019

Hi @kunall17,

Can you please elaborate a bit on how you calculated the 20 millis benchmark? Is this from the profiling info directly from the bindView method or a separate dry run test?

On a cold started JVM and an idle CPU (say inside a handler.postDelayed of a few seconds with no code running in between) we observed 15-30 millis - But inside an adapter when the app is already running it’s much faster.
In out tests we used your code inside an adapter - we benched 6-7 millis for the first ‘generate()’ and under 1 for subsequent calls.

Thanks

@kunall17
Copy link
Author

Hey, sorry for the late reply.

I used Debug.startMethodTracing("..."); at the beginning of the onBindViewHolder and Debug.stopMethodTracking() at the end of the onBind.

Yes this is the results of first binds in the fragment, will bench and let you know the specifics of the later items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants