How to send data from one AsyncTask to another AsyncTask?[video system]
-
21-12-2019 - |
Question
I am trying to capture the audio data and video data separately, and to encode/mux them into a .mp4 file. For audio recording and video encoding both are time-costing job, I open two AsyncTasks for them.
Here is the problem, I need to send the data of audio recording task to the video encoding task. But I didn't find the stuff about communication between AsynTasks.
Can anyone give me a hint? Thank you!
Solution
MediaCodec API is already async, you submit input data in one method and check for data readiness in another
OTHER TIPS
Not aware of any defined communication mechanism between Async Tasks. But one of the Async tasks can write the data it needs to pass to a common object and the other AsyncTask can poll for it at regular intervals.
you can in the onPostExecute(Result) of the first asynctask launch the second asynctask