mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-14 02:05:39 +00:00
matroskamux: Fix audio-only stream conditions
The num_a_streams and related counters are used for pad numbers and don't give the absolute number of streams in this run of the muxer. Also, consider the output audio-only if there are more than 1 audio stream too. 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
422fca76ca
commit
32e79c1041
1 changed files with 20 additions and 3 deletions
|
@ -3001,6 +3001,20 @@ gst_matroska_mux_write_chapter_edition (GstMatroskaMux * mux,
|
||||||
return internal_edition;
|
return internal_edition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_matroska_mux_pads_is_audio_only (const GList * sinkpads)
|
||||||
|
{
|
||||||
|
for (const GList * l = sinkpads; l; l = g_list_next (l)) {
|
||||||
|
const GstMatroskaMuxPad *other_mux_pad = l->data;
|
||||||
|
|
||||||
|
if (other_mux_pad->track->type != GST_MATROSKA_TRACK_TYPE_AUDIO) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_matroska_mux_start_file (GstMatroskaMux * mux)
|
gst_matroska_mux_start_file (GstMatroskaMux * mux)
|
||||||
{
|
{
|
||||||
|
@ -3063,7 +3077,7 @@ gst_matroska_mux_start_file (GstMatroskaMux * mux)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* output caps */
|
/* output caps */
|
||||||
audio_only = mux->num_v_streams == 0 && mux->num_a_streams > 0;
|
audio_only = gst_matroska_mux_pads_is_audio_only (sinkpads);
|
||||||
if (mux->is_webm) {
|
if (mux->is_webm) {
|
||||||
media_type = (audio_only) ? "audio/webm" : "video/webm";
|
media_type = (audio_only) ? "audio/webm" : "video/webm";
|
||||||
} else {
|
} else {
|
||||||
|
@ -3922,8 +3936,11 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaMuxPad * mux_pad,
|
||||||
* related arithmetic, so apply the timestamp offset if we have one */
|
* related arithmetic, so apply the timestamp offset if we have one */
|
||||||
buffer_timestamp += mux->cluster_timestamp_offset;
|
buffer_timestamp += mux->cluster_timestamp_offset;
|
||||||
|
|
||||||
is_audio_only = (mux_pad->track->type == GST_MATROSKA_TRACK_TYPE_AUDIO) &&
|
GST_OBJECT_LOCK (mux);
|
||||||
(mux->num_streams == 1);
|
is_audio_only =
|
||||||
|
gst_matroska_mux_pads_is_audio_only (GST_ELEMENT (mux)->sinkpads);
|
||||||
|
GST_OBJECT_UNLOCK (mux);
|
||||||
|
|
||||||
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) >=
|
||||||
|
|
Loading…
Reference in a new issue