After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 595256 - theoraenc: Buffer not time-contiguous with previous one
theoraenc: Buffer not time-contiguous with previous one
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-09-15 11:24 UTC by Marc-Andre Lureau
Modified: 2010-09-28 14:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
hack (860 bytes, patch)
2009-09-15 11:36 UTC, Marc-Andre Lureau
rejected Details | Review
small test (1.33 KB, text/x-csrc)
2009-09-15 14:55 UTC, Marc-Andre Lureau
  Details

Description Marc-Andre Lureau 2009-09-15 11:24:05 UTC
The following produces warnings.

GST_DEBUG=*theora*:4,identity:4 gst-launch videotestsrc ! theoraenc ! identity check-perfect=1 ! fakesink -v 2>&1 | grep -v data-cont | grep -v FakeSink | grep WARN

It seems that in function theora_enc_get_ogg_packet_end_time()

theora_granule_time (&enc->state, end_granule) * GST_SECOND

has rounding issues. (for ex. the double 7.4000000 becomes 0.7399999 in clocktime)

One way to hack the issue is to replace:


 GST_BUFFER_TIMESTAMP (buf) = timestamp;
by
 GST_BUFFER_TIMESTAMP (buf) = running_time;

Would that be acceptable??
Comment 1 Marc-Andre Lureau 2009-09-15 11:36:30 UTC
Created attachment 143225 [details] [review]
hack
Comment 2 Marc-Andre Lureau 2009-09-15 11:47:30 UTC
For reference, this is the code under theora_granule_time()

double th_granule_time(void *_encdec,ogg_int64_t _granpos){
  oc_theora_state *state;
  state=(oc_theora_state *)_encdec;
  if(_granpos>=0){
    return (th_granule_frame(_encdec, _granpos)+1)*(
     (double)state->info.fps_denominator/state->info.fps_numerator);
  }
  return -1;
}
Comment 3 Wim Taymans 2009-09-15 11:55:38 UTC
I don't think this would work when dealing with multiple segments. Better calculate the timestamp correctly, for example by doing the granulepos to time more accurately.
Comment 4 Marc-Andre Lureau 2009-09-15 12:09:56 UTC
ok, another way is to remove parenthesis around ((double)state->info.fps_denominator/state->info.fps_numerator))

the following ex demonstrate it:

#include <gst/gst.h>

int main()
{
  int i;
  double dbad, dgood;
  GstClockTime tbad, tgood;

  for (i = 0; i < 400; ++i) {
    dbad = i * ((double)1/30);
    dgood = i * (double)1/30;

    tbad = dbad * GST_SECOND;
    tgood = dgood * GST_SECOND;

    printf("%f %f\n", dbad, dgood);
    printf("bad %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (tbad));
    printf("good %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (tgood));

    if (tbad != tgood)
      return 1;
  }

  return 0;
}

However, I am not convinced that the bug comes from theora... but rather by usage of the timestamp in gstreamer.
Comment 5 Marc-Andre Lureau 2009-09-15 14:55:28 UTC
Created attachment 143232 [details]
small test

Before I lost that file, I attach it here.

It would be good to put that in the test suite, to avoid regressions, once we have a fix.
Comment 6 Sebastian Dröge (slomo) 2009-09-22 06:37:50 UTC
Things might become better if you use gst_util_uint64_scale_round() in theora_granule_time()
Comment 7 Marc-Andre Lureau 2009-09-22 08:19:34 UTC
yep, but theora_granule_time() is from libtheora :)
Comment 8 Marc-Andre Lureau 2010-09-28 14:03:43 UTC
I can't reproduce the bug with 0.10.30, closing my own bug.

Thanks for taking the time to report this bug.
However, you are using a version that is too old and not supported anymore. GNOME developers are no longer working on that version, so unfortunately there will not be any bug fixes for the version that you use.

By upgrading to a newer version of GNOME you could receive bug fixes and new functionality. You may need to upgrade your Linux distribution to obtain a newer version of GNOME.
Please feel free to reopen this bug if the problem still occurs with a newer version of GNOME.