Use av_packet_rescale_ts() to simplify code.