@@ -102,13 +102,16 @@ typedef struct st_mediatest_stream_ctx_t {
102
102
unsigned int finished_sending : 1 ;
103
103
unsigned int fin_received : 1 ;
104
104
unsigned int is_fin_sent : 1 ;
105
+ unsigned int is_reset : 1 ;
105
106
106
107
uint64_t frames_to_send ;
107
108
uint64_t frames_sent ;
109
+ uint64_t frames_skipped ;
108
110
uint64_t frames_received ;
109
111
size_t bytes_sent ;
110
112
size_t bytes_received ;
111
113
uint64_t next_frame_time ;
114
+ uint64_t next_iframe_time ;
112
115
113
116
mediatest_message_buffer_t message_sent ;
114
117
mediatest_message_buffer_t message_received ;
@@ -446,11 +449,40 @@ int mediatest_receive_stream_data(mediatest_stream_ctx_t* stream_ctx, uint8_t* b
446
449
return ret ;
447
450
}
448
451
452
+ /* For the high speed video stream, check if the media is far behind. if
453
+ * it is, mark the current state as "skipping". If the state is marked
454
+ * "reset", abstain from sending any frame until the next I frame.
455
+ */
456
+ void mediatest_simulate_reset (mediatest_stream_ctx_t * stream_ctx , uint64_t current_time , uint64_t frame_duration , uint64_t cycle_length , uint64_t queue_limit )
457
+ {
458
+ uint64_t frame_rank = stream_ctx -> frames_sent % cycle_length ;
459
+
460
+ if (frame_rank != 0 ){
461
+ if ((stream_ctx -> frames_sent + queue_limit * frame_duration ) > current_time ) {
462
+ stream_ctx -> is_reset = 1 ;
463
+ }
464
+ if (stream_ctx -> is_reset ) {
465
+ for (uint64_t i = frame_rank ; i < cycle_length ; i ++ ) {
466
+ stream_ctx -> next_frame_time += frame_duration ;
467
+ stream_ctx -> frames_sent ++ ;
468
+ stream_ctx -> frames_skipped ++ ;
469
+ }
470
+ }
471
+ }
472
+ else {
473
+ stream_ctx -> is_reset = 0 ;
474
+ }
475
+ }
476
+
449
477
/* Prepare next frame. Do this as soon as we know that a new frame can be sent. */
450
478
int mediatest_prepare_new_frame (mediatest_stream_ctx_t * stream_ctx , uint64_t current_time )
451
479
{
452
480
int ret = 0 ;
453
- /* Is this the right time? */
481
+ /* Is the high bandwidth stream reset? */
482
+ if (stream_ctx -> stream_type == media_test_video2 ) {
483
+ mediatest_simulate_reset (stream_ctx , current_time , MEDIATEST_VIDEO_PERIOD , 100 , 10 );
484
+ }
485
+ /* Is this the right time? */
454
486
if (stream_ctx -> next_frame_time <= current_time ) {
455
487
if (stream_ctx -> frames_sent == 0 ) {
456
488
stream_ctx -> next_frame_time = current_time ;
@@ -470,8 +502,12 @@ int mediatest_prepare_new_frame(mediatest_stream_ctx_t* stream_ctx, uint64_t cur
470
502
case media_test_video :
471
503
stream_ctx -> message_sent .message_size = ((stream_ctx -> frames_sent % 100 ) == 0 ) ? 0x8000 : 0x800 ;
472
504
stream_ctx -> next_frame_time += MEDIATEST_VIDEO_PERIOD ;
505
+
473
506
break ;
474
507
case media_test_video2 :
508
+ if ((stream_ctx -> frames_sent % 100 ) == 0 ) {
509
+ stream_ctx -> next_iframe_time = stream_ctx -> next_frame_time + 100 * MEDIATEST_VIDEO_PERIOD ;
510
+ }
475
511
stream_ctx -> message_sent .message_size = ((stream_ctx -> frames_sent % 100 ) == 0 ) ? 0x10000 : 0x1800 ;
476
512
stream_ctx -> next_frame_time += MEDIATEST_VIDEO_PERIOD ;
477
513
break ;
@@ -1211,6 +1247,7 @@ int mediatest_one(mediatest_id_enum media_test_id, mediatest_spec_t * spec)
1211
1247
uint64_t sim_time = 0 ;
1212
1248
uint64_t blocked_sequence = 4 ;
1213
1249
uint64_t unblocked_sequence = 1 ;
1250
+
1214
1251
for (int i = 0 ; i < 2 ; i ++ ){
1215
1252
mt_ctx -> link [i ]-> picosec_per_byte = 160000 ; /* 160 nanosec per byte, i.e., 50Mbps*/
1216
1253
mt_ctx -> link [i ]-> microsec_latency = 2000 ; /* 2ms */
@@ -1270,6 +1307,14 @@ int mediatest_one(mediatest_id_enum media_test_id, mediatest_spec_t * spec)
1270
1307
ret = mediatest_check_stats (mt_ctx , spec , media_test_video2 );
1271
1308
}
1272
1309
}
1310
+ if (ret == 0 && media_test_id == mediatest_wifi ) {
1311
+ picoquic_path_quality_t quality = { 0 };
1312
+ picoquic_get_default_path_quality (mt_ctx -> client_cnx -> cnx , & quality );
1313
+ if (quality .lost == 0 || quality .spurious_losses == 0 || quality .timer_losses == 0 ) {
1314
+ /* Unexpected. the wifi tst should have triggered at least on spurious timer loss. */
1315
+ ret = -1 ;
1316
+ }
1317
+ }
1273
1318
if (mt_ctx != NULL ) {
1274
1319
mediatest_delete_ctx (mt_ctx );
1275
1320
}
0 commit comments