lavc: rework handling of refcounted_frames=0