<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi,<br><br>I have one question about the usage of av_frame_ref() and av_frame_unref().<br><br>For avcodec_decode_video2(), the following url is its description:<br><br><a _src="http://ffmpeg.org/doxygen/3.1/group__lavc__decoding.html#ga3ac51525b7ad8bca4ced9f3446e96532" href="http://ffmpeg.org/doxygen/3.1/group__lavc__decoding.html#ga3ac51525b7ad8bca4ced9f3446e96532">http://ffmpeg.org/doxygen/3.1/group__lavc__decoding.html#ga3ac51525b7ad8bca4ced9f3446e96532</a><br><br>When <a class="el" href="http://ffmpeg.org/doxygen/3.1/structAVCodecContext.html#ab16d1e0c729a7b63d918d5ec027ba064" title="If non-zero, the decoded audio and video frames returned from avcodec_decode_video2() and avcodec_dec...">AVCodecContext.refcounted_frames</a>
 is set to 1, the frame is reference counted and the returned reference 
belongs to the caller. The caller must release the frame using <a class="el" href="http://ffmpeg.org/doxygen/3.1/group__lavu__frame.html#ga0a2b687f9c1c5ed0089b01fd61227108" title="Unreference all the buffers referenced by frame and reset the frame fields. ">av_frame_unref()</a> when the frame is no longer needed.<br><br>For example, avcodec_decode_video2() is used to get one decoded frame, i.e. decoded_frame. If av_frame_ref(ref_frame, decoded_frame) is invoked, how to unreference two frames? Can I use two threads to invoke av_frame_unref() to unreference two frames respectively? Is av_frame_ref() thread-safe?<br><br>Thanks!<br><br>Regards<br><br>Andrew<br></div></div><br><br><span title="neteasefooter"><p> </p></span>