fmp4mux: Accept tag updates before stream starts

Tag updates should be done if either the tag is set before the stream
started or if tag changes are allowed while the stream is already
running.

Fixes #629

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1921>
This commit is contained in:
Jochen Henneberg 2024-11-18 10:43:08 +01:00 committed by GStreamer Marge Bot
parent 28e66e150f
commit 08c026cea6

View file

@ -3670,20 +3670,21 @@ impl AggregatorImpl for FMP4Mux {
let language_code = Some(language_code); let language_code = Some(language_code);
// If the language changed and we have buffers // If the language changed and we have buffers
// trigger caps change // trigger header update
if state.language_code != language_code if state.language_code != language_code {
&& !state.streams.is_empty() if state.streams.is_empty() {
&& self.header_update_allowed("language code") state.language_code = language_code;
{ } else if self.header_update_allowed("language code") {
state.language_code = language_code; state.language_code = language_code;
state.need_new_header = true; state.need_new_header = true;
if let Some(stream) = state if let Some(stream) = state
.streams .streams
.iter_mut() .iter_mut()
.find(|s| *aggregator_pad == s.sinkpad) .find(|s| *aggregator_pad == s.sinkpad)
{ {
stream.tag_changed = true; stream.tag_changed = true;
}
} }
} }
} }
@ -3720,12 +3721,21 @@ impl AggregatorImpl for FMP4Mux {
// If the orientation changed and we have buffers // If the orientation changed and we have buffers
// trigger caps change // trigger caps change
if state.orientation != orientation if state.orientation != orientation {
&& !state.streams.is_empty() if state.streams.is_empty() {
&& self.header_update_allowed("orientation") state.orientation = orientation;
{ } else if self.header_update_allowed("orientation") {
state.orientation = orientation; state.orientation = orientation;
state.need_new_header = true; state.need_new_header = true;
if let Some(stream) = state
.streams
.iter_mut()
.find(|s| *aggregator_pad == s.sinkpad)
{
stream.tag_changed = true;
}
}
} }
} }