bravobit / FFmpeg-Android

FFMpeg/FFprobe compiled for Android
https://bravobit.nl/
MIT License
734 stars 172 forks source link

fixing ANR on large files #128

Open alexcohn opened 4 years ago

alexcohn commented 4 years ago

see https://stackoverflow.com/q/57067507/192373

1) use StringBuilder to accumulate the output text 2) convert it to String inside doInBackground, not on Main thread

alexcohn commented 4 years ago

Actually, I don't think it's always necessary to aggregate all intermediate output lines into one huge output string. In the case the output is short, and especially if onProgress() is empty, it may be OK. But for big files, this puts too much stress on the Garbage Collector, and the info is available anyways, timely: in the overridden ExecuteBinaryResponseHandler.onProgress() callback.