summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavformat/rtpenc.c8
-rw-r--r--libavformat/rtpenc_hevc.c28
-rw-r--r--libavformat/sdp.c6
-rw-r--r--libavformat/version.h4
4 files changed, 19 insertions, 27 deletions
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index dfaccef2e2..c608dfb46a 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -202,9 +202,11 @@ static int rtp_write_header(AVFormatContext *s1)
}
break;
case AV_CODEC_ID_HEVC:
- if (st->codec->extradata_size > 21 &&
- (st->codec->extradata[0] || st->codec->extradata[1] ||
- st->codec->extradata[2] > 1)) {
+ /* Only check for the standardized hvcC version of extradata, keeping
+ * things simple and similar to the avcC/H264 case above, instead
+ * of trying to handle the pre-standardization versions (as in
+ * libavcodec/hevc.c). */
+ if (st->codec->extradata_size > 21 && st->codec->extradata[0] == 1) {
s->nal_length_size = (st->codec->extradata[21] & 0x03) + 1;
}
break;
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 */
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 8c831f3607..a926cf89f2 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -428,6 +428,12 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
payload_type,
payload_type, c->width, c->height);
break;
+ case AV_CODEC_ID_HEVC:
+ if (c->extradata_size)
+ av_log(NULL, AV_LOG_WARNING, "HEVC extradata not currently "
+ "passed properly through SDP\n");
+ av_strlcatf(buff, size, "a=rtpmap:%d H265/90000\r\n", payload_type);
+ break;
case AV_CODEC_ID_MPEG4:
if (c->extradata_size) {
config = extradata2config(c);
diff --git a/libavformat/version.h b/libavformat/version.h
index 61decb94a3..b1dde2c061 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,8 +30,8 @@
#include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 56
-#define LIBAVFORMAT_VERSION_MINOR 4
-#define LIBAVFORMAT_VERSION_MICRO 103
+#define LIBAVFORMAT_VERSION_MINOR 5
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \