Dear all:
    I want to split av_read_frame() and avcodec_decode_video2() in to
different thread so I need to put a queue behind them. av_read_frame() read
a packet then put the packet into queue, avcodec_decode_video2() read a
packet from the queue then decode.
    But sometimes the decoded frames may contain rubbish, it's random. So I
think that AVPacket shares its data memory and overwrite by somebody before
I decode it. The following code like this:
         1. av_read_frame(&packet);
         2.     av_dup_packet(&packet);
         3.     AVPacket *newPakcet = av_malloc(sizeof(AVPacket));
         4.     *newPacket = packet;
         5.  put_queue(packet);
         6.  get_queue(&packet); (Another thread)
         7.  avcodec_decode_video2(packet, &frame);
         8.  show frame;
    Is there any mistake I took on these codes? Thanks very much.

Sincerely
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to