I have a loop that decodes frames using avcodec_decode_video2(), and
am spawning threads to convert the data put into the AVFrame struct
and write it to disk. However, even though I allocated multiple
structs to hold the picture data, frames are overwriting each other:

int maxthreads = 8;

AVFrame *frameData[maxthreads];

for(i=0;i<maxthreads;i++){
        frameData[i] = avcodec_alloc_frame();
}

My loop sends a unique instance of frameData to a worker thread, which
pulls the data out, does its conversion, and writes it to disk.

This works OK if I only use one thread. If I use multiple threads, the
frames end up writing all over each other and I get 2 or 3 frames
worth of data on a single frame, always in rows.

How can I keep these AVFrame structs from interfering with one
another? I thought that allocating a unique struct for each would
isolate them from one another.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to