主权项 |
1. A method for processing a video in a network device that comprises a processor, the method comprising:
fetching, by the processor, from a buffer queue, a current image frame of the video; calculating, by the processor, a sampling interval of the current image frame, wherein the sampling interval is a temporal difference between a first time point at which the current image frame is sampled and a second time point at which a previous image frame of the video is sampled, wherein the previous image frame is an image frame of the video that was fetched from the buffer queue immediately before the current image frame; calculating, by the processor, a waiting time of the current image frame, wherein the waiting time is a time period between the current image frame being added into the buffer queue and the current image frame being fetched from the buffer queue; calculating, by the processor, a regulated waiting time of the current image frame based on the waiting time of the current image frame and a regulated waiting time of the previous image frame; determining, by the processor, a playing interval of the current image frame based on the regulated waiting time of the current image frame, the sampling interval of the current image frame, and a preset waiting delay; determining, by the processor, whether time elapsed since start of playback of the previous image frame is shorter than the playing interval of the current image frame; and playing, by the processor, the current image frame at a current time point if the time elapsed since the start of playback of the previous image frame is not shorter than the playing interval of the current image frame. |