@@ -131,6 +131,8 @@ static int tx_ancillary_session_init_hdr(struct mtl_main_impl* impl,
131131 struct rte_ipv4_hdr * ipv4 = & hdr -> ipv4 ;
132132 struct rte_udp_hdr * udp = & hdr -> udp ;
133133 struct st40_rfc8331_rtp_hdr * rtp = & hdr -> rtp ;
134+
135+ /* Print rtp_header in both host and network byte order to check endianness */
134136 uint8_t * dip = ops -> dip_addr [s_port ];
135137 uint8_t * sip = mt_sip_addr (impl , port );
136138 struct rte_ether_addr * d_addr = mt_eth_d_addr (eth );
@@ -465,19 +467,21 @@ static int tx_ancillary_session_build_packet(struct st_tx_ancillary_session_impl
465467 pkt -> data_len += payload_size + sizeof (struct st40_rfc8331_rtp_hdr );
466468 pkt -> pkt_len = pkt -> data_len ;
467469 rtp -> length = htons (payload_size );
468- rtp -> anc_count = idx - s -> st40_pkt_idx ;
470+ rtp -> first_hdr_chunk . anc_count = idx - s -> st40_pkt_idx ;
469471 if (s -> ops .interlaced ) {
470472 if (frame_info -> tc_meta .second_field )
471- rtp -> f = 0b11 ;
473+ rtp -> first_hdr_chunk . f = 0b11 ;
472474 else
473- rtp -> f = 0b10 ;
475+ rtp -> first_hdr_chunk . f = 0b10 ;
474476 } else {
475- rtp -> f = 0b00 ;
477+ rtp -> first_hdr_chunk . f = 0b00 ;
476478 }
477479 if (idx == anc_count ) rtp -> base .marker = 1 ;
478480 dbg ("%s(%d), anc_count %d, payload_size %d\n" , __func__ , s -> idx , anc_count ,
479481 payload_size );
480482
483+ rtp -> swapped_first_hdr_chunk = htonl (rtp -> swapped_first_hdr_chunk );
484+
481485 udp -> dgram_len = htons (pkt -> pkt_len - pkt -> l2_len - pkt -> l3_len );
482486 ipv4 -> total_length = htons (pkt -> pkt_len - pkt -> l2_len );
483487
@@ -553,16 +557,19 @@ static int tx_ancillary_session_build_rtp_packet(struct st_tx_ancillary_session_
553557 pkt -> data_len = payload_size + sizeof (struct st40_rfc8331_rtp_hdr );
554558 pkt -> pkt_len = pkt -> data_len ;
555559 rtp -> length = htons (payload_size );
556- rtp -> anc_count = idx - anc_idx ;
560+ rtp -> first_hdr_chunk . anc_count = idx - anc_idx ;
557561 if (s -> ops .interlaced ) {
558562 if (frame_info -> tc_meta .second_field )
559- rtp -> f = 0b11 ;
563+ rtp -> first_hdr_chunk . f = 0b11 ;
560564 else
561- rtp -> f = 0b10 ;
565+ rtp -> first_hdr_chunk . f = 0b10 ;
562566 } else {
563- rtp -> f = 0b00 ;
567+ rtp -> first_hdr_chunk . f = 0b00 ;
564568 }
565569 if (idx == anc_count ) rtp -> base .marker = 1 ;
570+
571+ rtp -> swapped_first_hdr_chunk = htonl (rtp -> swapped_first_hdr_chunk );
572+
566573 dbg ("%s(%d), anc_count %d, payload_size %d\n" , __func__ , s -> idx , anc_count ,
567574 payload_size );
568575 return idx ;
@@ -595,7 +602,8 @@ static int tx_ancillary_session_rtp_update_packet(struct mtl_main_impl* impl,
595602 bool second_field = false;
596603 if (s -> ops .interlaced ) {
597604 struct st40_rfc8331_rtp_hdr * rfc8331 = (struct st40_rfc8331_rtp_hdr * )rtp ;
598- second_field = (rfc8331 -> f == 0b11 ) ? true : false;
605+ second_field = (rfc8331 -> first_hdr_chunk .f == 0b11 ) ? true : false;
606+ rfc8331 -> swapped_first_hdr_chunk = htonl (rfc8331 -> swapped_first_hdr_chunk );
599607 }
600608 tx_ancillary_session_sync_pacing (impl , s , false, 0 , second_field );
601609 }
@@ -651,14 +659,16 @@ static int tx_ancillary_session_build_packet_chain(struct mtl_main_impl* impl,
651659 bool second_field = false;
652660 if (s -> ops .interlaced ) {
653661 struct st40_rfc8331_rtp_hdr * rfc8331 = (struct st40_rfc8331_rtp_hdr * )& udp [1 ];
654- second_field = (rfc8331 -> f == 0b11 ) ? true : false;
662+ second_field = (rfc8331 -> first_hdr_chunk .f == 0b11 ) ? true : false;
663+ rfc8331 -> swapped_first_hdr_chunk = htonl (rfc8331 -> swapped_first_hdr_chunk );
655664 }
656665 tx_ancillary_session_sync_pacing (impl , s , false, 0 , second_field );
657666 }
658667 if (s -> ops .flags & ST40_TX_FLAG_USER_TIMESTAMP ) {
659668 s -> pacing .rtp_time_stamp = ntohl (rtp -> base .tmstamp );
660669 }
661670 rtp -> base .tmstamp = htonl (s -> pacing .rtp_time_stamp );
671+ rtp -> swapped_first_hdr_chunk = htonl (rtp -> swapped_first_hdr_chunk );
662672 }
663673 }
664674
0 commit comments