This was actually done blocking in the main UI thread and (as Internet is usually used for this) was actually introducing weird random delay after ending a recording.