@@ -89,6 +89,7 @@ impl NativeVideoSource {
8989 has_packet_trailer : false ,
9090 user_timestamp : 0 ,
9191 frame_id : 0 ,
92+ user_data : Vec :: new ( ) ,
9293 } ,
9394 ) ;
9495 }
@@ -115,9 +116,14 @@ impl NativeVideoSource {
115116 } ;
116117 builder. pin_mut ( ) . set_timestamp_us ( capture_ts) ;
117118
118- let ( has_trailer, user_ts, fid) = match frame. frame_metadata {
119- Some ( meta) => ( true , meta. user_timestamp . unwrap_or ( 0 ) , meta. frame_id . unwrap_or ( 0 ) ) ,
120- None => ( false , 0 , 0 ) ,
119+ let ( has_trailer, user_ts, fid, user_data) = match & frame. frame_metadata {
120+ Some ( meta) => (
121+ true ,
122+ meta. user_timestamp . unwrap_or ( 0 ) ,
123+ meta. frame_id . unwrap_or ( 0 ) ,
124+ meta. user_data . clone ( ) . unwrap_or_default ( ) ,
125+ ) ,
126+ None => ( false , 0 , 0 , Vec :: new ( ) ) ,
121127 } ;
122128
123129 self . inner . lock ( ) . captured_frames += 1 ;
@@ -128,6 +134,7 @@ impl NativeVideoSource {
128134 has_packet_trailer : has_trailer,
129135 user_timestamp : user_ts,
130136 frame_id : fid,
137+ user_data,
131138 } ,
132139 ) ;
133140 }
@@ -167,9 +174,14 @@ impl NativeVideoSource {
167174 timestamp_us : i64 ,
168175 frame_metadata : Option < FrameMetadata > ,
169176 ) -> bool {
170- let ( has_trailer, user_ts, fid) = match frame_metadata {
171- Some ( meta) => ( true , meta. user_timestamp . unwrap_or ( 0 ) , meta. frame_id . unwrap_or ( 0 ) ) ,
172- None => ( false , 0 , 0 ) ,
177+ let ( has_trailer, user_ts, fid, user_data) = match frame_metadata {
178+ Some ( meta) => (
179+ true ,
180+ meta. user_timestamp . unwrap_or ( 0 ) ,
181+ meta. frame_id . unwrap_or ( 0 ) ,
182+ meta. user_data . unwrap_or_default ( ) ,
183+ ) ,
184+ None => ( false , 0 , 0 , Vec :: new ( ) ) ,
173185 } ;
174186
175187 self . inner . lock ( ) . captured_frames += 1 ;
@@ -183,6 +195,7 @@ impl NativeVideoSource {
183195 has_packet_trailer : has_trailer,
184196 user_timestamp : user_ts,
185197 frame_id : fid,
198+ user_data,
186199 } ,
187200 )
188201 }
0 commit comments