@@ -2250,7 +2250,7 @@ ngx_http_flv_live_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
22502250{
22512251 ngx_chain_t * tag , * chunk_head , * chunk_tail , chunk ,
22522252 * iter , * last_in , * * tail , prev_tag_size ;
2253- u_char * pos , * p ,
2253+ u_char * pos ,
22542254#if !(NGX_WIN32 )
22552255 chunk_item [ngx_strlen ("0000000000000000" CRLF ) + 1 ];
22562256#else
@@ -2279,11 +2279,8 @@ ngx_http_flv_live_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
22792279 prev_tag_size_buf .last = prev_tag_size_buf .end ;
22802280
22812281 pos = prev_tag_size_buf .pos ;
2282- p = (u_char * ) & tag_size ;
2283- * pos ++ = p [3 ];
2284- * pos ++ = p [2 ];
2285- * pos ++ = p [1 ];
2286- * pos ++ = p [0 ];
2282+ * (uint32_t * ) pos = htonl (tag_size );
2283+ pos += 4 ;
22872284
22882285 /* ngx_rtmp_alloc_shared_buf returns the memory:
22892286 * |4B|sizeof(ngx_chain_t)|sizeof(ngx_buf_t)|NGX_RTMP_MAX_CHUNK_HEADER|
@@ -2305,17 +2302,13 @@ ngx_http_flv_live_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
23052302 * pos ++ = (u_char ) (h -> type & 0x1f );
23062303
23072304 /* data length, 3B */
2308- p = (u_char * ) & data_size ;
2309- * pos ++ = p [2 ];
2310- * pos ++ = p [1 ];
2311- * pos ++ = p [0 ];
2305+ ngx_rtmp_h4_to_n3 (pos , data_size );
2306+ pos += 3 ;
23122307
23132308 /* timestamp, 3B + ext, 1B */
2314- p = (u_char * ) & h -> timestamp ;
2315- * pos ++ = p [2 ];
2316- * pos ++ = p [1 ];
2317- * pos ++ = p [0 ];
2318- * pos ++ = p [3 ];
2309+ ngx_rtmp_h4_to_n3 (pos , h -> timestamp );
2310+ pos += 3 ;
2311+ * pos ++ = (u_char ) (h -> timestamp >> 24 );
23192312
23202313 /* streamId, 3B, always be 0 */
23212314 * pos ++ = 0 ;
0 commit comments