Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
GStreamer
gst-plugins-good
Commits
137672ff
Commit
137672ff
authored
Jul 01, 2015
by
Sebastian Dröge
🍵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtpgsmpay: Attach payload to the output buffer instead of copying it
parent
cb0232ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
18 deletions
+5
-18
gst/rtp/gstrtpgsmpay.c
gst/rtp/gstrtpgsmpay.c
+5
-18
No files found.
gst/rtp/gstrtpgsmpay.c
View file @
137672ff
...
...
@@ -25,8 +25,10 @@
#include <stdlib.h>
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/audio/audio.h>
#include "gstrtpgsmpay.h"
#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC
(
rtpgsmpay_debug
);
#define GST_CAT_DEFAULT (rtpgsmpay_debug)
...
...
@@ -127,21 +129,16 @@ gst_rtp_gsm_pay_handle_buffer (GstRTPBasePayload * basepayload,
GstRTPGSMPay
*
rtpgsmpay
;
guint
payload_len
;
GstBuffer
*
outbuf
;
GstMapInfo
map
;
guint8
*
payload
;
GstClockTime
timestamp
,
duration
;
GstFlowReturn
ret
;
GstRTPBuffer
rtp
=
{
NULL
};
rtpgsmpay
=
GST_RTP_GSM_PAY
(
basepayload
);
gst_buffer_map
(
buffer
,
&
map
,
GST_MAP_READ
);
timestamp
=
GST_BUFFER_PTS
(
buffer
);
duration
=
GST_BUFFER_DURATION
(
buffer
);
/* FIXME, only one GSM frame per RTP packet for now */
payload_len
=
map
.
size
;
payload_len
=
gst_buffer_get_size
(
buffer
)
;
/* FIXME, just error out for now */
if
(
payload_len
>
GST_RTP_BASE_PAYLOAD_MTU
(
rtpgsmpay
))
...
...
@@ -153,17 +150,8 @@ gst_rtp_gsm_pay_handle_buffer (GstRTPBasePayload * basepayload,
GST_BUFFER_PTS
(
outbuf
)
=
timestamp
;
GST_BUFFER_DURATION
(
outbuf
)
=
duration
;
/* get payload */
gst_rtp_buffer_map
(
outbuf
,
GST_MAP_WRITE
,
&
rtp
);
/* copy data in payload */
payload
=
gst_rtp_buffer_get_payload
(
&
rtp
);
memcpy
(
payload
,
map
.
data
,
map
.
size
);
gst_rtp_buffer_unmap
(
&
rtp
);
gst_buffer_unmap
(
buffer
,
&
map
);
gst_buffer_unref
(
buffer
);
/* append payload */
outbuf
=
gst_buffer_append
(
outbuf
,
buffer
);
GST_DEBUG
(
"gst_rtp_gsm_pay_chain: pushing buffer of size %"
G_GSIZE_FORMAT
,
gst_buffer_get_size
(
outbuf
));
...
...
@@ -178,7 +166,6 @@ too_big:
GST_ELEMENT_ERROR
(
rtpgsmpay
,
STREAM
,
ENCODE
,
(
NULL
),
(
"payload_len %u > mtu %u"
,
payload_len
,
GST_RTP_BASE_PAYLOAD_MTU
(
rtpgsmpay
)));
gst_buffer_unmap
(
buffer
,
&
map
);
return
GST_FLOW_ERROR
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment