mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
Merge remote-tracking branch 'origin/0.10'
Conflicts: NEWS RELEASE common configure.ac docs/libs/gst-plugins-bad-libs-sections.txt docs/plugins/gst-plugins-bad-plugins.args docs/plugins/gst-plugins-bad-plugins.hierarchy docs/plugins/gst-plugins-bad-plugins.interfaces docs/plugins/inspect/plugin-adpcmdec.xml docs/plugins/inspect/plugin-adpcmenc.xml docs/plugins/inspect/plugin-assrender.xml docs/plugins/inspect/plugin-audiovisualizers.xml docs/plugins/inspect/plugin-autoconvert.xml docs/plugins/inspect/plugin-bayer.xml docs/plugins/inspect/plugin-bz2.xml docs/plugins/inspect/plugin-camerabin2.xml docs/plugins/inspect/plugin-celt.xml docs/plugins/inspect/plugin-dataurisrc.xml docs/plugins/inspect/plugin-debugutilsbad.xml docs/plugins/inspect/plugin-dtmf.xml docs/plugins/inspect/plugin-dtsdec.xml docs/plugins/inspect/plugin-dvbsuboverlay.xml docs/plugins/inspect/plugin-dvdspu.xml docs/plugins/inspect/plugin-faac.xml docs/plugins/inspect/plugin-faad.xml docs/plugins/inspect/plugin-gsm.xml docs/plugins/inspect/plugin-h264parse.xml docs/plugins/inspect/plugin-mms.xml docs/plugins/inspect/plugin-modplug.xml docs/plugins/inspect/plugin-mpeg2enc.xml docs/plugins/inspect/plugin-mpegdemux2.xml docs/plugins/inspect/plugin-mpegtsdemux.xml docs/plugins/inspect/plugin-mpegvideoparse.xml docs/plugins/inspect/plugin-mplex.xml docs/plugins/inspect/plugin-pcapparse.xml docs/plugins/inspect/plugin-rawparse.xml docs/plugins/inspect/plugin-rtpmux.xml docs/plugins/inspect/plugin-rtpvp8.xml docs/plugins/inspect/plugin-scaletempo.xml docs/plugins/inspect/plugin-schro.xml docs/plugins/inspect/plugin-sdp.xml docs/plugins/inspect/plugin-segmentclip.xml docs/plugins/inspect/plugin-shm.xml docs/plugins/inspect/plugin-videomaxrate.xml docs/plugins/inspect/plugin-videoparsersbad.xml docs/plugins/inspect/plugin-vp8.xml docs/plugins/inspect/plugin-y4mdec.xml ext/celt/gstceltdec.c ext/dts/gstdtsdec.c ext/modplug/gstmodplug.cc ext/opus/gstopusenc.c gst-libs/gst/video/gstbasevideocodec.c gst-libs/gst/video/gstbasevideocodec.h gst-libs/gst/video/gstbasevideodecoder.c gst-libs/gst/video/gstbasevideodecoder.h gst-libs/gst/video/gstbasevideoencoder.c gst-libs/gst/video/gstbasevideoencoder.h gst/adpcmdec/Makefile.am gst/audiovisualizers/gstbaseaudiovisualizer.c gst/h264parse/gsth264parse.c gst/mpegdemux/mpegtsparse.c gst/mpegtsdemux/mpegtsbase.c gst/mpegtsdemux/mpegtspacketizer.c gst/mpegtsdemux/mpegtsparse.c gst/mpegtsdemux/tsdemux.c gst/mpegtsdemux/tsdemux.h gst/mxf/mxfdemux.c gst/rawparse/gstaudioparse.c gst/videoparsers/gsth263parse.c gst/videoparsers/gsth264parse.c sys/d3dvideosink/d3dvideosink.c sys/decklink/gstdecklinksink.cpp sys/dvb/gstdvbsrc.c sys/shm/gstshmsrc.c sys/vdpau/h264/gstvdph264dec.c sys/vdpau/mpeg/gstvdpmpegdec.c tests/examples/opencv/gst_element_print_properties.c win32/common/config.h
This commit is contained in:
commit
cdf9e0ecef
1 changed files with 37 additions and 40 deletions
|
@ -368,11 +368,9 @@ gst_opus_enc_setup_base_class (GstOpusEnc * enc, GstAudioEncoder * benc)
|
|||
{
|
||||
gst_audio_encoder_set_latency (benc,
|
||||
gst_opus_enc_get_latency (enc), gst_opus_enc_get_latency (enc));
|
||||
gst_audio_encoder_set_frame_samples_min (benc,
|
||||
enc->frame_samples * enc->n_channels * 2);
|
||||
gst_audio_encoder_set_frame_samples_max (benc,
|
||||
enc->frame_samples * enc->n_channels * 2);
|
||||
gst_audio_encoder_set_frame_max (benc, 0);
|
||||
gst_audio_encoder_set_frame_samples_min (benc, enc->frame_samples);
|
||||
gst_audio_encoder_set_frame_samples_max (benc, enc->frame_samples);
|
||||
gst_audio_encoder_set_frame_max (benc, 1);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -789,6 +787,9 @@ gst_opus_enc_encode (GstOpusEnc * enc, GstBuffer * buf)
|
|||
gsize bytes = enc->frame_samples * enc->n_channels * 2;
|
||||
gint ret = GST_FLOW_OK;
|
||||
GstMapInfo map;
|
||||
GstMapInfo omap;
|
||||
gint outsize;
|
||||
GstBuffer *outbuf;
|
||||
|
||||
g_mutex_lock (enc->property_lock);
|
||||
|
||||
|
@ -813,50 +814,46 @@ gst_opus_enc_encode (GstOpusEnc * enc, GstBuffer * buf)
|
|||
goto done;
|
||||
}
|
||||
|
||||
while (size) {
|
||||
gint encoded_size;
|
||||
GstBuffer *outbuf;
|
||||
GstMapInfo omap;
|
||||
g_assert (size == bytes);
|
||||
|
||||
outbuf = gst_buffer_new_and_alloc (enc->max_payload_size * enc->n_channels);
|
||||
if (!outbuf)
|
||||
goto done;
|
||||
outbuf = gst_buffer_new_and_alloc (enc->max_payload_size * enc->n_channels);
|
||||
if (!outbuf)
|
||||
goto done;
|
||||
|
||||
GST_DEBUG_OBJECT (enc, "encoding %d samples (%d bytes)",
|
||||
enc->frame_samples, (int) bytes);
|
||||
GST_DEBUG_OBJECT (enc, "encoding %d samples (%d bytes)",
|
||||
enc->frame_samples, (int) bytes);
|
||||
|
||||
gst_buffer_map (outbuf, &omap, GST_MAP_WRITE);
|
||||
encoded_size =
|
||||
opus_multistream_encode (enc->state, (const gint16 *) data,
|
||||
enc->frame_samples, omap.data, enc->max_payload_size * enc->n_channels);
|
||||
gst_buffer_unmap (outbuf, &omap);
|
||||
gst_buffer_map (outbuf, &omap, GST_MAP_WRITE);
|
||||
|
||||
if (encoded_size < 0) {
|
||||
GST_ERROR_OBJECT (enc, "Encoding failed: %d", encoded_size);
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto done;
|
||||
} else if (encoded_size > enc->max_payload_size) {
|
||||
GST_WARNING_OBJECT (enc,
|
||||
"Encoded size %d is higher than max payload size (%d bytes)",
|
||||
encoded_size, enc->max_payload_size);
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto done;
|
||||
}
|
||||
GST_DEBUG_OBJECT (enc, "encoding %d samples (%d bytes)",
|
||||
enc->frame_samples, (int) bytes);
|
||||
|
||||
GST_DEBUG_OBJECT (enc, "Output packet is %u bytes", encoded_size);
|
||||
gst_buffer_set_size (outbuf, encoded_size);
|
||||
outsize =
|
||||
opus_multistream_encode (enc->state, (const gint16 *) data,
|
||||
enc->frame_samples, GST_BUFFER_DATA (outbuf),
|
||||
enc->max_payload_size * enc->n_channels);
|
||||
|
||||
ret =
|
||||
gst_audio_encoder_finish_frame (GST_AUDIO_ENCODER (enc), outbuf,
|
||||
enc->frame_samples);
|
||||
gst_buffer_unmap (outbuf, &omap);
|
||||
|
||||
if ((GST_FLOW_OK != ret) && (GST_FLOW_NOT_LINKED != ret))
|
||||
goto done;
|
||||
|
||||
data += bytes;
|
||||
size -= bytes;
|
||||
if (outsize < 0) {
|
||||
GST_ERROR_OBJECT (enc, "Encoding failed: %d", outsize);
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto done;
|
||||
} else if (outsize > enc->max_payload_size) {
|
||||
GST_WARNING_OBJECT (enc,
|
||||
"Encoded size %d is higher than max payload size (%d bytes)",
|
||||
outsize, enc->max_payload_size);
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto done;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (enc, "Output packet is %u bytes", outsize);
|
||||
GST_BUFFER_SIZE (outbuf) = outsize;
|
||||
|
||||
ret =
|
||||
gst_audio_encoder_finish_frame (GST_AUDIO_ENCODER (enc), outbuf,
|
||||
enc->frame_samples);
|
||||
|
||||
done:
|
||||
|
||||
if (bdata)
|
||||
|
|
Loading…
Reference in a new issue