A system and method is provided for synchronizing the presentation of
audio data with video data. Audio transport packets are received through
a demultiplexer from a multimedia transport stream. A transport stream
synchronization manager is used to lock a system time clock, local to the
demultiplexer, to a program clock reference provided through the
multimedia transport stream. Presentation time stamps are provided with
the audio transport packets to indicate when decoded audio data is to be
output. A packetized elementary stream synchronization manager maintains
synchronization by adding or dropping audio packets from the audio
transport packets. If the packetized elementary stream manager is unable
to acquire synchronization it must defer synchronization back to the
transport stream synchronization manager. Otherwise, processed audio
packets are passed to an elementary stream synchronization manager that
attempts to synchronize the delivery of audio data through a sample rate
conversion of the audio data. If the elementary synchronization manager
is unable to acquire synchronization, it defers synchronization to the
packetized elementary stream synchronization manager.