-
Notifications
You must be signed in to change notification settings - Fork 79
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
Unable to fully read images of an epub FXL #191
Comments
@johanpoirier Can you send me the EPUB on Slack? Thanks |
I couldn't reproduce the crash on my device, so I'm not sure about the stacktrace. It could be that the same input stream was read concurrently by the HTTP server, which would be a mistake. The slow rendering is caused by the fact that the images are deflated inside the archives, which means that when requesting ranges, we have to read the entry again from the start for each chunk. This can be really slow for large files (here images of ~2MB). To alleviate this issue:
|
I ran some tests with the optimizations done on the Each image of the epub have a size of ~ 1.3MB The default buffer size is The results:
So if the buffer size is greater than the image size, the image is displayed correctly. |
Thanks for the feedback Johan. So it looks like using a bigger buffer and maybe letting reading apps control its size could be useful. I can think of another optimization that could help: Since in this case the resource is read from the start to the end, we could cache an input stream to reuse it for the next byte range requests, if the range is after the input stream's current offset. At the moment each range request creates a new input stream which reads from the start for deflated resources: https://github.com/readium/r2-shared-kotlin/blob/f291944e4204b1c1288120be062f8d66cfffebc9/r2-shared/src/main/java/org/readium/r2/shared/util/archive/JavaZip.kt#L35-L45 Although the crash is still a mystery... |
@johanpoirier I implemented the solution I talked about in my last comment in this PR: readium/r2-shared-kotlin#140 Page loading is much faster although not instantaneous, and I think you shouldn't see the crash anymore because it goes through a different code path. Let me know if you find any issue. |
I tried to open a comic book packaged into a fixed layout epub but each image fails to be displayed.
The image is very slowly drawn but is stopped in the middle of the process.
The device: OnePlus One (Android 6.0.1 / Cyanogen OS / 3Go RAM).
The app: r2-testapp 2.0.0-alpha.2
The stack trace:
I can provide the epub file in private.
The text was updated successfully, but these errors were encountered: