Commit a2eb4300 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

Merge branch 'plugin-move-opus'

Move Opus decoder and encoder from -bad to -base.

https://bugzilla.gnome.org/show_bug.cgi?id=756282
parents a1538045 1ef601e7
plugin_LTLIBRARIES = libgstopus.la
libgstopus_la_SOURCES = gstopus.c gstopusdec.c gstopusenc.c gstopusparse.c gstopusheader.c gstopuscommon.c gstrtpopuspay.c gstrtpopusdepay.c
libgstopus_la_CFLAGS = \
-DGST_USE_UNSTABLE_API \
$(GST_PLUGINS_BAD_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_CFLAGS) \
$(OPUS_CFLAGS)
libgstopus_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_API_VERSION) \
-lgsttag-$(GST_API_VERSION) -lgstrtp-$(GST_API_VERSION) \
-lgstpbutils-$(GST_API_VERSION) \
$(GST_BASE_LIBS) \
$(GST_LIBS) \
$(OPUS_LIBS)
libgstopus_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBM)
libgstopus_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
noinst_HEADERS = gstopusenc.h gstopusdec.h gstopusparse.h gstopusheader.h gstopuscommon.h gstrtpopuspay.h gstrtpopusdepay.h
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "gstopusdec.h"
#include "gstopusenc.h"
#include "gstopusparse.h"
#include "gstrtpopuspay.h"
#include "gstrtpopusdepay.h"
#include <gst/tag/tag.h>
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "opusenc", GST_RANK_PRIMARY,
GST_TYPE_OPUS_ENC))
return FALSE;
if (!gst_element_register (plugin, "opusdec", GST_RANK_PRIMARY,
GST_TYPE_OPUS_DEC))
return FALSE;
if (!gst_element_register (plugin, "opusparse", GST_RANK_NONE,
GST_TYPE_OPUS_PARSE))
return FALSE;
if (!gst_element_register (plugin, "rtpopusdepay", GST_RANK_SECONDARY,
GST_TYPE_RTP_OPUS_DEPAY))
return FALSE;
if (!gst_element_register (plugin, "rtpopuspay", GST_RANK_SECONDARY,
GST_TYPE_RTP_OPUS_PAY))
return FALSE;
gst_tag_register_musicbrainz_tags ();
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
opus,
"OPUS plugin library",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
/* GStreamer
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <stdio.h>
#include <string.h>
#include "gstopuscommon.h"
/* http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9 */
/* copy of the same structure in the vorbis plugin */
const GstAudioChannelPosition gst_opus_channel_positions[][8] = {
{ /* Mono */
GST_AUDIO_CHANNEL_POSITION_MONO},
{ /* Stereo */
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT},
{ /* Stereo + Centre */
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT},
{ /* Quadraphonic */
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
},
{ /* Stereo + Centre + rear stereo */
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
},
{ /* Full 5.1 Surround */
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
GST_AUDIO_CHANNEL_POSITION_LFE1,
},
{ /* 6.1 Surround, in Vorbis spec since 2010-01-13 */
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
GST_AUDIO_CHANNEL_POSITION_LFE1},
{ /* 7.1 Surround, in Vorbis spec since 2010-01-13 */
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
GST_AUDIO_CHANNEL_POSITION_LFE1},
};
const char *gst_opus_channel_names[] = {
"mono",
"front left",
"front right",
"rear center",
"rear left",
"rear right",
"lfe",
"front center",
"front left of center",
"front right of center",
"side left",
"side right",
"none"
};
void
gst_opus_common_log_channel_mapping_table (GstElement * element,
GstDebugCategory * category, const char *msg, int n_channels,
const guint8 * table)
{
int n;
GString *s;
if (gst_debug_category_get_threshold (category) < GST_LEVEL_INFO)
return;
s = g_string_new ("[ ");
for (n = 0; n < n_channels; ++n) {
g_string_append_printf (s, "%d ", table[n]);
}
g_string_append (s, "]");
GST_CAT_LEVEL_LOG (category, GST_LEVEL_INFO, element, "%s: %s", msg, s->str);
g_string_free (s, TRUE);
}
/* GStreamer Opus Encoder
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_OPUS_COMMON_H__
#define __GST_OPUS_COMMON_H__
#include <gst/gst.h>
#include <gst/audio/audio.h>
G_BEGIN_DECLS
extern const GstAudioChannelPosition gst_opus_channel_positions[][8];
extern const char *gst_opus_channel_names[];
extern void gst_opus_common_log_channel_mapping_table (GstElement *element,
GstDebugCategory * category, const char *msg,
int n_channels, const guint8 *table);
G_END_DECLS
#endif /* __GST_OPUS_COMMON_H__ */
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk>
* Copyright (C) <2011-2012> Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_OPUS_DEC_H__
#define __GST_OPUS_DEC_H__
#include <gst/gst.h>
#include <gst/audio/gstaudiodecoder.h>
#include <opus_multistream.h>
G_BEGIN_DECLS
#define GST_TYPE_OPUS_DEC \
(gst_opus_dec_get_type())
#define GST_OPUS_DEC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPUS_DEC,GstOpusDec))
#define GST_OPUS_DEC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPUS_DEC,GstOpusDecClass))
#define GST_IS_OPUS_DEC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPUS_DEC))
#define GST_IS_OPUS_DEC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPUS_DEC))
typedef struct _GstOpusDec GstOpusDec;
typedef struct _GstOpusDecClass GstOpusDecClass;
struct _GstOpusDec {
GstAudioDecoder element;
OpusMSDecoder *state;
guint64 packetno;
GstBuffer *streamheader;
GstBuffer *vorbiscomment;
guint32 sample_rate;
guint8 n_channels;
guint16 pre_skip;
gint16 r128_gain;
GstAudioChannelPosition opus_pos[64];
GstAudioInfo info;
guint8 n_streams;
guint8 n_stereo_streams;
guint8 channel_mapping_family;
guint8 channel_mapping[256];
gboolean apply_gain;
double r128_gain_volume;
gboolean use_inband_fec;
GstBuffer *last_buffer;
gboolean primed;
guint64 leftover_plc_duration;
};
struct _GstOpusDecClass {
GstAudioDecoderClass parent_class;
};
GType gst_opus_dec_get_type (void);
G_END_DECLS
#endif /* __GST_OPUS_DEC_H__ */
This diff is collapsed.
/* GStreamer Opus Encoder
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk>
* Copyright (C) <2011-2012> Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_OPUS_ENC_H__
#define __GST_OPUS_ENC_H__
#include <gst/gst.h>
#include <gst/audio/gstaudioencoder.h>
#include <opus_multistream.h>
G_BEGIN_DECLS
#define GST_TYPE_OPUS_ENC \
(gst_opus_enc_get_type())
#define GST_OPUS_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPUS_ENC,GstOpusEnc))
#define GST_OPUS_ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPUS_ENC,GstOpusEncClass))
#define GST_IS_OPUS_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPUS_ENC))
#define GST_IS_OPUS_ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPUS_ENC))
#define MAX_FRAME_SIZE 2000*2
#define MAX_FRAME_BYTES 2000
typedef enum
{
BITRATE_TYPE_CBR,
BITRATE_TYPE_VBR,
BITRATE_TYPE_CONSTRAINED_VBR,
} GstOpusEncBitrateType;
typedef struct _GstOpusEnc GstOpusEnc;
typedef struct _GstOpusEncClass GstOpusEncClass;
struct _GstOpusEnc {
GstAudioEncoder element;
OpusMSEncoder *state;
/* Locks those properties which may be changed at play time */
GMutex property_lock;
/* properties */
gint audio_type;
gint bitrate;
gint bandwidth;
gint frame_size;
GstOpusEncBitrateType bitrate_type;
gint complexity;
gboolean inband_fec;
gboolean dtx;
gint packet_loss_percentage;
guint max_payload_size;
gint frame_samples;
gint n_channels;
gint sample_rate;
guint64 encoded_samples, consumed_samples;
guint16 lookahead, pending_lookahead;
guint8 channel_mapping_family;
guint8 encoding_channel_mapping[256];
guint8 decoding_channel_mapping[256];
guint8 n_stereo_streams;
};
struct _GstOpusEncClass {
GstAudioEncoderClass parent_class;
/* signals */
void (*frame_encoded) (GstElement *element);
};
GType gst_opus_enc_get_type (void);
G_END_DECLS
#endif /* __GST_OPUS_ENC_H__ */
/* GStreamer Opus Encoder
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk>
* Copyright (C) <2011> Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/tag/tag.h>
#include <gst/base/gstbytewriter.h>
#include "gstopusheader.h"
gboolean
gst_opus_header_is_header (GstBuffer * buf, const char *magic, guint magic_size)
{
return (gst_buffer_get_size (buf) >= magic_size
&& !gst_buffer_memcmp (buf, 0, magic, magic_size));
}
gboolean
gst_opus_header_is_id_header (GstBuffer * buf)
{
gsize size = gst_buffer_get_size (buf);
guint8 *data = NULL;
guint8 version, channels, channel_mapping_family, n_streams, n_stereo_streams;
gboolean ret = FALSE;
GstMapInfo map;
if (size < 19)
goto beach;
if (!gst_opus_header_is_header (buf, "OpusHead", 8))
goto beach;
gst_buffer_map (buf, &map, GST_MAP_READ);
data = map.data;
size = map.size;
version = data[8];
if (version >= 0x0f) /* major version >=0 is what we grok */
goto beach;
channels = data[9];
if (channels == 0)
goto beach;
channel_mapping_family = data[18];
if (channel_mapping_family == 0) {
if (channels > 2)
goto beach;
} else {
channels = data[9];
if (size < 21 + channels)
goto beach;
n_streams = data[19];
n_stereo_streams = data[20];
if (n_streams == 0)
goto beach;
if (n_stereo_streams > n_streams)
goto beach;
if (n_streams + n_stereo_streams > 255)
goto beach;
}
ret = TRUE;
beach:
if (data)
gst_buffer_unmap (buf, &map);
return ret;
}
gboolean
gst_opus_header_is_comment_header (GstBuffer * buf)
{
return gst_opus_header_is_header (buf, "OpusTags", 8);
}
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk>
* Copyright (C) <2011-2012> Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_OPUS_HEADER_H__
#define __GST_OPUS_HEADER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
extern gboolean gst_opus_header_is_header (GstBuffer * buf,
const char *magic, guint magic_size);
extern gboolean gst_opus_header_is_id_header (GstBuffer * buf);
extern gboolean gst_opus_header_is_comment_header (GstBuffer * buf);
G_END_DECLS
#endif /* __GST_OPUS_HEADER_H__ */
/* GStreamer
*
* unit test for opus
*
* Copyright (C) <2011> Vincent Penquerc'h <vincent.penquerch@collbaora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <unistd.h>
#include <gst/check/gstcheck.h>
#if G_BYTE_ORDER == G_BIG_ENDIAN
#define AFORMAT "S16BE"
#else
#define AFORMAT "S16LE"
#endif
#define AUDIO_CAPS_STRING "audio/x-raw, " \
"format = (string) " AFORMAT ", "\
"layout = (string) interleaved, " \
"rate = (int) 48000, " \
"channels = (int) 1 "
/* A lot of these taken from the vorbisdec test */
/* For ease of programming we use globals to keep refs for our floating
* src and sink pads we create; otherwise we always have to do get_pad,
* get_peer, and then remove references in every test function */
static GstPad *mydecsrcpad, *mydecsinkpad;
static GstPad *myencsrcpad, *myencsinkpad;
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
static GstElement *
setup_opusdec (void)
{
GstElement *opusdec;
GST_DEBUG ("setup_opusdec");
opusdec = gst_check_setup_element ("opusdec");
mydecsrcpad = gst_check_setup_src_pad (opusdec, &srctemplate);
mydecsinkpad = gst_check_setup_sink_pad (opusdec, &sinktemplate);
gst_pad_set_active (mydecsrcpad, TRUE);
gst_pad_set_active (mydecsinkpad, TRUE);
return opusdec;
}
static void
cleanup_opusdec (GstElement * opusdec)
{
GST_DEBUG ("cleanup_opusdec");
gst_element_set_state (opusdec, GST_STATE_NULL);
gst_pad_set_active (mydecsrcpad, FALSE);
gst_pad_set_active (mydecsinkpad, FALSE);
gst_check_teardown_src_pad (opusdec);
gst_check_teardown_sink_pad (opusdec);
gst_check_teardown_element (opusdec);
}
static GstElement *
setup_opusenc (void)
{
GstElement *opusenc;
GST_DEBUG ("setup_opusenc");
opusenc = gst_check_setup_element ("opusenc");
myencsrcpad = gst_check_setup_src_pad (opusenc, &srctemplate);
myencsinkpad = gst_check_setup_sink_pad (opusenc, &sinktemplate);
gst_pad_set_active (myencsrcpad, TRUE);
gst_pad_set_active (myencsinkpad, TRUE);
return opusenc;
}
static void
cleanup_opusenc (GstElement * opusenc)
{
GST_DEBUG ("cleanup_opusenc");
gst_element_set_state (opusenc, GST_STATE_NULL);
gst_pad_set_active (myencsrcpad, FALSE);
gst_pad_set_active (myencsinkpad, FALSE);
gst_check_teardown_src_pad (opusenc);
gst_check_teardown_sink_pad (opusenc);
gst_check_teardown_element (opusenc);
}
static void
check_buffers (guint expected)
{
GstBuffer *outbuffer;
guint i, num_buffers;
/* check buffers are the type we expect */
num_buffers = g_list_length (buffers);
fail_unless (num_buffers >= expected);
for (i = 0; i < num_buffers; ++i) {
outbuffer = GST_BUFFER (buffers->data);
fail_if (outbuffer == NULL);
fail_if (gst_buffer_get_size (outbuffer) == 0);
buffers = g_list_remove (buffers, outbuffer);
ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
gst_buffer_unref (outbuffer);
outbuffer = NULL;
}
}
GST_START_TEST (test_opus_encode_nothing)
{
GstElement *opusenc;
opusenc = setup_opusenc ();
fail_unless (gst_element_set_state (opusenc,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
fail_unless (gst_pad_push_event (myencsrcpad, gst_event_new_eos ()) == TRUE);
fail_unless (gst_element_set_state (opusenc,