mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
matroskamux: try to write timestamps in all the outgoing buffers
Fixes #632654.
This commit is contained in:
parent
1d4496254d
commit
fd6bc949c8
3 changed files with 16 additions and 11 deletions
|
@ -223,12 +223,14 @@ gst_ebml_writer_send_new_segment_event (GstEbmlWrite * ebml, guint64 new_pos)
|
|||
|
||||
/**
|
||||
* gst_ebml_write_flush_cache:
|
||||
* @ebml: a #GstEbmlWrite.
|
||||
* @ebml: a #GstEbmlWrite.
|
||||
* @timestamp: timestamp of the buffer.
|
||||
*
|
||||
* Flush the cache.
|
||||
*/
|
||||
void
|
||||
gst_ebml_write_flush_cache (GstEbmlWrite * ebml, gboolean is_keyframe)
|
||||
gst_ebml_write_flush_cache (GstEbmlWrite * ebml, gboolean is_keyframe,
|
||||
GstClockTime timestamp)
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
|
||||
|
@ -239,6 +241,7 @@ gst_ebml_write_flush_cache (GstEbmlWrite * ebml, gboolean is_keyframe)
|
|||
ebml->cache = NULL;
|
||||
GST_DEBUG ("Flushing cache of size %d", GST_BUFFER_SIZE (buffer));
|
||||
gst_buffer_set_caps (buffer, ebml->caps);
|
||||
GST_BUFFER_TIMESTAMP (buffer) = timestamp;
|
||||
GST_BUFFER_OFFSET (buffer) = ebml->pos - GST_BUFFER_SIZE (buffer);
|
||||
GST_BUFFER_OFFSET_END (buffer) = ebml->pos;
|
||||
if (ebml->last_write_result == GST_FLOW_OK) {
|
||||
|
@ -466,7 +469,7 @@ gst_ebml_write_seek (GstEbmlWrite * ebml, guint64 pos)
|
|||
return;
|
||||
} else {
|
||||
GST_LOG ("Seek outside cache range. Clearing...");
|
||||
gst_ebml_write_flush_cache (ebml, FALSE);
|
||||
gst_ebml_write_flush_cache (ebml, FALSE, GST_CLOCK_TIME_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -825,5 +828,5 @@ gst_ebml_write_header (GstEbmlWrite * ebml, const gchar * doctype,
|
|||
gst_ebml_write_uint (ebml, GST_EBML_ID_DOCTYPEVERSION, version);
|
||||
gst_ebml_write_uint (ebml, GST_EBML_ID_DOCTYPEREADVERSION, version);
|
||||
gst_ebml_write_master_finish (ebml, pos);
|
||||
gst_ebml_write_flush_cache (ebml, FALSE);
|
||||
gst_ebml_write_flush_cache (ebml, FALSE, 0);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,8 @@ GstBuffer* gst_ebml_stop_streamheader (GstEbmlWrite *ebml);
|
|||
void gst_ebml_write_set_cache (GstEbmlWrite *ebml,
|
||||
guint size);
|
||||
void gst_ebml_write_flush_cache (GstEbmlWrite *ebml,
|
||||
gboolean is_keyframe);
|
||||
gboolean is_keyframe,
|
||||
GstClockTime timestamp);
|
||||
|
||||
/*
|
||||
* Seeking.
|
||||
|
|
|
@ -2124,7 +2124,7 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
|
|||
gst_ebml_write_master_finish (ebml, master);
|
||||
|
||||
/* lastly, flush the cache */
|
||||
gst_ebml_write_flush_cache (ebml, FALSE);
|
||||
gst_ebml_write_flush_cache (ebml, FALSE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2233,7 +2233,7 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
|
|||
}
|
||||
|
||||
gst_ebml_write_master_finish (ebml, master);
|
||||
gst_ebml_write_flush_cache (ebml, FALSE);
|
||||
gst_ebml_write_flush_cache (ebml, FALSE, GST_CLOCK_TIME_NONE);
|
||||
}
|
||||
|
||||
/* tags */
|
||||
|
@ -2600,7 +2600,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
|
|||
GST_LOG_OBJECT (mux, "cluster timestamp %" G_GUINT64_FORMAT,
|
||||
gst_util_uint64_scale (GST_BUFFER_TIMESTAMP (buf), 1,
|
||||
mux->time_scale));
|
||||
gst_ebml_write_flush_cache (ebml, TRUE);
|
||||
gst_ebml_write_flush_cache (ebml, TRUE, GST_BUFFER_TIMESTAMP (buf));
|
||||
mux->cluster_time = GST_BUFFER_TIMESTAMP (buf);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_PREVSIZE,
|
||||
mux->prev_cluster_size);
|
||||
|
@ -2613,7 +2613,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
|
|||
mux->cluster = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_CLUSTER);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CLUSTERTIMECODE,
|
||||
gst_util_uint64_scale (GST_BUFFER_TIMESTAMP (buf), 1, mux->time_scale));
|
||||
gst_ebml_write_flush_cache (ebml, TRUE);
|
||||
gst_ebml_write_flush_cache (ebml, TRUE, GST_BUFFER_TIMESTAMP (buf));
|
||||
mux->cluster_time = GST_BUFFER_TIMESTAMP (buf);
|
||||
}
|
||||
|
||||
|
@ -2691,7 +2691,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
|
|||
gst_ebml_write_buffer_header (ebml, GST_MATROSKA_ID_SIMPLEBLOCK,
|
||||
GST_BUFFER_SIZE (buf) + GST_BUFFER_SIZE (hdr));
|
||||
gst_ebml_write_buffer (ebml, hdr);
|
||||
gst_ebml_write_flush_cache (ebml, FALSE);
|
||||
gst_ebml_write_flush_cache (ebml, FALSE, GST_BUFFER_TIMESTAMP (buf));
|
||||
gst_ebml_write_buffer (ebml, buf);
|
||||
|
||||
return gst_ebml_last_write_result (ebml);
|
||||
|
@ -2711,8 +2711,9 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
|
|||
GST_BUFFER_SIZE (buf) + GST_BUFFER_SIZE (hdr));
|
||||
gst_ebml_write_buffer (ebml, hdr);
|
||||
gst_ebml_write_master_finish_full (ebml, blockgroup, GST_BUFFER_SIZE (buf));
|
||||
gst_ebml_write_flush_cache (ebml, FALSE);
|
||||
gst_ebml_write_flush_cache (ebml, FALSE, GST_BUFFER_TIMESTAMP (buf));
|
||||
gst_ebml_write_buffer (ebml, buf);
|
||||
|
||||
return gst_ebml_last_write_result (ebml);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue