summaryrefslogtreecommitdiff
path: root/libavformat/rtpenc_hevc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-09-25 00:15:26 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-25 00:17:36 +0200
commitd8ddac363e77eb55150c80febc56ad58d53968e8 (patch)
tree1b7284cab39ab12d4c63c81a89f1bed35592d7e9 /libavformat/rtpenc_hevc.c
parentb8d3f7fc21b987378bb6042e038d7f598374dba8 (diff)
parentddf5fb71ee9c8b2d9a23c0f661a84896cd7050fc (diff)
Merge commit 'ddf5fb71ee9c8b2d9a23c0f661a84896cd7050fc'
* commit 'ddf5fb71ee9c8b2d9a23c0f661a84896cd7050fc': rtpenc: HEVC/H.265 support Conflicts: Changelog libavformat/rtpenc.c libavformat/rtpenc_hevc.c libavformat/version.h See: 6821a5a4adcb40c458356e8bb90416dd8f5dd6b2 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtpenc_hevc.c')
-rw-r--r--libavformat/rtpenc_hevc.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/libavformat/rtpenc_hevc.c b/libavformat/rtpenc_hevc.c
index a2516de801..ce661fa1a8 100644
--- a/libavformat/rtpenc_hevc.c
+++ b/libavformat/rtpenc_hevc.c
@@ -19,29 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "avformat.h"
#include "avc.h"
+#include "avformat.h"
#include "rtpenc.h"
#define RTP_HEVC_HEADERS_SIZE 3
-static const uint8_t *avc_mp4_find_startcode(const uint8_t *start, const uint8_t *end, int nal_length_size)
-{
- unsigned int res = 0;
-
- /* is the given data big enough for 1 NAL unit? */
- if (end - start < nal_length_size)
- return NULL;
-
- while (nal_length_size--)
- res = (res << 8) | *start++;
-
- if (res > end - start)
- return NULL;
-
- return start + res;
-}
-
static void nal_send(AVFormatContext *ctx, const uint8_t *buf, int len, int last_packet_of_frame)
{
RTPMuxContext *rtp_ctx = ctx->priv_data;
@@ -90,7 +73,7 @@ static void nal_send(AVFormatContext *ctx, const uint8_t *buf, int len, int last
buf += 2;
len -= 2;
- while (len + RTP_HEVC_HEADERS_SIZE > rtp_ctx->max_payload_size) {
+ while (len > rtp_payload_size) {
/* complete and send current RTP packet */
memcpy(&rtp_ctx->buf[RTP_HEVC_HEADERS_SIZE], buf, rtp_payload_size);
ff_rtp_send_data(ctx, rtp_ctx->buf, rtp_ctx->max_payload_size, 0);
@@ -121,20 +104,21 @@ void ff_rtp_send_hevc(AVFormatContext *ctx, const uint8_t *frame_buf, int frame_
rtp_ctx->timestamp = rtp_ctx->cur_timestamp;
if (rtp_ctx->nal_length_size)
- buf_ptr = avc_mp4_find_startcode(frame_buf, buf_end, rtp_ctx->nal_length_size) ? frame_buf : buf_end;
+ buf_ptr = ff_avc_mp4_find_startcode(frame_buf, buf_end, rtp_ctx->nal_length_size) ? frame_buf : buf_end;
else
buf_ptr = ff_avc_find_startcode(frame_buf, buf_end);
/* find all NAL units and send them as separate packets */
while (buf_ptr < buf_end) {
if (rtp_ctx->nal_length_size) {
- next_NAL_unit = avc_mp4_find_startcode(buf_ptr, buf_end, rtp_ctx->nal_length_size);
+ next_NAL_unit = ff_avc_mp4_find_startcode(buf_ptr, buf_end, rtp_ctx->nal_length_size);
if (!next_NAL_unit)
next_NAL_unit = buf_end;
buf_ptr += rtp_ctx->nal_length_size;
} else {
- while (!*(buf_ptr++)) ;
+ while (!*(buf_ptr++))
+ ;
next_NAL_unit = ff_avc_find_startcode(buf_ptr, buf_end);
}
/* send the next NAL unit */