aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-01 01:08:00 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-01 01:08:07 +0100
commit41b8d154aa542f8b8cb02f0e7626081fa9ace9ec (patch)
tree578cc6ce4e3e21fee0700556a3a945f2c0c78923
parent635403e078a017c7c9c633976a986573e09ee939 (diff)
parentd16c8d28d4e2fca3af1054ffbf635c8cee755fc8 (diff)
downloadffmpeg-41b8d154aa542f8b8cb02f0e7626081fa9ace9ec.tar.gz
Merge commit 'd16c8d28d4e2fca3af1054ffbf635c8cee755fc8'
* commit 'd16c8d28d4e2fca3af1054ffbf635c8cee755fc8': rtpenc_aac: Use AV_WB16 instead of manual bitshifts Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/rtpenc_aac.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/libavformat/rtpenc_aac.c b/libavformat/rtpenc_aac.c
index 9bb340e893..981ae3706f 100644
--- a/libavformat/rtpenc_aac.c
+++ b/libavformat/rtpenc_aac.c
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/intreadwrite.h"
+
#include "avformat.h"
#include "rtpenc.h"
@@ -45,8 +47,7 @@ void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
memmove(p + 2, s->buf + 2, au_size);
}
/* Write the AU header size */
- p[0] = au_size >> 5;
- p[1] = (au_size & 0x1F) << 3;
+ AV_WB16(p, au_size * 8);
ff_rtp_send_data(s1, p, s->buf_ptr - p, 1);
@@ -59,8 +60,7 @@ void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
if (size <= max_packet_size) {
p = s->buf + s->num_frames++ * 2 + 2;
- *p++ = size >> 5;
- *p = (size & 0x1F) << 3;
+ AV_WB16(p, size * 8);
memcpy(s->buf_ptr, buff, size);
s->buf_ptr += size;
} else {
@@ -68,12 +68,10 @@ void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
max_packet_size = s->max_payload_size - 4;
p = s->buf;
- p[0] = 0;
- p[1] = 16;
+ AV_WB16(p, 2 * 8);
while (size > 0) {
len = FFMIN(size, max_packet_size);
- p[2] = au_size >> 5;
- p[3] = (au_size & 0x1F) << 3;
+ AV_WB16(&p[2], au_size * 8);
memcpy(p + 4, buff, len);
ff_rtp_send_data(s1, p, len + 4, len == size);
size -= len;