implemented amf context flag to save context instead of actual value

This commit is contained in:
Roman Arutyunyan 2012-07-06 12:38:11 +04:00
parent fb89d9b931
commit d0ec6881c1
2 changed files with 16 additions and 8 deletions

View file

@ -291,14 +291,14 @@ ngx_int_t
ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
size_t nelts)
{
void *data;
ngx_int_t type;
uint8_t type8;
size_t n;
uint16_t len;
ngx_int_t rc;
u_char buf[8];
uint32_t max_index;
void *data;
ngx_int_t type;
uint8_t type8;
size_t n;
uint16_t len;
ngx_int_t rc;
u_char buf[8];
uint32_t max_index;
for(n = 0; n < nelts; ++n) {
@ -320,6 +320,13 @@ ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
ngx_rtmp_amf_is_compatible_type(elts->type & 0xff, type))
? elts->data
: NULL;
if (elts && (elts->type & NGX_RTMP_AMF_CONTEXT)) {
if (data) {
*(ngx_rtmp_amf_ctx_t *) data = *ctx;
}
data = NULL;
}
}
switch (type) {

View file

@ -31,6 +31,7 @@
/* r/w flags */
#define NGX_RTMP_AMF_OPTIONAL 0x1000
#define NGX_RTMP_AMF_TYPELESS 0x2000
#define NGX_RTMP_AMF_CONTEXT 0x4000
#define NGX_RTMP_AMF_VARIANT (NGX_RTMP_AMF_VARIANT_\
|NGX_RTMP_AMF_TYPELESS)