[openbeos] Solution to MediaKit sync issue resolved

  • From: "Solaja, Zenja" <solaja@xxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Tue, 29 Jun 2004 08:21:26 +1000

Hi everyone.  I dont know if this has been reported before, if not I
apologise for hogging bandwidth, but its a discovery I made last night so I
think I ought to share it with those of you who dont know.  Anyone who has
used BeOS's media kit (even for watching videos) must have observed the
sound sync issue (or lack of it) when dealing with encoded audio.  I've been
working on a MediaPlayer clone (for now, grander plans later) and decided to
roll up my sleves and figure out what was the issue with audio sync.

The issue seems to be with bitrate calculations, specifically, moving from
BINARY kilo bits per second (where a kilo is 1024) to DECIMAL kilo bits per
second (where a kilo is the SI quantity of 1000).  When you pass the real
time to either seek or play decoders, it will perform its calculations on
BINARY kilo, when in fact it should have done the operation in DECIMAL kilo,
since time itself is decimal (bigtime_t).  When you manually adjust the seek
and play times with this offset, you finally get proper audio sync.

Eg. For 128Kbps audio codec (MP3), you need to adjust your seek/play time
with 128000/(128*1024)

Anyway, my video player using native BeOS codecs is finally 100% in sync,
and I'll gladly donate it to OBOS when its done.  In my software philosophy,
software ain't done until it fulfills the following 3 requirements:

- Functional (it's useless if it doesn't do what it needs to do)
- Fast (which also means responsive)
- Fun (how intuitive is it, does it frustrate the user, does is save
settings and remember window positions and directories, stuff like that)

I've got the functional and fast bits sorted out, now the difference between
a good app and a great app is how much fun it is to use.  So I'll be
spending my time on the fun requirement for now.

/me crawls back under rock

Zenja Solaja

<ps - not in any way speaking for my employer - automatic disclaimer
follows>

----------------------------------------------------------------------
IMPORTANT NOTICES
This email (including any documents referred to in, or attached, to this
email) may contain information that is personal, confidential or the subject
of copyright or other proprietary rights in favour of Aristocrat, its
affiliates or third parties. This email is intended only for the named
addressee. Any privacy, confidence, copyright or other proprietary rights in
favour of Aristocrat, its affiliates or third parties, is not lost because
this email was sent to you by mistake.

If you received this email by mistake you should: (i) not copy, disclose,
distribute or otherwise use it, or its contents, without the consent of
Aristocrat or the owner of the relevant rights; (ii) let us know of the
mistake by reply email or by telephone (+61 2 9413 6300); and (iii) delete
it from your system and destroy all copies.

Any personal information contained in this email must be handled in
accordance with applicable privacy laws.

Electronic and internet communications can be interfered with or affected by
viruses and other defects. As a result, such communications may not be
successfully received or, if received, may cause interference with the
integrity of receiving, processing or related systems (including hardware,
software and data or information on, or using, that hardware or software).
Aristocrat gives no assurances in relation to these matters.

If you have any doubts about the veracity or integrity of any electronic
communication we appear to have sent you, please call +61 2 9413 6300 for
clarification.

Other related posts: