I was getting same error, while I was playing some audio files repeatedly.
I was making a simple English to french phrase book, having 8 buttons for 8 common phrases, the audio files were very small.
On closely monitoring the log I found that there is some limitation from the increment in code cache.
After playing the audio repeatedly after some time I got this:
2019-12-10 12:37:32.561 29888-29893/com.example.gridlayout I/zygote: Do partial code cache collection, code=22KB, data=30KB
2019-12-10 12:37:32.567 29888-29893/com.example.gridlayout I/zygote: After code cache collection, code=22KB, data=30KB
2019-12-10 12:37:32.567 29888-29893/com.example.gridlayout I/zygote: Increasing code cache capacity to 128KB
On repeating further more I got this:
2019-12-10 12:37:46.008 29888-29893/com.example.gridlayout I/zygote: Do partial code cache collection, code=53KB, data=57KB
2019-12-10 12:37:46.009 29888-29893/com.example.gridlayout I/zygote: After code cache collection, code=53KB, data=57KB
2019-12-10 12:37:46.009 29888-29893/com.example.gridlayout I/zygote: Increasing code cache capacity to 256KB
And on doing even more, I got:
2019-12-10 12:38:23.596 29888-29905/com.example.gridlayout E/MediaPlayerNative: error (1, -19)
2019-12-10 12:38:23.596 29888-29888/com.example.gridlayout E/MediaPlayer: Error (1,-19)
I repeated this by patiently waiting for the short audio to complete and then play again, making sure that the cache isn't increased due to simultaneously playing over and over again.
What I inferred is that, to run the audio files which are huge, code cache needs to be increased, it does automatically to some extent and gives out error after a limit(256KB in my case). Pretty sure the cache can be increased somehow...
I experimented the robustness on my phone and it worked perfectly fine, I guess in our phones, they clear cache automatically after completion.
Try running your app on mobile instead of emulator.
My conclusion: Code cache limits the performance for sound playing. Either increase the code cache limit (I tried shallow searching, couldn't find, but search it properly, I guess you will find it somewhere), or try running it directly on your Mobile.