mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 02:00:33 +00:00
opusdec: let the base class handle all timing
This commit is contained in:
parent
8bb91f923f
commit
656e1f8d9f
2 changed files with 5 additions and 29 deletions
|
@ -120,8 +120,6 @@ gst_opus_dec_reset (GstOpusDec * dec)
|
||||||
dec->state = NULL;
|
dec->state = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dec->next_ts = 0;
|
|
||||||
|
|
||||||
gst_buffer_replace (&dec->streamheader, NULL);
|
gst_buffer_replace (&dec->streamheader, NULL);
|
||||||
gst_buffer_replace (&dec->vorbiscomment, NULL);
|
gst_buffer_replace (&dec->vorbiscomment, NULL);
|
||||||
}
|
}
|
||||||
|
@ -213,8 +211,7 @@ gst_opus_dec_setup_from_peer_caps (GstOpusDec * dec)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
opus_dec_chain_parse_data (GstOpusDec * dec, GstBuffer * buf,
|
opus_dec_chain_parse_data (GstOpusDec * dec, GstBuffer * buf)
|
||||||
GstClockTime timestamp, GstClockTime duration)
|
|
||||||
{
|
{
|
||||||
GstFlowReturn res = GST_FLOW_OK;
|
GstFlowReturn res = GST_FLOW_OK;
|
||||||
gint size;
|
gint size;
|
||||||
|
@ -240,8 +237,6 @@ opus_dec_chain_parse_data (GstOpusDec * dec, GstBuffer * buf,
|
||||||
size = GST_BUFFER_SIZE (buf);
|
size = GST_BUFFER_SIZE (buf);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (dec, "received buffer of size %u", size);
|
GST_DEBUG_OBJECT (dec, "received buffer of size %u", size);
|
||||||
|
|
||||||
/* copy timestamp */
|
|
||||||
} else {
|
} else {
|
||||||
/* concealment data, pass NULL as the bits parameters */
|
/* concealment data, pass NULL as the bits parameters */
|
||||||
GST_DEBUG_OBJECT (dec, "creating concealment data");
|
GST_DEBUG_OBJECT (dec, "creating concealment data");
|
||||||
|
@ -276,20 +271,6 @@ opus_dec_chain_parse_data (GstOpusDec * dec, GstBuffer * buf,
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (dec, "decoded %d samples", n);
|
GST_DEBUG_OBJECT (dec, "decoded %d samples", n);
|
||||||
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
|
|
||||||
} else {
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = dec->next_ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_BUFFER_DURATION (outbuf) =
|
|
||||||
gst_util_uint64_scale (n, GST_SECOND, dec->sample_rate);
|
|
||||||
dec->next_ts = GST_BUFFER_TIMESTAMP (outbuf) + GST_BUFFER_DURATION (outbuf);
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (dec, "pushing buffer with ts=%" GST_TIME_FORMAT ", dur=%"
|
|
||||||
GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
|
||||||
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
|
|
||||||
|
|
||||||
res = gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), outbuf, 1);
|
res = gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), outbuf, 1);
|
||||||
|
|
||||||
if (res != GST_FLOW_OK)
|
if (res != GST_FLOW_OK)
|
||||||
|
@ -392,8 +373,7 @@ gst_opus_dec_handle_frame (GstAudioDecoder * adec, GstBuffer * buf)
|
||||||
gst_audio_decoder_finish_frame (adec, NULL, 1);
|
gst_audio_decoder_finish_frame (adec, NULL, 1);
|
||||||
res = GST_FLOW_OK;
|
res = GST_FLOW_OK;
|
||||||
} else {
|
} else {
|
||||||
res = opus_dec_chain_parse_data (dec, buf, GST_BUFFER_TIMESTAMP (buf),
|
res = opus_dec_chain_parse_data (dec, buf);
|
||||||
GST_BUFFER_DURATION (buf));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Otherwise fall back to packet counting and assume that the
|
/* Otherwise fall back to packet counting and assume that the
|
||||||
|
@ -405,8 +385,7 @@ gst_opus_dec_handle_frame (GstAudioDecoder * adec, GstBuffer * buf)
|
||||||
res = gst_opus_dec_parse_header (dec, buf);
|
res = gst_opus_dec_parse_header (dec, buf);
|
||||||
gst_audio_decoder_finish_frame (adec, NULL, 1);
|
gst_audio_decoder_finish_frame (adec, NULL, 1);
|
||||||
} else {
|
} else {
|
||||||
res = opus_dec_chain_parse_data (dec, buf, GST_BUFFER_TIMESTAMP (buf),
|
res = opus_dec_chain_parse_data (dec, buf);
|
||||||
GST_BUFFER_DURATION (buf));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -415,14 +394,12 @@ gst_opus_dec_handle_frame (GstAudioDecoder * adec, GstBuffer * buf)
|
||||||
res = gst_opus_dec_parse_comments (dec, buf);
|
res = gst_opus_dec_parse_comments (dec, buf);
|
||||||
gst_audio_decoder_finish_frame (adec, NULL, 1);
|
gst_audio_decoder_finish_frame (adec, NULL, 1);
|
||||||
} else {
|
} else {
|
||||||
res = opus_dec_chain_parse_data (dec, buf, GST_BUFFER_TIMESTAMP (buf),
|
res = opus_dec_chain_parse_data (dec, buf);
|
||||||
GST_BUFFER_DURATION (buf));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
res = opus_dec_chain_parse_data (dec, buf, GST_BUFFER_TIMESTAMP (buf),
|
res = opus_dec_chain_parse_data (dec, buf);
|
||||||
GST_BUFFER_DURATION (buf));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@ struct _GstOpusDec {
|
||||||
OpusDecoder *state;
|
OpusDecoder *state;
|
||||||
|
|
||||||
guint64 packetno;
|
guint64 packetno;
|
||||||
GstClockTime next_ts;
|
|
||||||
|
|
||||||
GstBuffer *streamheader;
|
GstBuffer *streamheader;
|
||||||
GstBuffer *vorbiscomment;
|
GstBuffer *vorbiscomment;
|
||||||
|
|
Loading…
Reference in a new issue