I am working on DVRRDK 4.0 on DM8168, I am connecting the link as
CAP
|
DEI (420 output)
|
DUP (16D1 + 16CIF)
|
|----------------|
ENC DSP
In DSP, we do some processing and send the output to ARM. At first, I perform the processing in DSP using the thread that handle AlgLink_tskMain() when new data is received in DSP, but then I find that the processing time is too long and could block handling of new incoming frames, causing enc_link and live display not smooth.
So I tried to separate it to 2 thread. When a new frame_list arrive at DSP, I would enqueue a frame to Utils_QueHandle if no frame of that channel is already waiting to be processed in the queue. If a frame of that channel is already in the queue, I would add that frame to a free_list and return it using System_putLinksEmptyFrames. And another thread would get frame from the queue and process frame, and return it after processing.
In this case, I suppose at most only 1 frame for each channel is being hold by DSP and the flow becoming non-blocking, so enc_link can process properly.
The encoded frame rate reported by enc_link is right. But then I find a problem, when I playback the encoded H264 video, I see the video rolling back. For example, suppose a person is waling forward, during playback I see it walking forward and then walk backward a little bit and then forward again. It seems the frame sequence gets wrong or something.
I don't have this problem in enc or dec before I made the change in DSP. Is there anything I am doing wrongly? Thanks for any hints.