mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 00:58:12 +00:00
matroskamux: Consider audio buffers as keyframes when writing out simpleblocks
Otherwise mpv complains and considers the file broken. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4142 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8225>
This commit is contained in:
parent
32e79c1041
commit
06a0ab7b33
2 changed files with 9 additions and 7 deletions
|
@ -3853,7 +3853,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaMuxPad * mux_pad,
|
||||||
guint64 block_duration, duration_diff = 0;
|
guint64 block_duration, duration_diff = 0;
|
||||||
gboolean is_video_keyframe = FALSE;
|
gboolean is_video_keyframe = FALSE;
|
||||||
gboolean is_video_invisible = FALSE;
|
gboolean is_video_invisible = FALSE;
|
||||||
gboolean is_audio_only = FALSE;
|
gboolean is_audio_only = FALSE, is_audio = FALSE;
|
||||||
gboolean is_min_duration_reached = FALSE;
|
gboolean is_min_duration_reached = FALSE;
|
||||||
gboolean is_max_duration_exceeded = FALSE;
|
gboolean is_max_duration_exceeded = FALSE;
|
||||||
gint flags = 0;
|
gint flags = 0;
|
||||||
|
@ -3941,6 +3941,8 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaMuxPad * mux_pad,
|
||||||
gst_matroska_mux_pads_is_audio_only (GST_ELEMENT (mux)->sinkpads);
|
gst_matroska_mux_pads_is_audio_only (GST_ELEMENT (mux)->sinkpads);
|
||||||
GST_OBJECT_UNLOCK (mux);
|
GST_OBJECT_UNLOCK (mux);
|
||||||
|
|
||||||
|
is_audio = mux_pad->track->type == GST_MATROSKA_TRACK_TYPE_AUDIO;
|
||||||
|
|
||||||
is_min_duration_reached = (mux->min_cluster_duration == 0
|
is_min_duration_reached = (mux->min_cluster_duration == 0
|
||||||
|| (buffer_timestamp > mux->cluster_time
|
|| (buffer_timestamp > mux->cluster_time
|
||||||
&& (buffer_timestamp - mux->cluster_time) >=
|
&& (buffer_timestamp - mux->cluster_time) >=
|
||||||
|
@ -4102,7 +4104,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaMuxPad * mux_pad,
|
||||||
flags |= 0x08;
|
flags |= 0x08;
|
||||||
|
|
||||||
if (mux->doctype_version > 1 && !write_duration && !cmeta) {
|
if (mux->doctype_version > 1 && !write_duration && !cmeta) {
|
||||||
if (is_video_keyframe)
|
if (is_video_keyframe || is_audio)
|
||||||
flags |= 0x80;
|
flags |= 0x80;
|
||||||
|
|
||||||
hdr =
|
hdr =
|
||||||
|
|
|
@ -59,8 +59,8 @@ seekable_sinkpad_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
|
|
||||||
#define compare_buffer_to_data(buffer, data, data_size) \
|
#define compare_buffer_to_data(buffer, data, data_size) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
fail_unless_equals_int (data_size, gst_buffer_get_size (buffer)); \
|
fail_unless_equals_int (data_size, gst_buffer_get_size (buffer)); \
|
||||||
fail_unless (gst_buffer_memcmp (buffer, 0, data, data_size) == 0); \
|
fail_unless (gst_buffer_memcmp (buffer, 0, data, data_size) == 0);\
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -232,7 +232,7 @@ GST_END_TEST;
|
||||||
|
|
||||||
GST_START_TEST (test_block_group_v2)
|
GST_START_TEST (test_block_group_v2)
|
||||||
{
|
{
|
||||||
guint8 data0_v2[] = { 0xa3, 0x85, 0x81, 0x00, 0x01, 0x00 };
|
guint8 data0_v2[] = { 0xa3, 0x85, 0x81, 0x00, 0x01, 0x80 };
|
||||||
|
|
||||||
test_block_group_with_version (2, data0_v2, sizeof (data0_v2));
|
test_block_group_with_version (2, data0_v2, sizeof (data0_v2));
|
||||||
}
|
}
|
||||||
|
@ -311,10 +311,10 @@ GST_START_TEST (test_timecodescale)
|
||||||
{
|
{
|
||||||
GstBuffer *inbuffer, *outbuffer;
|
GstBuffer *inbuffer, *outbuffer;
|
||||||
guint8 data_h0[] = {
|
guint8 data_h0[] = {
|
||||||
0xa3, 0x85, 0x81, 0x00, 0x00, 0x00,
|
0xa3, 0x85, 0x81, 0x00, 0x00, 0x80,
|
||||||
};
|
};
|
||||||
guint8 data_h1[] = {
|
guint8 data_h1[] = {
|
||||||
0xa3, 0x85, 0x81, 0x00, 0x01, 0x00,
|
0xa3, 0x85, 0x81, 0x00, 0x01, 0x80,
|
||||||
};
|
};
|
||||||
|
|
||||||
GstHarness *h = setup_matroskamux_harness (AC3_CAPS_STRING);
|
GstHarness *h = setup_matroskamux_harness (AC3_CAPS_STRING);
|
||||||
|
|
Loading…
Reference in a new issue