@@ -582,7 +582,7 @@ static GstFlowReturn gst_mtl_st40p_tx_parse_8331_anc_words(
582
582
* data_size points to the correct offset for the current ANC packet
583
583
*/
584
584
if (gst_mtl_st40p_tx_parse_8331_meta (frame_info , payload_header , i ,
585
- frame_info -> anc_frame -> data_size )) {
585
+ frame_info -> udw_buffer_fill )) {
586
586
GST_ERROR ("Failed to parse 8331 meta" );
587
587
return GST_FLOW_ERROR ;
588
588
}
@@ -595,13 +595,17 @@ static GstFlowReturn gst_mtl_st40p_tx_parse_8331_anc_words(
595
595
* Start processing actual user data words from the 3rd UDW onward.
596
596
*/
597
597
for (int j = 0 ; j < data_count ; j ++ ) {
598
+ if (frame_info -> udw_buffer_fill >= frame_info -> udw_buffer_size ) {
599
+ GST_ERROR ("UDW buffer overflow: fill=%u size=%zu" , frame_info -> udw_buffer_fill , frame_info -> udw_buffer_size );
600
+ return GST_FLOW_ERROR ;
601
+ }
602
+
598
603
udw = st40_get_udw ((j + 3 ), payload_cursor );
599
604
if (!st40_check_parity_bits (udw )) {
600
605
GST_ERROR ("Ancillary data parity bits check failed" );
601
606
return GST_FLOW_ERROR ;
602
607
}
603
-
604
- frame_info -> udw_buff_addr [frame_info -> udw_buffer_fill ++ ] = udw & 0xff ;
608
+ frame_info -> udw_buff_addr [frame_info -> udw_buffer_fill ++ ] = (udw & 0xff );
605
609
}
606
610
607
611
bytes_left_to_process -= udw_byte_size ;
@@ -711,6 +715,10 @@ static GstFlowReturn gst_mtl_st40p_tx_parse_memory_block(Gst_Mtl_St40p_Tx* sink,
711
715
: bytes_left_to_process ;
712
716
713
717
memcpy (frame_info -> udw_buff_addr , cur_addr_buf , bytes_left_to_process_cur );
718
+ for (int i = 0 ; i < bytes_left_to_process_cur ; i ++ ) {
719
+ printf ("%d" , frame_info -> udw_buff_addr [i ]);
720
+ }
721
+ printf ("\n" );
714
722
715
723
gst_mtl_st40p_tx_fill_meta (frame_info -> anc_frame , frame_info -> udw_buff_addr ,
716
724
bytes_left_to_process_cur , sink -> did , sink -> sdid );
0 commit comments