The invention relates to a multi-thread audio and video synchronization control method and
system. The method comprises the steps of establishing a demultiplexing thread, an audio and
video decoding thread and an audio and video synchronous output thread; starting the demultiplexing thread to finish the demultiplexing
processing of a transport
stream or a program
stream, respectively inserting audio and video elementary streams into tails of audio and video
elementary stream queues, and activating the audio and
video decoding thread; starting the audio and
video decoding thread to respectively decode bit streams in the audio and video
elementary stream queues, and respectively inserting
time information and audio data and image data obtained after decoding into audio and
video output queues; according to difference between a
timestamp after decoding and a local
system clock, starting the audio and video synchronous output thread, and selecting and outputting data which conforms to output time; and according to the difference between the timestamps of video and audio, conducting repetition and frame skipping
processing to video playing to enable the audio and the video to be synchronously output. The multi-thread audio and video synchronization control method and
system provided by the invention have the advantages that a large memory space is not needed for buffering data, the operating efficiency is high, the realization complexity is low and the method and the system are applicable to embedded operating systems.