xlab/android-go

App: Add asset streaming

FlorianUekermann opened this issue · 3 comments

App should offer something like GetAssetReader(name string) io.ReadCloser to allow streaming large assets. The NDK functions work like that way anyway. See #7 for why this may not be trivial.

xlab commented

Seems to be trivial, we should acquire AssetManager and wrap it within AssetReader that will manage locking (locking mux is located in nativeActivity though, called activityMux) and chunked reads (see the final version of #7).

Ah, now I get why you added that. The AssetManager is actually thread safe according to the docs. The problem is AAsset. The mutex should be in the io.ReadCloser that contains the reference to AAsset (assuming that this is indeed trivial, I'm not 100% sure about that, because I can't wrap my head around the panic I got).

xlab commented

@MaVo159
As long as

AssetManager is actually thread safe

This is ok:

The mutex should be in the io.ReadCloser

I'll leave the implementation up to you, I have nothing to test..