On 17.12.2014 13:41, Martin Storsjö wrote:
+static int h261_handle_packet(AVFormatContext *ctx, PayloadContext
*rtp_h261_ctx,
+ AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
+{
+ int sbit, ebit, gobn, mbap, quant;
+ int res;
+
+ /* drop data of previous packets in case of non-continuous (loss) packet
stream */
+ if (rtp_h261_ctx->buf && rtp_h261_ctx->timestamp != *timestamp) {
+ h261_free_dyn_buffer(&rtp_h261_ctx->buf);
+ rtp_h261_ctx->endbyte_bits = 0;
+ }
Yes, that is better.
+static const uint8_t *find_resync_marker_reverse(const uint8_t *restrict start,
+ const uint8_t *restrict end)
+{
+ const uint8_t *p = end - 1;
+ start += 1; /* Make sure we never return the original start. */
+ for (; p > start; p--) {
+ if (p[0] == 0 && p[1] == 1)
+ return p;
+ }
+ return end;
+}
+
+ /* look for a better place to split the frame into packets */
+ if (cur_frame_size < frame_size) {
+ const uint8_t *packet_end = find_resync_marker_reverse(frame_buf,
+ frame_buf +
cur_frame_size);
+ cur_frame_size = packet_end - frame_buf;
+ }
+
Thanks for pointing that out.
You dropped the initial lines in mpegvideo_enc.c to support slices for
H.261. But that is okay for an initial support for RTP/H.261.
But maybe these lines are a good starting point for the future.
Your modifications to my patch are okay for me.
Best regards,
Thomas.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel