int decode_sdpparam_h264(struct videnc_state *st, const struct pl *name, const struct pl *val) { if (0 == pl_strcasecmp(name, "packetization-mode")) { st->u.h264.packetization_mode = pl_u32(val); if (st->u.h264.packetization_mode != 0) { warning("avcodec: illegal packetization-mode %u\n", st->u.h264.packetization_mode); return EPROTO; } } else if (0 == pl_strcasecmp(name, "profile-level-id")) { struct pl prof = *val; if (prof.l != 6) { warning("avcodec: invalid profile-level-id (%r)\n", val); return EPROTO; } prof.l = 2; st->u.h264.profile_idc = pl_x32(&prof); prof.p += 2; st->u.h264.profile_iop = pl_x32(&prof); prof.p += 2; st->u.h264.level_idc = pl_x32(&prof); } else if (0 == pl_strcasecmp(name, "max-fs")) { st->u.h264.max_fs = pl_u32(val); } else if (0 == pl_strcasecmp(name, "max-smbps")) { st->u.h264.max_smbps = pl_u32(val); } return 0; }
static bool nonce_validate(char *nonce, uint32_t now, const struct sa *src) { struct pl pl; uint32_t v; if (strlen(nonce) != NONCE_SIZE) { restund_info("auth: bad nonce length (%u)\n", strlen(nonce)); return false; } pl.p = nonce; pl.l = 8; v = pl_x32(&pl) ^ auth.rand_time; if (v + auth.nonce_expiry < now) { restund_debug("auth: nonce expired\n"); return false; } pl.p += 8; v = pl_x32(&pl) ^ auth.rand_addr; if (v != sa_hash(src, SA_ADDR)) { restund_info("auth: bad nonce src address (%j)\n", src); return false; } return true; }
/* decode sdpparameter for h264 */ static void param_handler(const struct pl *name, const struct pl *val, void *arg) { struct videnc_state *st = arg; if (0 == pl_strcasecmp(name, "packetization-mode")) { st->h264.packetization_mode = pl_u32(val); if (st->h264.packetization_mode != 0) { warning("gst_video: illegal packetization-mode %u\n", st->h264.packetization_mode); return; } } else if (0 == pl_strcasecmp(name, "profile-level-id")) { struct pl prof = *val; if (prof.l != 6) { warning("gst_video: invalid profile-level-id (%r)\n", val); return; } prof.l = 2; st->h264.profile_idc = pl_x32(&prof); prof.p += 2; st->h264.profile_iop = pl_x32(&prof); prof.p += 2; st->h264.level_idc = pl_x32(&prof); } else if (0 == pl_strcasecmp(name, "max-fs")) { st->h264.max_fs = pl_u32(val); } else if (0 == pl_strcasecmp(name, "max-smbps")) { st->h264.max_smbps = pl_u32(val); } return; }