From 8e91b3b3c516e41174f27d40690c7416802f9e4f Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 27 Oct 2009 16:16:50 +0100 Subject: [PATCH] ac3parse: improve src caps settings --- gst/audioparsers/gstac3parse.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gst/audioparsers/gstac3parse.c b/gst/audioparsers/gstac3parse.c index 4b74a52bca..c497feadbe 100644 --- a/gst/audioparsers/gstac3parse.c +++ b/gst/audioparsers/gstac3parse.c @@ -411,12 +411,17 @@ gst_ac3_parse_parse_frame (GstBaseParse * parse, GstBuffer * buf) goto broken_header; GST_LOG_OBJECT (parse, "size: %u, rate: %u, chans: %u", fsize, rate, chans); - { - GstCaps *caps = gst_caps_new_simple ("audio/x-ac3", "rate", G_TYPE_INT, - rate, "channels", G_TYPE_INT, chans, NULL); + + if (G_UNLIKELY (ac3parse->sample_rate != rate || ac3parse->channels != chans)) { + GstCaps *caps = gst_caps_new_simple ("audio/x-ac3", + "framed", G_TYPE_BOOLEAN, TRUE, "rate", G_TYPE_INT, rate, + "channels", G_TYPE_INT, chans, NULL); gst_buffer_set_caps (buf, caps); gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps); gst_caps_unref (caps); + + ac3parse->sample_rate = rate; + ac3parse->channels = chans; } return GST_FLOW_OK;