Android Asynctask to process live video frames

前端 未结 2 1822
不知归路
不知归路 2020-12-31 22:21

I am using OpenCV to attempt to do some live video processing. Since the processing is fairly heavy, it delays the output frames significantly, making the live stream look

2条回答
  •  梦毁少年i
    2020-12-31 23:05

    If you're doing this on each frame, it sounds like you need a thread instead. An AsyncTask is for when you want to do a one-off activity on another thread. Here you want to do it repeatedly. Just create a thread, and when it finishes a frame have it post a message to a handler to run the post step on the UI thread. It can wait on a semaphore at the top of its loop for the next frame to be ready.

提交回复
热议问题