[ogg-dev] libfishsound: Bug in fish_sound_flush

Bob Ingraham bobi at ingrahams.us
Mon May 20 09:17:31 PDT 2013

I apologize if this is the wrong list for this, but after searching the
available lists at xiph.org, this is the closest I could find.

I ran into a bug in the example fishsound-encode.c program where it gets
OGGZ_ERR_BAD_SERIALNO errors from oggz:

  fish_sound_flush (fsound);
  oggz_run (oggz);

  oggz_close (oggz);

  fish_sound_delete (fsound);

After debugging, it appears that fish_sound_flush() doesn't actually flush
anything from the codec, so the succeeding oggz_run() doesn't write the
final packets to the oggz queue.

Then, the oggz_close() is executed.

However, the call to fish_sound_delete() actually generates the remaining
packets and tries to write them to the closed oggz handle which generates
the OGGZ_ERR_BAD_SERIALNO error for each packet.

By moving the fish_sound_delete() ahead of the oggz_close(), all works as

  fish_sound_flush (fsound);

  fish_sound_delete (fsound);

  oggz_run (oggz);

  oggz_close (oggz);

So, it looks like fish_sound_delete() is actually flushing the remaining
packets whereas fish_sound_flush() is not.

I am using libfishsound-1.0.0.

Is this a bug?

More information about the ogg-dev mailing list