From 9b188adc27308a26b8a0b517184afd6eeece2d88 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 21 May 2007 10:25:44 +0000 Subject: [PATCH] Small cleanups. Original commit message from CVS: * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_read_sector): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_create): Small cleanups. * ext/theora/theoradec.c: (theora_dec_sink_event): Fix typo. * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_set_gst_timestamp): Add some FIXME * gst/playback/gstdecodebin.c: (queue_underrun_cb): And some debug info when a FIXME path is hit. --- ChangeLog | 18 +++++++++++++++++ ext/cdparanoia/gstcdparanoiasrc.c | 37 +++++++++++++++++++++------------- ext/theora/theoradec.c | 2 +- gst-libs/gst/audio/gstbaseaudiosrc.c | 9 +++++++-- gst-libs/gst/rtp/gstbasertpdepayload.c | 2 ++ gst/playback/gstdecodebin.c | 1 + 6 files changed, 52 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 486648c..a71d22b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 2007-05-21 Wim Taymans + * ext/cdparanoia/gstcdparanoiasrc.c: + (gst_cd_paranoia_src_read_sector): + * gst-libs/gst/audio/gstbaseaudiosrc.c: + (gst_base_audio_src_create): + Small cleanups. + + * ext/theora/theoradec.c: (theora_dec_sink_event): + Fix typo. + + * gst-libs/gst/rtp/gstbasertpdepayload.c: + (gst_base_rtp_depayload_set_gst_timestamp): + Add some FIXME + + * gst/playback/gstdecodebin.c: (queue_underrun_cb): + And some debug info when a FIXME path is hit. + +2007-05-21 Wim Taymans + * gst-libs/gst/rtp/gstbasertpaudiopayload.c: (gst_base_rtp_audio_payload_class_init), (gst_base_rtp_audio_payload_init), diff --git a/ext/cdparanoia/gstcdparanoiasrc.c b/ext/cdparanoia/gstcdparanoiasrc.c index aa7da14..cb14209 100644 --- a/ext/cdparanoia/gstcdparanoiasrc.c +++ b/ext/cdparanoia/gstcdparanoiasrc.c @@ -327,13 +327,9 @@ gst_cd_paranoia_src_read_sector (GstCddaBaseSrc * cddabasesrc, gint sector) #endif if (src->next_sector == -1 || src->next_sector != sector) { - if (paranoia_seek (src->p, sector, SEEK_SET) == -1) { - GST_WARNING_OBJECT (src, "seek to sector %d failed!", sector); - GST_ELEMENT_ERROR (src, RESOURCE, SEEK, - (_("Could not seek CD.")), - ("paranoia_seek to %d failed: %s", sector, g_strerror (errno))); - return NULL; - } + if (paranoia_seek (src->p, sector, SEEK_SET) == -1) + goto seek_failed; + GST_DEBUG_OBJECT (src, "successfully seeked to sector %d", sector); src->next_sector = sector; } @@ -357,13 +353,8 @@ gst_cd_paranoia_src_read_sector (GstCddaBaseSrc * cddabasesrc, gint sector) cdda_buf = paranoia_read (src->p, gst_cd_paranoia_dummy_callback); } - if (cdda_buf == NULL) { - GST_WARNING_OBJECT (src, "read at sector %d failed!", sector); - GST_ELEMENT_ERROR (src, RESOURCE, READ, - (_("Could not read CD.")), - ("paranoia_read at %d failed: %s", sector, g_strerror (errno))); - return NULL; - } + if (cdda_buf == NULL) + goto read_failed; buf = gst_buffer_new_and_alloc (CD_FRAMESIZE_RAW); memcpy (GST_BUFFER_DATA (buf), cdda_buf, CD_FRAMESIZE_RAW); @@ -372,6 +363,24 @@ gst_cd_paranoia_src_read_sector (GstCddaBaseSrc * cddabasesrc, gint sector) ++src->next_sector; return buf; + + /* ERRORS */ +seek_failed: + { + GST_WARNING_OBJECT (src, "seek to sector %d failed!", sector); + GST_ELEMENT_ERROR (src, RESOURCE, SEEK, + (_("Could not seek CD.")), + ("paranoia_seek to %d failed: %s", sector, g_strerror (errno))); + return NULL; + } +read_failed: + { + GST_WARNING_OBJECT (src, "read at sector %d failed!", sector); + GST_ELEMENT_ERROR (src, RESOURCE, READ, + (_("Could not read CD.")), + ("paranoia_read at %d failed: %s", sector, g_strerror (errno))); + return NULL; + } } static void diff --git a/ext/theora/theoradec.c b/ext/theora/theoradec.c index 89bb6f2..1e346a5 100644 --- a/ext/theora/theoradec.c +++ b/ext/theora/theoradec.c @@ -695,7 +695,7 @@ theora_dec_sink_event (GstPad * pad, GstEvent * event) gst_segment_set_newsegment_full (&dec->segment, update, rate, arate, format, start, stop, time); - /* iWe don't forward this unless/until the decoder is initialised */ + /* We don't forward this unless/until the decoder is initialised */ if (dec->have_header) { ret = gst_pad_push_event (dec->srcpad, event); dec->sent_newsegment = TRUE; diff --git a/gst-libs/gst/audio/gstbaseaudiosrc.c b/gst-libs/gst/audio/gstbaseaudiosrc.c index 377728e..366c133 100644 --- a/gst-libs/gst/audio/gstbaseaudiosrc.c +++ b/gst-libs/gst/audio/gstbaseaudiosrc.c @@ -538,6 +538,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length, gint bps; GstRingBuffer *ringbuffer; guint read; + GstClockTime timestamp; ringbuffer = src->ringbuffer; @@ -566,6 +567,8 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length, sample = gst_base_audio_src_get_offset (src); } + GST_DEBUG_OBJECT (src, "reading from sample %" G_GUINT64_FORMAT, sample); + /* get the number of samples to read */ samples = length / bps; @@ -605,8 +608,10 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length, * where we are slaved to another clock. We currently refuse to accept * any other clock than the one we provide, so this code is fine for * now. */ - GST_BUFFER_TIMESTAMP (buf) = gst_util_uint64_scale_int (sample, - GST_SECOND, ringbuffer->spec.rate); + timestamp = + gst_util_uint64_scale_int (sample, GST_SECOND, ringbuffer->spec.rate); + + GST_BUFFER_TIMESTAMP (buf) = timestamp; src->next_sample = sample + samples; GST_BUFFER_DURATION (buf) = gst_util_uint64_scale_int (src->next_sample, GST_SECOND, ringbuffer->spec.rate) - GST_BUFFER_TIMESTAMP (buf); diff --git a/gst-libs/gst/rtp/gstbasertpdepayload.c b/gst-libs/gst/rtp/gstbasertpdepayload.c index 715b46c..9073d6b 100644 --- a/gst-libs/gst/rtp/gstbasertpdepayload.c +++ b/gst-libs/gst/rtp/gstbasertpdepayload.c @@ -485,6 +485,8 @@ gst_base_rtp_depayload_set_gst_timestamp (GstBaseRTPDepayload * filter, if (priv->clock_base == -1) priv->clock_base = timestamp; + /* FIXME, timestamp wraparound */ + /* rtp timestamps are based on the clock_rate * gst timesamps are in nanoseconds */ ts = gst_util_uint64_scale_int (timestamp, GST_SECOND, filter->clock_rate); diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index 066e87f..21d6fb4 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -1173,6 +1173,7 @@ queue_underrun_cb (GstElement * queue, GstDecodeBin * decode_bin) * list) and the overrun signals that are signalled from the * demuxer thread. */ + GST_DEBUG_OBJECT (decode_bin, "got underrun"); } /* Make sure we don't have a full queue and empty queue situation */ -- 2.7.4