-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Error when using multiple SimpleExoPlayer instances share the same Cache instances (SimpleCache) #3762
Comments
Are you creating more than one |
To clarify, I'm unclear what "same Cache instances" means. Is there more than one Cache being shared? If so, how does this work exactly? |
@ojw28 One global SimpleCache instance, and one CacheDataSourceFactory passed to create SimpleExoPlayer instance. So I suppose it is this:
|
@ojw28 Answer your question above, let me create a snippet and send you/update here later today. |
That should work. I think you'll need to provide us with a concrete way to reproduce the issue (preferably a small patch to the demo app that is able to reproduce the problem). Thanks. |
@ojw28 This issue is quite difficult to reproduce at high rate. Right now what I have in hand is: all the cach files (.v3.exo files, and the index file), the Url that have this issue and the code I used to test (simplified version, but works/fails all the time). Do you think these pieces of info can help you to investigate? |
@ojw28 Here is the repo where you can try and see the issues, works all the time (I have included the start guide in README, make sure you follow it): https://github.com/eneim/DrExo . Hope this helps ^^! |
The cached file differs from the source media in some places (see the diff below), which is why playback is failing. Unfortunately this doesn't really help to explain how you're getting into that state. I'm unable to do so, despite repeated attempts. Starting from an empty cache, do you have any idea how I might manage to reproduce actually writing the corrupt data into the cache? And are you sure this didn't occur as a result of some development version of your app that did something incorrect (e.g. multiple cache instances accessing the same directory)? |
@ojw28 just see the label bug, I guess you have found something. But even if it is not the case, I'm trying to read and log the call order of cache's methods. Hope to figure out something helpful. |
Yeah; @erdemguven found a bug that could cause corrupt data to be written into the cache. A fix will be available next week or early the week after. |
DefaultExtractorInput.SCRATCH_SPACE buffer is used to skip data by reading it into this buffer and discarding. Simultaneous use of skip methods corrupts this buffer. Normally the read data is discarded so it doesn't matter but the underlying DataSource may use the buffer too. If it's a CacheDataSource it uses this buffer to read data from upstream then write to cache. Issue: #3762 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=184502170
The fix ref'd above should resolve this issue, and will be picked up in the next release. Please let us know if you're able to reproduce, either with the current |
DefaultExtractorInput.SCRATCH_SPACE buffer is used to skip data by reading it into this buffer and discarding. Simultaneous use of skip methods corrupts this buffer. Normally the read data is discarded so it doesn't matter but the underlying DataSource may use the buffer too. If it's a CacheDataSource it uses this buffer to read data from upstream then write to cache. Issue: #3762 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=184502170
Issue description
The following Exception is thrown with I tried to use SimpleCache with multiple SimpleExoPlayer:
The term "multiple" is my assumption, as in this demo, I used a pool with a factory method that uses a fixed Cache (as factory option) to create SimpleExoPlayer instances on demand and cache for reuse. This is not always reproducible but the rate of failure is high.
When the Cache is set to null I get no error.
Link to test content
All videos are get from this link (the video/mp4 variants, not webm)
https://material.io/guidelines/motion/material-motion.html
Version of ExoPlayer being used: 2.6.1
Device(s) and version(s) of Android being used: Nexus 5X, Android 27 (8.1).
I can provide the code for various part if need. But hope the log above says something.
The text was updated successfully, but these errors were encountered: