WO2016197659A1 - 网络媒体流收包方法、装置及系统 - Google Patents

网络媒体流收包方法、装置及系统 Download PDF

Info

Publication number
WO2016197659A1
WO2016197659A1 PCT/CN2016/077124 CN2016077124W WO2016197659A1 WO 2016197659 A1 WO2016197659 A1 WO 2016197659A1 CN 2016077124 W CN2016077124 W CN 2016077124W WO 2016197659 A1 WO2016197659 A1 WO 2016197659A1
Authority
WO
WIPO (PCT)
Prior art keywords
kernel
packets
preset number
receiving
user side
Prior art date
Application number
PCT/CN2016/077124
Other languages
English (en)
French (fr)
Inventor
欧阳永辉
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016197659A1 publication Critical patent/WO2016197659A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/75Media network packet handling
    • H04L65/764Media network packet handling at the destination 

Definitions

  • This document relates to the field of network media stream collection technology, and in particular, to a network media stream collection method, device and system.
  • network packets are typically received over a network socket using a system call.
  • the data packet received by the network card is copied from the kernel receiving buffer to the user buffer.
  • the system call recvfrom can only return one packet at a time.
  • an Internet Protocol Television (IPTV) streaming server may need to receive a live stream of more than two hundred channels from an encoder.
  • IPTV Internet Protocol Television
  • each channel has a bit rate of 8 Mbps, the required traffic needs to reach 1.6 Gbps; if it is a 4K resolution ultra HD channel, the average traffic rate will reach 4 Gbps.
  • the UDP packets sent by the encoder are each 1500 bytes.
  • the system call per second will reach more than 330,000 times. The overhead of system calls severely affects the performance of streaming media servers and their ability to serve externally.
  • the invention provides a network media stream collecting method, device and system, so as to at least solve the problem that the system frequently calls network data packets in the related art.
  • a method for collecting network media streams includes:
  • the preset number of packets is sent to the user receiving buffer of the user side.
  • the step of obtaining a preset number of packets from the kernel receiving buffer of the kernel space includes:
  • a probe function is registered in the kernel space, and the probe function acquires the preset number of packets from the kernel receive buffer of the kernel space.
  • the instruction includes an identifier parameter
  • the step of obtaining a preset number of packets from the kernel receiving buffer of the kernel space includes:
  • a probe function corresponding to the identifier parameter is identified in the kernel space, and the probe function acquires the preset number of packets from the kernel receive buffer of the kernel space.
  • the method includes:
  • the method further includes:
  • the auxiliary information includes at least one of the following: a data packet length, a receiving time, a source IP address, and a port number.
  • a method for collecting network media streams includes:
  • the user side sends an instruction for acquiring a data packet, where the instruction includes a preset number of received packets;
  • the user-side receiving buffer of the user side receives the preset number of packets received from the kernel space, and the preset number of packets is obtained from a kernel receiving buffer of the kernel space.
  • the calculation factor of the preset number of received packets includes at least one of the following:
  • a network media stream receiving device includes a first receiving module and an acquiring module, wherein
  • the first receiving module is configured to: receive an instruction for acquiring a data packet sent by a user side, where the instruction includes a preset number of received packets;
  • the obtaining module is configured to: after obtaining a preset number of data packets from the kernel receiving buffer of the kernel space, send the preset number of data packets to the user receiving buffer of the user side.
  • the obtaining module includes a first acquiring unit, where
  • the first obtaining unit is configured to: register a probe function in the kernel space, and the probe function acquires the preset number of packets from the kernel receiving buffer of the kernel space.
  • the instruction includes an identifier parameter
  • the obtaining module includes a second acquiring unit:
  • the second obtaining unit is configured to: identify, in the kernel space, a probe function corresponding to the identifier parameter, where the probe function acquires the preset number of packets from the kernel receiving buffer of the kernel space.
  • the obtaining module includes a third acquiring unit, where
  • the third obtaining unit is configured to: when the number of data packets in the kernel receiving buffer of the kernel space is less than the preset number of received packets, the core of the current kernel space receives the data in the buffer The packet is sent to the user side receiving buffer of the user side.
  • the device further includes a first sending module:
  • the first sending module is configured to: send the auxiliary information of the data packet to a user receiving buffer of the user side;
  • the auxiliary information includes at least one of the following: a data packet length, a receiving time, a source IP address, and a port number.
  • a network media stream collecting device includes a second sending module and a second receiving module, wherein
  • the second sending module is configured to: send an instruction for acquiring a data packet, where the instruction includes a preset number of received packets;
  • the second receiving module is located at a user receiving buffer of the user side, and is configured to: receive the preset number of packets received from the kernel space, and the preset number of packets is from the kernel.
  • the kernel's kernel receives the buffer.
  • the calculation factor of the preset number of received packets includes at least one of the following:
  • a user side device includes any network media stream receiving device on the user equipment side.
  • a core device includes any network media stream receiving device on the kernel device side.
  • a network media stream receiving system includes: any of the above user side devices, and any of the above kernel devices.
  • an instruction for receiving a data packet by a user side is adopted, wherein the instruction includes a preset number of received packets, and after the kernel receiving buffer of the kernel space obtains a preset number of data packets, the preset is obtained.
  • the number of packets received is sent to the user receiving buffer of the user side, which solves the problem that the system frequently calls the network data packet, seriously reduces the performance of the streaming media server, and improves the external service capability of the streaming media server.
  • FIG. 1 is a flowchart 1 of a method for collecting a network media stream according to an embodiment of the present invention
  • FIG. 2 is a second flowchart of a method for collecting network media streams according to an embodiment of the present invention
  • FIG. 3 is a structural block diagram 1 of a network media stream collection device according to an embodiment of the present invention.
  • FIG. 4 is a structural block diagram 2 of a network media stream collecting apparatus according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a network receiving system in accordance with a preferred embodiment of the present invention.
  • FIG. 1 is a flowchart 1 of a network media stream collection method according to an embodiment of the present invention. As shown in FIG. 1 , the process includes the following steps:
  • Step S102 Receive an instruction for the user side to obtain a data packet, where the instruction includes a preset number of received packets;
  • Step S104 After obtaining the preset number of received data packets from the kernel receiving buffer of the kernel space, the preset number of received data packets is sent to the user receiving buffer of the user side.
  • the user side receives the instruction of the data packet, and obtains the preset number of data packets from the kernel receiving buffer of the kernel space, and sends the preset number of data packets to the user side of the user side to receive the data packet.
  • the buffer realizes that a certain number of data packets can be taken according to the instruction of the user side, instead of taking only one data packet at a time, which solves the problem that the system frequently calls the network data packet, seriously reduces the performance of the streaming media server, and improves the streaming media. Server external service capabilities.
  • the probe function may be registered in the kernel space, and the probe function obtains the preset number of packets from the kernel receive buffer of the kernel space.
  • the detection function corresponding to the identification parameter may also be identified in the kernel space if the instruction includes the identification parameter, and the detection function obtains the preset number of packets from the kernel receiving buffer of the kernel space.
  • the data packet in the kernel receiving buffer of the current kernel space is sent to the user side.
  • the user receives the buffer.
  • the auxiliary information of the data packet is also sent to the user receiving buffer of the user side, where
  • the auxiliary information includes at least one of the following: a packet length, a receiving time, a source IP address, and a port number.
  • FIG. 2 is a second flowchart of a network media stream collection method according to an embodiment of the present invention. As shown in FIG. 2, the process includes the following steps:
  • Step S202 the user side sends an instruction to fetch a data packet, where the instruction includes a preset number of received packets;
  • Step S204 The user receiving buffer of the user side receives the preset number of packets sent from the kernel space, and the preset number of packets is obtained from a kernel receiving buffer of the kernel space.
  • the user side sends an instruction to fetch a data packet, where the instruction includes a preset number of received packets, and the user receiving buffer of the user side receives the preset number of packets received from the kernel space, and the pre-package
  • the number of packets received is obtained from the kernel receiving buffer of the kernel space, so that a certain number of data packets can be taken according to the instruction of the user side, instead of only one data packet at a time, which solves the frequent call of the system.
  • Network data packets seriously reduce the performance of streaming media servers and improve the external service capabilities of streaming media servers.
  • the calculation factor of the preset number of received packets may include at least one of the following: a code rate, a collection interval.
  • a network media stream collection device is also provided, which is used to implement the foregoing embodiments and preferred embodiments, and has not been described again.
  • the term "module” may implement a combination of software and/or hardware of a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
  • FIG. 3 is a structural block diagram 1 of a network media stream collecting apparatus according to an embodiment of the present invention. As shown in FIG. 3, the apparatus includes
  • the first receiving module 32 is configured to: receive an instruction of the user side to obtain a data packet, where the instruction includes a preset number of received packets;
  • the obtaining module 34 is configured to: after obtaining the preset number of received data packets from the kernel receiving buffer of the kernel space, send the preset number of data packets to the user receiving buffer of the user side.
  • the device receives the instruction of the user side to take the data packet, and obtains the preset number of data packets from the kernel receiving buffer of the kernel space, and sends the preset number of data packets to the user side of the user side to receive the data packet.
  • the buffer realizes that a certain number of data packets can be taken according to the instruction of the user side, instead of taking only one data packet at a time, which solves the problem that the system frequently calls the network data packet, seriously reduces the performance of the streaming media server, and improves the streaming media. Server external service capabilities.
  • the obtaining module 34 includes:
  • the first obtaining unit is configured to: register a probe function in the kernel space, and the probe function obtains the preset number of packets from the kernel receiving buffer of the kernel space.
  • the acquisition module 34 includes:
  • the second obtaining unit is configured to: identify, in the kernel space, a probe function corresponding to the identifier parameter, and the probe function obtains the preset number of packets from the kernel receiving buffer of the kernel space.
  • the third obtaining unit is configured to: when the number of data packets in the kernel receiving buffer of the kernel space is less than the preset number of received packets, send the data packet in the kernel receiving buffer of the current kernel space to the The user side of the user receives the buffer.
  • the device further includes:
  • the first sending module is configured to send the auxiliary information of the data packet to the user receiving buffer of the user side, where the auxiliary information includes at least one of the following: a data packet length, a receiving time, a source IP address, and a port number. .
  • FIG. 4 is a structural block diagram 2 of a network media stream collecting apparatus according to an embodiment of the present invention. As shown in FIG. 4, the apparatus includes
  • the second sending module 42 is configured to: the user side sends an instruction to fetch a data packet, where the instruction includes a preset number of received packets;
  • the second receiving module 44 is configured to: the user receiving buffer of the user side receives the preset number of packets sent from the kernel space, and the preset number of packets is received from the kernel of the kernel space. The buffer is obtained.
  • the device sends an instruction to fetch a data packet, where the command includes a preset number of received packets, and the user receiving buffer of the user side receives the preset number of packets received from the kernel space, and the pre-package
  • the number of packets received is obtained from the kernel receiving buffer of the kernel space, so that a certain number of data packets can be taken according to the instruction of the user side, instead of only one data packet at a time, which solves the frequent call of the system.
  • Network data packets seriously reduce the performance of streaming media servers and improve the external service capabilities of streaming media servers.
  • a network media stream collection system including: a user side device, a kernel device;
  • the kernel device receives an instruction of the user side device to take a data packet, where the instruction includes a preset number of received packets;
  • the preset number of packets is sent to the user receiving buffer of the user side device.
  • the preferred embodiment provides a network receiving method, device and system, which reduces the overhead of system calls, solves the performance bottleneck problem of the streaming media server, and improves the external service capability.
  • the apparatus/system of the preferred embodiment includes the following modules:
  • the user collection module calls the system call to receive the network packet for processing.
  • the kernel collection module runs in kernel space and returns a specified number of packets at a time.
  • Step 1 Use the kernel's jprobe (Jumper probe) debugging tool to register a probe function that implements bulk collection. Compile into a kernel module (can be named receivepacketdriver.ko).
  • Step 2 Use the insmod command to install the kernel receiving module to Kernel, such as Linux.
  • Step 3 The user receiving module calculates how many packets to collect according to the code rate and the receiving interval, collects the packet through the system interface recvmsg, and specifies the number of packets to be received and carries special marking parameters.
  • Step 4 The system call recvmsg carrying the special tag parameters will execute the function in the kernel collection module receivepacketdriver.ko.
  • the function returns the user-specified number of packets from the kernel receive buffer to the user, and returns the auxiliary information of each packet (such as packet length, receiving time, source IP address, port, etc.). If the number of packets received by the kernel in the buffer is less than the number specified by the user, only the existing number is returned.
  • Step 5 The user receiving module obtains multiple packages and performs subsequent processing.
  • FIG. 5 is a schematic diagram of a network receiving system according to a preferred embodiment of the present invention.
  • a probe function is registered to the kernel function udp_recvmsg by using the interface register_jprobe of the kernel, and the probe function implements a bulk receiving function. Compile this kernel collection module into receivepacketdriver.ko and install it into the kernel via the insmod command.
  • the user collection module calls the system interface recvmsg(int sockfd, struct msghdr*msg, int flags) to receive the packets, and the flags are special values such as MSG_BATCH.
  • the number of packets is specified by msg_iovlen of the structure msg, and msg_control is used to return the auxiliary information of each packet.
  • Recvmsg will call udp_recvmsg to execute the previously registered probe function. If flags is MSG_BATCH, the probe function will retrieve msg_iovlen packets from the kernel receive queue and return them. Household. If the number of packets in the kernel receive queue is less than msg_iovlen, then all existing packets in the queue are returned. The collection process ends.
  • the user receiving module periodically calls recvmsg to receive the code stream for subsequent processing.
  • Embodiments of the present invention also provide a storage medium.
  • the storage medium may be configured to store program code for performing the method steps of the above embodiment:
  • the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • a mobile hard disk e.g., a hard disk
  • magnetic memory e.g., a hard disk
  • the processor executes the method of the above embodiment according to the stored program code in the storage medium.
  • the embodiment of the invention further discloses a computer program, including a program instruction, when the program instruction is executed by the user side device, so that the user side device can perform the method for collecting the network media stream on the user side device side.
  • the embodiment of the invention also discloses a carrier carrying the computer program.
  • the embodiment of the invention further discloses a computer program, comprising program instructions, when the program instruction is executed by the kernel device, so that the kernel device can perform the method for collecting the network media stream on any of the kernel device sides.
  • the embodiment of the invention also discloses a carrier carrying the computer program.
  • modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module.
  • the invention is not limited to any particular hardware and software. Combine.
  • an instruction for receiving a data packet by a user side is adopted, wherein the instruction includes a preset number of received packets, and after the kernel receiving buffer of the kernel space obtains a preset number of data packets, the preset is obtained.
  • the number of packets received is sent to the user receiving buffer of the user side, which solves the problem that the system frequently calls the network data packet, seriously reduces the performance of the streaming media server, and improves the external service capability of the streaming media server. Therefore, the present invention has strong industrial applicability.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

一种网络媒体流收包方法、装置及系统,其中,该方法接收用户侧取数据包的指令,其中,该指令包括预设收包数量,从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将该预设收包数量个数据包发送给该用户侧的用户接收缓冲区,该技术方案解决了系统频繁调用网络数据包,严重降低流媒体服务器性能的问题,提高了流媒体服务器对外服务能力。

Description

网络媒体流收包方法、装置及系统 技术领域
本文涉及网络媒体流收包技术领域,具体而言,涉及一种网络媒体流收包方法、装置及系统。
背景技术
在Unix/Linux等操作系统中,一般通过网络套接字使用系统调用接收网络数据包。在数据包的接收过程中,需要通过相关系统调用陷入内核态,将网卡接收的数据包从内核接收缓存拷贝到用户缓冲区。对用户数据协议(User Date Protocol,简称为UDP)码流,收包的系统调用recvfrom每次只能返回一个包。
在相关技术中,对网络协定电视(Internet Protocol Television,简称为IPTV)流媒体服务器来说可能需要接收来自编码器的两百个以上频道的直播码流。以200个频道,每个频道码率8Mbps来计算,需要接收的流量达到1.6Gbps;如果是4K分辨率超高清频道,按平均20Mbps计算,流量将达到4Gbps。假设编码器发出来的UDP包每个大小为1500字节,在4K分辨率的情况下,每秒的系统调用将达到33万次以上。系统调用的开销严重影响流媒体服务器性能和其对外服务的能力。
针对相关技术中,系统频繁调用网络数据包,严重降低流媒体服务器性能的问题,目前尚未提出有效的解决方案。
发明内容
本发明提供了一种网络媒体流收包方法、装置及系统,以至少解决相关技术中系统频繁调用网络数据包的问题。
为了解决上述技术问题,采用如下技术方案:
一种网络媒体流收包方法,包括:
接收用户侧发来的获取数据包的指令,其中,所述指令包括预设收包数 量;
从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将所述预设收包数量个数据包发送给所述用户侧的用户接收缓冲区。
可选地,所述从内核空间的内核接收缓冲区获取预设收包数量个数据包的步骤包括:
在内核空间中注册探测函数,所述探测函数从内核空间的内核接收缓冲区获取所述预设收包数量个数据包。
可选地,所述指令包括标识参数,所述从内核空间的内核接收缓冲区获取预设收包数量个数据包的步骤包括:
在内核空间中识别与所述标识参数对应的探测函数,所述探测函数从内核空间的内核接收缓冲区获取所述预设收包数量个数据包。
可选地,所述接收用户侧发来的获取数据包的指令的步骤之后,该方法包括:
在所述内核空间的内核接收缓冲区内的数据包数量小于所述预设收包数量的情况下,将当前所述内核空间的内核接收缓冲区内的数据包发送给所述用户侧的用户接收缓冲区。
可选地,所述方法还包括:
在将所述预设收包数量个数据包发送给所述用户侧的用户接收缓冲区的同时,还将所述数据包的辅助信息发送给所述用户侧的用户接收缓冲区,
其中,所述辅助信息包括以下至少之一:数据包长度、接收时间、源IP地址、端口号。
一种网络媒体流收包方法,包括:
用户侧发送获取数据包的指令,其中,所述指令包括预设收包数量;
所述用户侧的用户接收缓冲区接收从内核空间发送的所述预设收包数量个数据包,所述预设收包数量个数据包是从所述内核空间的内核接收缓冲区获取的。
可选地,所述预设收包数量的计算因子包括以下至少之一:
码率,收包间隔。
一种网络媒体流收包装置,包括第一接收模块和获取模块,其中
所述第一接收模块设置成:接收用户侧发来的获取数据包的指令,其中,所述指令包括预设收包数量;
所述获取模块设置成:从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将所述预设收包数量个数据包发送给所述用户侧的用户接收缓冲区。
可选地,所述获取模块包括第一获取单元,其中
所述第一获取单元设置成:在内核空间中注册探测函数,所述探测函数从内核空间的内核接收缓冲区获取所述预设收包数量个数据包。
可选地,所述指令包括标识参数,所述获取模块包括第二获取单元:
所述第二获取单元设置成:在内核空间中识别与所述标识参数对应的探测函数,所述探测函数从内核空间的内核接收缓冲区获取所述预设收包数量个数据包。
可选地,所述获取模块包括第三获取单元,其中
所述第三获取单元设置成:在所述内核空间的内核接收缓冲区内的数据包数量小于所述预设收包数量的情况下,将当前所述内核空间的内核接收缓冲区内的数据包发送给所述用户侧的用户接收缓冲区。
可选地,所述装置还包括第一发送模块:
所述第一发送模块设置成:将所述数据包的辅助信息发送给所述用户侧的用户接收缓冲区;
其中,所述辅助信息包括以下至少之一:数据包长度、接收时间、源IP地址、端口号。
一种网络媒体流收包装置,包括第二发送模块和第二接收模块,其中
所述第二发送模块设置成:发送获取数据包的指令,其中,所述指令包括预设收包数量;
所述第二接收模块位于用户侧的用户接收缓冲区,设置成:接收从内核空间发送的所述预设收包数量个数据包,所述预设收包数量个数据包是从所述内核空间的内核接收缓冲区获取的。
可选地,所述预设收包数量的计算因子包括以下至少之一:
码率,收包间隔。
一种用户侧设备,包括上述任意的用户设备侧的网络媒体流收包装置。
一种内核设备,包括上述任意的内核设备侧的网络媒体流收包装置。
一种网络媒体流收包系统,包括:上述任意的用户侧设备,及上述任意的内核设备。
通过本发明技术方案,采用接收用户侧取数据包的指令,其中,该指令包括预设收包数量,从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将该预设收包数量个数据包发送给该用户侧的用户接收缓冲区,解决了系统频繁调用网络数据包,严重降低流媒体服务器性能的问题,提高了流媒体服务器对外服务能力。
附图概述
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1是根据本发明实施例的一种网络媒体流收包方法的流程图一;
图2是根据本发明实施例的一种网络媒体流收包方法的流程图二;
图3是根据本发明实施例的一种网络媒体流收包装置的结构框图一;
图4是根据本发明实施例的一种网络媒体流收包装置的结构框图二;
图5是根据本发明优选实施例的网络收包系统示意图。
本发明的较佳实施方式
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。
在本实施例中提供了一种网络媒体流收包方法,图1是根据本发明实施例的一种网络媒体流收包方法的流程图一,如图1所示,该流程包括如下步骤:
步骤S102,接收用户侧取数据包的指令,其中,该指令包括预设收包数量;
步骤S104,从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将该预设收包数量个数据包发送给该用户侧的用户接收缓冲区。
通过上述步骤,接收用户侧取数据包的指令,从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将该预设收包数量个数据包发送给该用户侧的用户接收缓冲区,实现了可以按照用户侧的指令取一定数量的数据包,而不是每次只取一个数据包,解决了系统频繁调用网络数据包,严重降低流媒体服务器性能的问题,提高了流媒体服务器对外服务能力。
在本实施例中,可以在内核空间中注册探测函数,该探测函数从内核空间的内核接收缓冲区获取该预设收包数量个数据包。也可以在该指令包括标识参数的情况下,在内核空间中识别与该标识参数对应的探测函数,该探测函数从内核空间的内核接收缓冲区获取该预设收包数量个数据包。
在本实施例中,在该内核空间的内核接收缓冲区内的数据包数量小于该预设收包数量的情况下,将当前该内核空间的内核接收缓冲区内的数据包发送给该用户侧的用户接收缓冲区。
在本实施例中,在将该预设收包数量个数据包发送给该用户侧的用户接收缓冲区的同时,还将该数据包的辅助信息发送给该用户侧的用户接收缓冲区,其中,该辅助信息包括以下至少之一:数据包长度、接收时间、源IP地址、端口号。
在本实施例中提供了一种网络媒体流收包方法,图2是根据本发明实施例的一种网络媒体流收包方法的流程图二,如图2所示,该流程包括如下步骤:
步骤S202,用户侧发送取数据包的指令,其中,该指令包括预设收包数量;
步骤S204,该用户侧的用户接收缓冲区接收从内核空间发送的该预设收包数量个数据包,该预设收包数量个数据包是从该内核空间的内核接收缓冲区获取的。
通过上述步骤,用户侧发送取数据包的指令,其中,该指令包括预设收包数量,该用户侧的用户接收缓冲区接收从内核空间发送的该预设收包数量个数据包,该预设收包数量个数据包是从该内核空间的内核接收缓冲区获取的,实现了可以按照用户侧的指令取一定数量的数据包,而不是每次只取一个数据包,解决了系统频繁调用网络数据包,严重降低流媒体服务器性能的问题,提高了流媒体服务器对外服务能力。
在本实施例中,该预设收包数量的计算因子可以包括以下至少之一:码率,收包间隔。
在本实施例中还提供了一种网络媒体流收包装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。
图3是根据本发明实施例的一种网络媒体流收包装置的结构框图一,如图3所示,该装置包括
第一接收模块32,设置成:接收用户侧取数据包的指令,其中,该指令包括预设收包数量;
获取模块34,设置成:从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将该预设收包数量个数据包发送给该用户侧的用户接收缓冲区。
通过上述装置,接收用户侧取数据包的指令,从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将该预设收包数量个数据包发送给该用户侧的用户接收缓冲区,实现了可以按照用户侧的指令取一定数量的数据包,而不是每次只取一个数据包,解决了系统频繁调用网络数据包,严重降低流媒体服务器性能的问题,提高了流媒体服务器对外服务能力。
在本实施例中,该获取模块34包括:
第一获取单元,设置成:在内核空间中注册探测函数,该探测函数从内核空间的内核接收缓冲区获取该预设收包数量个数据包。
在该指令包括标识参数的情况下,该获取模块34包括:
第二获取单元,设置成:在内核空间中识别与该标识参数对应的探测函数,该探测函数从内核空间的内核接收缓冲区获取该预设收包数量个数据包。
第三获取单元,设置成:在该内核空间的内核接收缓冲区内的数据包数量小于该预设收包数量的情况下,将当前该内核空间的内核接收缓冲区内的数据包发送给该用户侧的用户接收缓冲区。
在本实施例中,该装置还包括:
第一发送模块,设置成:将该数据包的辅助信息发送给该用户侧的用户接收缓冲区,其中,该辅助信息包括以下至少之一:数据包长度、接收时间、源IP地址、端口号。
图4是根据本发明实施例的一种网络媒体流收包装置的结构框图二,如图4所示,该装置包括
第二发送模块42,设置成:用户侧发送取数据包的指令,其中,该指令包括预设收包数量;
第二接收模块44,设置成:该用户侧的用户接收缓冲区接收从内核空间发送的该预设收包数量个数据包,该预设收包数量个数据包是从该内核空间的内核接收缓冲区获取的。
通过上述装置,用户侧发送取数据包的指令,其中,该指令包括预设收包数量,该用户侧的用户接收缓冲区接收从内核空间发送的该预设收包数量个数据包,该预设收包数量个数据包是从该内核空间的内核接收缓冲区获取的,实现了可以按照用户侧的指令取一定数量的数据包,而不是每次只取一个数据包,解决了系统频繁调用网络数据包,严重降低流媒体服务器性能的问题,提高了流媒体服务器对外服务能力。
在另一个实施例中,还提供了一种网络媒体流收包系统,包括:用户侧设备,内核设备;
该内核设备接收用户侧设备取数据包的指令,其中,该指令包括预设收包数量;
从该内核设备的内核接收缓冲区获取预设收包数量个数据包后,将该预设收包数量个数据包发送给该用户侧设备的用户接收缓冲区。
下面结合优选实施例和实施方式对本发明进行详细说明。
本优选实施例提供一种网络收包方法、装置及系统,降低系统调用的开销,解决流媒体服务器的性能瓶颈问题,从而提高其对外服务能力。
本优选实施例的装置/系统包括以下模块:
用户收包模块,调用系统调用收取网络包进行处理。
内核收包模块,运行在内核空间,一次返回用户指定数量的数据包。
本优选实施例的方法包括以下步骤:
步骤1.利用内核的jprobe(Jumper probe)调试工具注册一个探测函数,该函数实现批量收包功能。编译成一个内核模块(可命名为receivepacketdriver.ko)。
步骤2.利用insmod命令安装该内核收包模块到Linux等操作系统Kernel。
步骤3.用户收包模块根据码率和收包间隔等计算一次要收多少个包,通过系统接口recvmsg收包,同时指定收包个数并携带特殊的标记参数。
步骤4.携带特殊标记参数的系统调用recvmsg会执行内核收包模块receivepacketdriver.ko中的函数。该函数会从内核接收缓存区取用户指定数量的包返回给用户,同时返回每个包的辅助信息(如包的长度、接收时间、源IP地址和端口等)。如果内核接收缓存区的包数量少于用户指定的数量,则只返回现有的数量。
步骤5.用户收包模块得到多个包后进行后续处理。
图5是根据本发明优选实施例的网络收包系统示意图,如图5所示,利用内核的接口register_jprobe注册一个探测函数到内核函数udp_recvmsg上,该探测函数实现批量收包功能。将此内核收包模块编译成receivepacketdriver.ko,并通过insmod命令安装到内核中运行。
用户收包模块调用系统接口recvmsg(int sockfd,struct msghdr*msg,int flags)进行收包,flags为特殊值如MSG_BATCH。通过结构体msg的msg_iovlen指定收包个数,msg_control用于回传每个包的辅助信息。
Figure PCTCN2016077124-appb-000001
recvmsg会调用udp_recvmsg,从而执行之前注册的探测函数,如果flags为MSG_BATCH则探测函数会从内核接收队列取出msg_iovlen个包返回给用 户。如果内核接收队列中包的个数少于msg_iovlen个,则返回队列中现有的所有包。本次收包流程结束。
用户收包模块周期调用recvmsg接收码流做后续处理。
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行上述实施例的方法步骤的程序代码:
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行上述实施例的方法。
本发明实施例还公开了一种计算机程序,包括程序指令,当该程序指令被用户侧设备执行时,使得该用户侧设备可执行上述任意的用户侧设备侧的网络媒体流收包的方法。
本发明实施例还公开了一种载有所述的计算机程序的载体。
本发明实施例还公开了一种计算机程序,包括程序指令,当该程序指令被内核设备执行时,使得该内核设备可执行上述任意的内核设备侧的网络媒体流收包的方法。
本发明实施例还公开了一种载有所述的计算机程序的载体。
在阅读并理解了附图和详细描述后,可以明白其他方面。
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件 结合。
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。
工业实用性
通过本发明技术方案,采用接收用户侧取数据包的指令,其中,该指令包括预设收包数量,从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将该预设收包数量个数据包发送给该用户侧的用户接收缓冲区,解决了系统频繁调用网络数据包,严重降低流媒体服务器性能的问题,提高了流媒体服务器对外服务能力。因此本发明具有很强的工业实用性。

Claims (17)

  1. 一种网络媒体流收包方法,包括:
    接收用户侧发来的获取数据包的指令,其中,所述指令包括预设收包数量;
    从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将所述预设收包数量个数据包发送给所述用户侧的用户接收缓冲区。
  2. 根据权利要求1所述的网络媒体流收包方法,其中,所述从内核空间的内核接收缓冲区获取预设收包数量个数据包的步骤包括:
    在内核空间中注册探测函数,所述探测函数从内核空间的内核接收缓冲区获取所述预设收包数量个数据包。
  3. 根据权利要求1所述的网络媒体流收包方法,其中,所述指令包括标识参数,所述从内核空间的内核接收缓冲区获取预设收包数量个数据包的步骤包括:
    在内核空间中识别与所述标识参数对应的探测函数,所述探测函数从内核空间的内核接收缓冲区获取所述预设收包数量个数据包。
  4. 根据权利要求1所述的网络媒体流收包方法,其中,所述接收用户侧发来的获取数据包的指令的步骤之后,该方法包括:
    在所述内核空间的内核接收缓冲区内的数据包数量小于所述预设收包数量的情况下,将当前所述内核空间的内核接收缓冲区内的数据包发送给所述用户侧的用户接收缓冲区。
  5. 根据权利要求1所述的网络媒体流收包方法,所述方法还包括:
    在将所述预设收包数量个数据包发送给所述用户侧的用户接收缓冲区的同时,还将所述数据包的辅助信息发送给所述用户侧的用户接收缓冲区,
    其中,所述辅助信息包括以下至少之一:数据包长度、接收时间、源IP地址、端口号。
  6. 一种网络媒体流收包方法,包括:
    用户侧发送获取数据包的指令,其中,所述指令包括预设收包数量;
    所述用户侧的用户接收缓冲区接收从内核空间发送的所述预设收包数量个数据包,所述预设收包数量个数据包是从所述内核空间的内核接收缓冲区获取的。
  7. 根据权利要求6所述的网络媒体流收包方法,其中,所述预设收包数量的计算因子包括以下至少之一:
    码率,收包间隔。
  8. 一种网络媒体流收包装置,包括第一接收模块和获取模块,其中
    所述第一接收模块设置成:接收用户侧发来的获取数据包的指令,其中,所述指令包括预设收包数量;
    所述获取模块设置成:从内核空间的内核接收缓冲区获取预设收包数量个数据包后,将所述预设收包数量个数据包发送给所述用户侧的用户接收缓冲区。
  9. 根据权利要求8所述的网络媒体流收包装置,其中,所述获取模块包括第一获取单元,其中
    所述第一获取单元设置成:在内核空间中注册探测函数,所述探测函数从内核空间的内核接收缓冲区获取所述预设收包数量个数据包。
  10. 根据权利要求8所述的网络媒体流收包装置,其中,所述指令包括标识参数,所述获取模块包括第二获取单元:
    所述第二获取单元设置成:在内核空间中识别与所述标识参数对应的探测函数,所述探测函数从内核空间的内核接收缓冲区获取所述预设收包数量个数据包。
  11. 根据权利要求8所述的网络媒体流收包装置,其中,所述获取模块包括第三获取单元,其中
    所述第三获取单元设置成:在所述内核空间的内核接收缓冲区内的数据包数量小于所述预设收包数量的情况下,将当前所述内核空间的内核接收缓冲区内的数据包发送给所述用户侧的用户接收缓冲区。
  12. 根据权利要求8所述的网络媒体流收包装置,所述装置还包括第一发送模块:
    所述第一发送模块设置成:将所述数据包的辅助信息发送给所述用户侧的用户接收缓冲区;
    其中,所述辅助信息包括以下至少之一:数据包长度、接收时间、源IP地址、端口号。
  13. 一种网络媒体流收包装置,包括第二发送模块和第二接收模块,其中
    所述第二发送模块设置成:发送获取数据包的指令,其中,所述指令包括预设收包数量;
    所述第二接收模块位于用户侧的用户接收缓冲区,设置成:接收从内核空间发送的所述预设收包数量个数据包,所述预设收包数量个数据包是从所述内核空间的内核接收缓冲区获取的。
  14. 根据权利要求13所述的网络媒体流收包装置,其中,所述预设收包数量的计算因子包括以下至少之一:
    码率,收包间隔。
  15. 一种用户侧设备,包括如权利要求13或14所述的网络媒体流收包装置。
  16. 一种内核设备,包括如权利要求8-12中任一项所述的网络媒体流收包装置。
  17. 一种网络媒体流收包系统,包括:如权利要求15所述的用户侧设备,及如权利要求16所述的内核设备。
