Skip to content

Commit

Permalink
ecosystem/ffmpeg_plugin: add pmd type support (#528)
Browse files Browse the repository at this point in the history
test with: 
ffmpeg -framerate 60 -pixel_format yuv422p10le -width 1920 -height 1080
-udp_port 20000 -port kernel:enp175s0f0np0 -src_addr "239.168.85.20"
-ext_frames_mode 1 -f kahawai -i "k" -vframes 2000 -f rawvideo /dev/null
-y

Signed-off-by: Frank Du <[email protected]>
  • Loading branch information
frankdjx authored Oct 8, 2023
1 parent 038010c commit bdb45cc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
20 changes: 12 additions & 8 deletions ecosystem/ffmpeg_plugin/kahawai_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ mtl_handle kahawai_init(char* port, char* local_addr, int enc_session_cnt,
param.num_ports = 1;

snprintf(param.port[MTL_PORT_P], MTL_PORT_MAX_LEN, "%s", port);
param.pmd[MTL_PORT_P] = mtl_pmd_by_port_name(param.port[MTL_PORT_P]);

if (NULL == local_addr) {
av_log(NULL, AV_LOG_ERROR, "Invalid local IP address\n");
return NULL;
} else if (sscanf(local_addr, "%hhu.%hhu.%hhu.%hhu", &param.sip_addr[MTL_PORT_P][0],
&param.sip_addr[MTL_PORT_P][1], &param.sip_addr[MTL_PORT_P][2],
&param.sip_addr[MTL_PORT_P][3]) != MTL_IP_ADDR_LEN) {
av_log(NULL, AV_LOG_ERROR, "Failed to parse local IP address: %s\n", local_addr);
return NULL;
if (param.pmd[MTL_PORT_P] == MTL_PMD_DPDK_USER) {
/* check ip for dpdk based pmd */
if (NULL == local_addr) {
av_log(NULL, AV_LOG_ERROR, "Invalid local IP address\n");
return NULL;
} else if (sscanf(local_addr, "%hhu.%hhu.%hhu.%hhu", &param.sip_addr[MTL_PORT_P][0],
&param.sip_addr[MTL_PORT_P][1], &param.sip_addr[MTL_PORT_P][2],
&param.sip_addr[MTL_PORT_P][3]) != MTL_IP_ADDR_LEN) {
av_log(NULL, AV_LOG_ERROR, "Failed to parse local IP address: %s\n", local_addr);
return NULL;
}
}

if (enc_session_cnt > 0) {
Expand Down
3 changes: 2 additions & 1 deletion include/mtl_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ struct mtl_init_params {
* Static(default) or DHCP(please make sure you have a DHCP server inside LAN)
*/
enum mtl_net_proto net_proto[MTL_PORT_MAX];
/** Mandatory. dpdk user pmd(default) or af_xdp */
/** Mandatory. dpdk user pmd(default) or af_xdp. Use mtl_pmd_by_port_name helper to get
* PMD type */
enum mtl_pmd_type pmd[MTL_PORT_MAX];
/**
* Mandatory. Max NIC tx queues requested the lib to support.
Expand Down
4 changes: 4 additions & 0 deletions lib/src/mt_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ int mt_socket_get_numa(const char* if_name) {

fclose(file);
dbg("%s, numa_node %d for %s\n", __func__, numa_node, if_name);
if (SOCKET_ID_ANY == numa_node) {
numa_node = 0;
info("%s, direct soc_id from SOCKET_ID_ANY to 0 for %s\n", __func__, if_name);
}
return numa_node;
}

Expand Down

0 comments on commit bdb45cc

Please sign in to comment.