ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Why not separate feedInputBuffer() loop and drainOutputBuffer() loop into different threads?

Open Romantic-LiXuefeng opened this issue 7 years ago • 3 comments

In my opinion, MediaCodec should be more efficient if dequeue/enqueue operations are concurrent. I have searched the MediaCodec document, not sure MediaCodec whether support to operation in multi threads. Hope you give some useful information.

Romantic-LiXuefeng avatar Jun 24 '19 10:06 Romantic-LiXuefeng

“Threading model” section of the ExoPlayer Javadoc throws light on the design. There was a discussion on threading - #4463 . Quote from this issue by @natez0r

"... The first reason was the thread safety of MediaCodec access on certain older devices (i believe Galaxy S5), we would see native crashes in the media stack if we did not create all of the Android MediaPlayer objects and do any MediaCodec interrogation (checking of codec supports main/high profile, etc...) and also release any android MediaPlayer instances."

Essentially issuing codec operations from different threads may not be safe across all the devices.

umangsaini avatar Jun 24 '19 12:06 umangsaini

@umangsaini thanks! I have test some devices, MediaCodec works fine. I am looking for Galaxy S5 to test.

Romantic-LiXuefeng avatar Jun 26 '19 01:06 Romantic-LiXuefeng

Marking as a duplicate of #5796.

ojw28 avatar Aug 02 '19 15:08 ojw28