opps, agree, I know this, just forget which api to use at that moment. thanks!
frame is not indeed need to be destroied after each use, av_frame_unref(frame); to reset it is just ok, I will change here. thanks.