PCT/CN2016/077124 2015-06-12 2016-03-23 网络媒体流收包方法、装置及系统 WO2016197659A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510325987.9A CN106302372A (zh) 2015-06-12 2015-06-12 网络媒体流收包方法、装置及系统
CN201510325987.9 2015-06-12

Publications (1)

Publication Number Publication Date
WO2016197659A1 true WO2016197659A1 (zh) 2016-12-15

Family

ID=57503085

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/077124 WO2016197659A1 (zh) 2015-06-12 2016-03-23 网络媒体流收包方法、装置及系统

Country Status (2)

Country Link
CN (1) CN106302372A (zh)
WO (1) WO2016197659A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113824777A (zh) * 2021-09-06 2021-12-21 武汉中科通达高新技术股份有限公司 数据管理方法和数据管理装置
WO2023231723A1 (zh) * 2022-06-01 2023-12-07 中兴通讯股份有限公司 流媒体数据处理方法及系统

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107040581B (zh) * 2017-01-25 2021-03-02 腾讯科技(深圳)有限公司 一种网络包发送方法、装置、服务器及系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101135980A (zh) * 2006-08-29 2008-03-05 飞塔信息科技(北京)有限公司 一种基于Linux操作系统实现零拷贝的装置和方法
CN101304373A (zh) * 2008-06-25 2008-11-12 中兴通讯股份有限公司 一种实现局域网内高效传输大块数据的方法及系统
CN104426866A (zh) * 2013-08-28 2015-03-18 华为技术有限公司 一种数据传输方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101132355A (zh) * 2006-08-21 2008-02-27 北京锐科天智科技有限责任公司 网络加速方法、软件及硬件装置
CN101494579B (zh) * 2008-01-22 2012-09-05 中兴通讯股份有限公司 总线调度装置及方法
CN101841476A (zh) * 2010-04-22 2010-09-22 北京星网锐捷网络技术有限公司 报文处理方法、装置和网络设备
US9110668B2 (en) * 2012-01-31 2015-08-18 Broadcom Corporation Enhanced buffer-batch management for energy efficient networking based on a power mode of a network interface

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101135980A (zh) * 2006-08-29 2008-03-05 飞塔信息科技(北京)有限公司 一种基于Linux操作系统实现零拷贝的装置和方法
CN101304373A (zh) * 2008-06-25 2008-11-12 中兴通讯股份有限公司 一种实现局域网内高效传输大块数据的方法及系统
CN104426866A (zh) * 2013-08-28 2015-03-18 华为技术有限公司 一种数据传输方法及装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113824777A (zh) * 2021-09-06 2021-12-21 武汉中科通达高新技术股份有限公司 数据管理方法和数据管理装置
CN113824777B (zh) * 2021-09-06 2023-12-19 武汉中科通达高新技术股份有限公司 数据管理方法和数据管理装置
WO2023231723A1 (zh) * 2022-06-01 2023-12-07 中兴通讯股份有限公司 流媒体数据处理方法及系统

Also Published As

Publication number Publication date
CN106302372A (zh) 2017-01-04

Similar Documents

Publication Publication Date Title
JP7004754B2 (ja) ビデオ送信の方法およびシステムおよびデバイス
US8112491B1 (en) Methods and systems for providing direct DMA
EP3005129B1 (en) Adaptive interrupt coalescing in a converged network
US20160127276A1 (en) Packet capture engine for commodity network interface cards in high-speed networks
García-Dorado et al. High-performance network traffic processing systems using commodity hardware
US10284460B1 (en) Network packet tracing
US9059941B1 (en) Providing router information according to a programmatic interface
US10484730B1 (en) Chunked transfer mode bandwidth estimation
Hu et al. Towards" full containerization" in containerized network function virtualization
CN116095029B (zh) 网络数据流测量方法、系统、终端及存储介质
WO2016197659A1 (zh) 网络媒体流收包方法、装置及系统
CN104601534A (zh) Cdn系统图像处理的方法及系统
WO2020026018A1 (zh) 文件的下载方法、装置、设备/终端/服务器及存储介质
CN113364804B (zh) 一种流量数据的处理方法和装置
CN106791957B (zh) 视频直播处理方法及装置
EP3811572B1 (en) Processing local area network diagnostic data
CN106209680B (zh) 信息处理装置以及信息处理方法
CN110300085B (zh) 网络攻击的取证方法、装置、系统、统计集群和计算集群
US10681398B1 (en) Video encoding based on viewer feedback
WO2017131767A1 (en) Mobile virtual private network configuration
CN116346649A (zh) 负载均衡设备的虚服务抓包方法及装置
CN114024758B (zh) 流量特征提取方法、系统、存储介质及电子设备
CN116264592A (zh) 虚拟桌面性能探测方法、装置、设备及存储介质
CA3022435A1 (en) Adaptive event aggregation
CN111131243A (zh) Dpi系统策略处理方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16806557

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16806557

Country of ref document: EP

Kind code of ref document: A1