summaryrefslogtreecommitdiffstats
path: root/gst/matroska/matroska-mux.c
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-05-03 18:41:47 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-05-03 18:41:47 +0000
commit63b169cdf112401e3f60d29f8f92efc657504ebe (patch)
tree7071fbe1b318aff5d5ed3685038daf48413a1e10 /gst/matroska/matroska-mux.c
parentfcd464ea306af49f48793107774ae10f3511e29e (diff)
gst/matroska/matroska-mux.c: Don't strcmp() NULL strings.
Original commit message from CVS: * gst/matroska/matroska-mux.c: (gst_matroska_mux_stream_is_vorbis_header), (gst_matroska_mux_write_data): Don't strcmp() NULL strings. Only start new clusters on video keyframes, not on any random audio buffer that doesn't have the DELTA_UNIT flag set (fixes 'make check' again).
Diffstat (limited to 'gst/matroska/matroska-mux.c')
-rw-r--r--gst/matroska/matroska-mux.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c
index 20d5cfaf..96d2e1a6 100644
--- a/gst/matroska/matroska-mux.c
+++ b/gst/matroska/matroska-mux.c
@@ -1318,7 +1318,8 @@ gst_matroska_mux_stream_is_vorbis_header (GstMatroskaMux * mux,
if (audio_ctx->first_frame != FALSE)
return FALSE;
- if (strcmp (collect_pad->track->codec_id, GST_MATROSKA_CODEC_ID_AUDIO_VORBIS))
+ if (collect_pad->track->codec_id == NULL ||
+ strcmp (collect_pad->track->codec_id, GST_MATROSKA_CODEC_ID_AUDIO_VORBIS))
return FALSE;
/* HACK: three frame headers are counted using pos */
@@ -1379,6 +1380,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
gint16 relative_timestamp;
gint64 relative_timestamp64;
guint64 block_duration;
+ gboolean is_video_keyframe = FALSE;
/* write data */
buf = collect_pad->buffer;
@@ -1386,6 +1388,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
/* vorbis header are retrieved from caps and placed in CodecPrivate */
if (gst_matroska_mux_stream_is_vorbis_header (mux, collect_pad)) {
+ GST_LOG_OBJECT (collect_pad->collect.pad, "dropping vorbis header buffer");
gst_buffer_unref (buf);
return GST_FLOW_OK;
}
@@ -1402,10 +1405,17 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
/* set the timestamp for outgoing buffers */
ebml->timestamp = GST_BUFFER_TIMESTAMP (buf);
+ if (collect_pad->track->type == GST_MATROSKA_TRACK_TYPE_VIDEO &&
+ !GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) {
+ GST_LOG_OBJECT (mux, "have video keyframe, ts=%" GST_TIME_FORMAT,
+ GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
+ is_video_keyframe = TRUE;
+ }
+
if (mux->cluster) {
/* start a new cluster every two seconds or at keyframe */
if (mux->cluster_time + GST_SECOND * 2 < GST_BUFFER_TIMESTAMP (buf)
- || !GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) {
+ || is_video_keyframe) {
GstMatroskaMetaSeekIndex *idx;
gst_ebml_write_master_finish (ebml, mux->cluster);
@@ -1453,8 +1463,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
* for audio only files. This can be largely improved, such as doing
* one for each keyframe or each second (for all-keyframe
* streams), only the *first* video track. But that'll come later... */
- if (collect_pad->track->type == GST_MATROSKA_TRACK_TYPE_VIDEO &&
- !GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) {
+ if (is_video_keyframe) {
GstMatroskaIndex *idx;
if (mux->num_indexes % 32 == 0) {