SDL Newbie questions: Audio latency and YUV Overlays

** I am not on the list, so please cc me any replies! Thanks. ***

Hi eveybody,

I am busy trying to write my first real SDL app, a streaming video
player. I have the framework finished, and working well, but have the
following two problems:

  1. Audio latency:
    I keep the audio playing continuously. Whenever the audio callback
    fetches more data, I check the timestamp of the audio being played, and
    ensure that the same video frame is displayed. Unfortunately, the audio
    plays about 0.5s after the video. When I check the size field in
    SDL_AudioSpec, it is 1024, or a delay of about 0.05s. Is there any way
    to accurately determine the latency between the audio being fetched, and
    played?

  2. YUV Overlay:
    The hardware accelerated YUV overlay works great, but when run on a
    machine without HW acceleration (ATI Mach-64 with standard Mandrake 8.1
    drivers), only the first 4 pixels of the image are rendered, in the top
    left hand corner of the display! The pixels do scale correctly when the
    window is resized, but still only the first four pixels are rendered
    (just larger).

Any help/hints would be greatly appreciated.

Thanks,

-justin

For audio latency, check out the changes to SDL that I made for
mpeg4ip. If you look at the callback function in mpeg4ip/player/src/audio.cpp,
(CAudioCallback::audio_callback), I’ve added an SDL that will get the audio
buffer delay - it works for just OSS (linux). You can then track the changes
through to SDL.

If you add any more OS’s, let me know.

http://www.mpeg4ip.net (mpeg4ip is a streaming audio/video system based on
mpeg4).

Bill May

Justin Schoeman wrote:> ** I am not on the list, so please cc me any replies! Thanks. ***

Hi eveybody,

I am busy trying to write my first real SDL app, a streaming video
player. I have the framework finished, and working well, but have the
following two problems:

  1. Audio latency:
    I keep the audio playing continuously. Whenever the audio callback
    fetches more data, I check the timestamp of the audio being played, and
    ensure that the same video frame is displayed. Unfortunately, the audio
    plays about 0.5s after the video. When I check the size field in
    SDL_AudioSpec, it is 1024, or a delay of about 0.05s. Is there any way
    to accurately determine the latency between the audio being fetched, and
    played?

  2. YUV Overlay:
    The hardware accelerated YUV overlay works great, but when run on a
    machine without HW acceleration (ATI Mach-64 with standard Mandrake 8.1
    drivers), only the first 4 pixels of the image are rendered, in the top
    left hand corner of the display! The pixels do scale correctly when the
    window is resized, but still only the first four pixels are rendered
    (just larger).

Any help/hints would be greatly appreciated.

Thanks,

-justin