mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
audio: Don't answer BYTES queries
Refuse to answer BYTES queries ourselves. The only time they make sense is on raw elementary streams, in which case upstream would already have answered. They especially don't make sense for encoders to answer based on upstream values - although perhaps later we could make it do TIME->BYTES conversion on the source pad based on bitrate. https://bugzilla.gnome.org/show_bug.cgi?id=757631
This commit is contained in:
parent
6a4c14c39a
commit
1840b0233a
2 changed files with 24 additions and 1 deletions
|
@ -2767,6 +2767,13 @@ gst_audio_decoder_src_query_default (GstAudioDecoder * dec, GstQuery * query)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Refuse BYTES format queries. If it made sense to
|
||||
* answer them, upstream would have already */
|
||||
if (format == GST_FORMAT_BYTES) {
|
||||
GST_LOG_OBJECT (dec, "Ignoring BYTES position query");
|
||||
break;
|
||||
}
|
||||
|
||||
/* we start from the last seen time */
|
||||
time = dec->output_segment.position;
|
||||
/* correct for the segment values */
|
||||
|
|
|
@ -924,7 +924,7 @@ gst_audio_encoder_finish_frame (GstAudioEncoder * enc, GstBuffer * buf,
|
|||
ret = gst_pad_push (enc->srcpad, tmpbuf);
|
||||
if (ret != GST_FLOW_OK) {
|
||||
GST_WARNING_OBJECT (enc, "pushing header returned %s",
|
||||
gst_flow_get_name (ret));
|
||||
gst_flow_get_name (ret));
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
@ -1896,6 +1896,14 @@ gst_audio_encoder_src_query_default (GstAudioEncoder * enc, GstQuery * query)
|
|||
}
|
||||
|
||||
gst_query_parse_position (query, &req_fmt, NULL);
|
||||
|
||||
/* Refuse BYTES format queries. If it made sense to
|
||||
* * answer them, upstream would have already */
|
||||
if (req_fmt == GST_FORMAT_BYTES) {
|
||||
GST_LOG_OBJECT (enc, "Ignoring BYTES position query");
|
||||
break;
|
||||
}
|
||||
|
||||
fmt = GST_FORMAT_TIME;
|
||||
if (!(res = gst_pad_peer_query_position (enc->sinkpad, fmt, &pos)))
|
||||
break;
|
||||
|
@ -1918,6 +1926,14 @@ gst_audio_encoder_src_query_default (GstAudioEncoder * enc, GstQuery * query)
|
|||
}
|
||||
|
||||
gst_query_parse_duration (query, &req_fmt, NULL);
|
||||
|
||||
/* Refuse BYTES format queries. If it made sense to
|
||||
* * answer them, upstream would have already */
|
||||
if (req_fmt == GST_FORMAT_BYTES) {
|
||||
GST_LOG_OBJECT (enc, "Ignoring BYTES position query");
|
||||
break;
|
||||
}
|
||||
|
||||
fmt = GST_FORMAT_TIME;
|
||||
if (!(res = gst_pad_peer_query_duration (enc->sinkpad, fmt, &dur)))
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue