Skip to content

Commit

Permalink
added simple packet reorder testing in netcap
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed May 17, 2024
1 parent d3193e4 commit 43a396e
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 83 deletions.
7 changes: 0 additions & 7 deletions include/gpac/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,6 @@ GF_Err gf_route_set_reorder(GF_ROUTEDmx *routedmx, Bool force_reorder, u32 timeo
*/
GF_Err gf_route_set_allow_progressive_dispatch(GF_ROUTEDmx *routedmx, Bool allow_progressive);

/*! Sets maximum number of object per session, mostly used for regulation when reading from pcap
\param routedmx the ROUTE demultiplexer
\param max_cache max number of objects per media stream in the session. If 0, no maximum applies
\return error code if any
*/
GF_Err gf_route_set_max_cache(GF_ROUTEDmx *routedmx, u32 max_cache);

/*! Sets the service ID to tune into for ATSC 3.0
\param routedmx the ROUTE demultiplexer
\param service_id ID of the service to tune in. 0 means no service, 0xFFFFFFFF means all services and 0xFFFFFFFE means first service found
Expand Down
4 changes: 4 additions & 0 deletions share/doc/man/gpac-filters.1
Original file line number Diff line number Diff line change
Expand Up @@ -6761,6 +6761,10 @@ repair (enum, default: simple): repair mode for corrupted files
* full: HTTP-based repair, not yet implemented
.br

.br
repair_url (cstr): repair url
.br
max_sess (uint, default: 1): max number of concurrent HTTP repair sassions
.br

.br
Expand Down
20 changes: 11 additions & 9 deletions share/doc/man/gpac.1
Original file line number Diff line number Diff line change
Expand Up @@ -900,23 +900,25 @@ set packet capture and filtering rules formatted as [CFG][RULES]. Each -netcap a
.br
[RULES] is an optional list of [OPT,OPT2...] with OPT in:
.br
* m=N: set rule mode - N can be r for reception only (default), w for send only or rw for both
* m=K: set rule mode - K can be r for reception only (default), w for send only or rw for both
.br
* s=N: set packet start range to N
* s=K: set packet start range to K
.br
* e=N: set packet end range to N (only used for r and f rules)
* e=K: set packet end range to K - only used for r and f rules, 0 or not set means rule apply until end
.br
* n=N: set number of packets to drop to N - not set, 0 or 1 means single packet
* n=K: set number of packets to drop to K - not set, 0 or 1 means single packet
.br
* r=N: random drop one packet every N
* r=K: random drop n packet every K
.br
* f=N: drop first packet every N
* f=K: drop first n packets every K
.br
* p=P: local port number to filter, if not set the rule applies to all packets
* d=K: reorder n packets after the next K packets, can be used with f or r rules
.br
* o=N: patch packet instead of droping (always true for TCP), replacing byte at offset N (0 is first byte, <0 for random)
* p=K: filter packets on port K only, if not set the rule applies to all packets
.br
* v=N: set patch byte value to N (hexa) or negative value for random (default)
* o=K: patch packet instead of droping (always true for TCP), replacing byte at offset K (0 is first byte, <0 for random)
.br
* v=K: set patch byte value to K (hexa) or negative value for random (default)
.br

.br
Expand Down
5 changes: 3 additions & 2 deletions src/filters/in_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void routein_on_event_file(ROUTEInCtx *ctx, GF_ROUTEEventType evt, u32 evt_param
GF_LOG(GF_LOG_DEBUG, GF_LOG_ROUTE, ("[ROUTE] Pushing fragment from file %s to cache\n", finfo->filename));
break;
}
finfo->blob->flags &=~GF_BLOB_IN_TRANSFER;
finfo->blob->flags &=~ GF_BLOB_IN_TRANSFER;

GF_LOG(GF_LOG_INFO, GF_LOG_ROUTE, ("[ROUTE] Pushing file %s to cache\n", finfo->filename));
if (ctx->max_segs && (evt==GF_ROUTE_EVT_DYN_SEG))
Expand Down Expand Up @@ -443,6 +443,8 @@ static Bool routein_local_cache_probe(void *par, char *url, Bool is_destroy)
if (is_destroy) {
GF_LOG(GF_LOG_INFO, GF_LOG_ROUTE, ("[ROUTE] Cache releasing object %s\n", url));
gf_route_dmx_remove_object_by_name(ctx->route_dmx, sid, subr+1, GF_TRUE);
//for non real-time netcap, we may need to reschedule processing
gf_filter_post_process_task(ctx->filter);
} else if (sid && (sid != ctx->tune_service_id)) {
GF_LOG(GF_LOG_INFO, GF_LOG_ROUTE, ("[ROUTE] Request on service %d but tuned on service %d, retuning\n", sid, ctx->tune_service_id));
ctx->tune_service_id = sid;
Expand Down Expand Up @@ -612,7 +614,6 @@ static GF_Err routein_initialize(GF_Filter *filter)
if (!ctx->route_dmx) return GF_SERVICE_ERROR;

gf_route_set_allow_progressive_dispatch(ctx->route_dmx, !ctx->fullseg);
gf_route_set_max_cache(ctx->route_dmx, ctx->nbcached);

gf_route_set_reorder(ctx->route_dmx, ctx->reorder, ctx->rtimeout);

Expand Down
1 change: 1 addition & 0 deletions src/filters/in_route_repair.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ static void repair_session_run(ROUTEInCtx *ctx, RouteRepairSession *rsess)
GF_Err routein_do_repair(ROUTEInCtx *ctx)
{
u32 i, nb_active=0;

for (i=0; i<ctx->max_sess; i++) {
RouteRepairSession *rsess = &ctx->http_repair_sessions[i];
repair_session_run(ctx, rsess);
Expand Down
Loading

0 comments on commit 43a396e

Please sign in to comment.