Data transmission regulation methods, devices, computer equipment and storage media
By informing the terminal of the data block limit value during the RTSP session establishment phase, the problem of MTU mismatch between the terminal device and the CPE device is solved, IP fragmentation is avoided, data transmission efficiency and integrity are improved, and the quality of multimedia data is enhanced.
Patent Information
- Application Number
- CN202411939845.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-12-26
AI Technical Summary
MTU mismatch between terminal equipment and CPE equipment causes RTP packets to be split into IP fragments for transmission, reducing transmission efficiency and increasing packet loss rate, which affects the real-time performance of multimedia data and user experience.
During the RTSP session establishment phase, the CPE device generates and sends RTSP messages carrying data block limit values to limit the size of terminal data packets and avoid IP fragmentation requirements for subsequent RTP data transmission.
It improves data transmission efficiency and integrity, reduces the risk of packet loss, and enhances the transmission quality of multimedia data, especially improving the user experience in application scenarios with high real-time requirements such as video surveillance and remote conferencing.
Smart Images

Figure CN119922170B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network communication technology, and in particular to a data transmission regulation method, apparatus, computer equipment, and storage medium. Background Technology
[0002] In modern communication technologies, terminal devices, as core equipment for multimedia data acquisition and transmission, are widely used in various fields such as video surveillance, remote conferencing, online education, telemedicine, virtual reality, and augmented reality. These terminal devices, including but not limited to cameras, microphones, sensors, and smart wearable devices, typically employ the Real-Time Transport Protocol (RTP) as their core transmission protocol to achieve real-time multimedia data transmission. The RTP protocol is designed for transmitting real-time multimedia data streams, such as audio, video, and sensor data, over IP networks. In the RTP protocol, the size of media packets (such as video frames, audio frames, or sensor data packets) is usually determined based on the maximum transmission unit (MTU) of the terminal device's network interface.
[0003] However, in real-world deployment environments, RTP packets sent by terminal devices (usually encapsulated in UDP) may encounter MTU mismatch issues when reaching the CPE (Customer Premises Equipment) gateway device. When routing and forwarding RTP packets, the CPE device determines whether to fragment the packets based on the MTU size of its egress interface. When the MTU of the terminal device's network is larger than the MTU of the CPE device's egress interface, the RTP packet cannot pass directly and must be split into multiple smaller IP fragments for transmission. While IP fragmentation allows data to be sent to the destination server, this process reduces transmission efficiency and increases packet loss rate. Increased packet loss rate leads to a decrease in video and audio quality, and may even cause playback interruptions, significantly impacting the user experience. Summary of the Invention
[0004] Based on this, it is necessary to address the problem of MTU mismatch between existing terminal equipment and CPE equipment by proposing a data transmission adjustment method, device, computer equipment, and storage medium.
[0005] A first aspect of the present invention provides a data transmission regulation method applied to a CPE device, the CPE device being used to forward data from a terminal to a server, and / or forward data from the server to the terminal, the method comprising:
[0006] Obtain the first RTSP message sent by the server, which is used by the server to request the terminal to establish an RTSP connection.
[0007] A chunking constraint is generated in the first RTSP message, and the chunking constraint carries a data block limit value to obtain a second RTSP message; when the terminal transmits data to the server via the CPE device through the RTP protocol, the chunking constraint is used to limit the size of a single data packet sent by the terminal in chunks to not exceed the data block limit value.
[0008] Send the second RTSP message to the terminal.
[0009] Further, the step of generating a block restriction condition in the first RTSP message, wherein the block restriction condition carries a data block restriction value, to obtain the second RTSP message includes:
[0010] Parse the first RTSP message;
[0011] Determine whether the first RTSP message contains initial block constraints;
[0012] If the initial block restriction condition is included, then the initial data block restriction value is extracted from the initial block restriction condition;
[0013] Compare the initial data block limit value with the preset limit value;
[0014] Determine whether the initial data block limit value is greater than the preset limit value;
[0015] If the value is greater than the preset limit value, then the preset limit value is used as the data block limit value, and the initial data block limit value is replaced to update the initial block restriction condition and the first RTSP message. The updated initial block restriction condition is used as the block restriction condition, and the updated first RTSP message is used as the second RTSP message.
[0016] Furthermore, after determining whether the first RTSP message contains initial chunking constraints, the method further includes:
[0017] If the initial block restriction condition is not included, then the block restriction condition is written into the first RTSP message, the preset restriction value is used as the data block restriction value in the block restriction condition, and the first RTSP message with the block restriction condition written into it is used as the second RTSP message.
[0018] Furthermore, after the step of determining whether the initial data block limit value is greater than the preset limit value, the method further includes:
[0019] If the value is not greater than the preset limit value, then the initial data block limit value is used as the data block limit value, and the first RTSP message is directly used as the second RTSP message.
[0020] Furthermore, before the step of comparing the initial data block limit value with the preset limit value, the method further includes:
[0021] Obtain the maximum transmission unit value of the data output interface of the CPE device;
[0022] The preset limit value is calculated by subtracting the first preset header value of the data block from the maximum transmission unit value.
[0023] Furthermore, before the step of obtaining the first RTSP message sent by the server, the method further includes:
[0024] When establishing a TCP connection with the server, obtain the maximum segment length determined during the TCP three-way handshake process;
[0025] The first calculated value is obtained by subtracting the second preset header value of the data block from the maximum segment length.
[0026] Obtain the maximum transmission unit value of the data output interface of the CPE device;
[0027] The second calculated value is obtained by subtracting the first preset header value of the data block from the maximum transmission unit value.
[0028] Compare the first calculated value and the second calculated value, and take the smaller value as the preset limit value.
[0029] Furthermore, the first preset header value is the sum of the sizes of the IP header, UDP header, and RTP header, and the second preset header value is the sum of the sizes of the UDP header and RTP header.
[0030] A second aspect of the present invention provides a data transmission adjustment device disposed within a CPE device, the CPE device being used to forward data from a terminal to a server, and / or forward data from the server to the terminal, the device comprising:
[0031] The message acquisition module is used to acquire the first RTSP message sent by the server, which is used by the server to request the terminal to establish an RTSP connection.
[0032] The message modification module is used to generate a block restriction condition in the first RTSP message, the block restriction condition carrying a data block limit value, to obtain a second RTSP message; when the terminal transmits data to the server via the CPE device through the RTP protocol, the block restriction condition is used to limit the size of a single data packet sent by the terminal in the form of data packets to not exceed the data block limit value;
[0033] The message sending module is used to send the second RTSP message to the terminal.
[0034] A third aspect of the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the following steps:
[0035] Obtain the first RTSP message sent by the server, which is used by the server to request the terminal to establish an RTSP connection.
[0036] A chunking constraint is generated in the first RTSP message, and the chunking constraint carries a data block limit value to obtain a second RTSP message; when the terminal transmits data to the server via the CPE device through the RTP protocol, the chunking constraint is used to limit the size of a single data packet sent by the terminal in chunks to not exceed the data block limit value.
[0037] Send the second RTSP message to the terminal.
[0038] A fourth aspect of the present invention provides a computer device including a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the following steps:
[0039] Obtain the first RTSP message sent by the server, which is used by the server to request the terminal to establish an RTSP connection.
[0040] A chunking constraint is generated in the first RTSP message, and the chunking constraint carries a data block limit value to obtain a second RTSP message; when the terminal transmits data to the server via the CPE device through the RTP protocol, the chunking constraint is used to limit the size of a single data packet sent by the terminal in chunks to not exceed the data block limit value.
[0041] Send the second RTSP message to the terminal.
[0042] The data transmission regulation method, apparatus, computer equipment, and storage medium of the present invention effectively avoid the need for IP fragmentation during subsequent RTP data transmission by informing the terminal of the data block limit value of the CPE device during the RTSP session establishment stage, significantly improving transmission efficiency and data integrity; and reducing the risk of packet loss caused by IP fragmentation, thereby improving the transmission quality of multimedia data, especially in application scenarios with high requirements for real-time performance and stability, such as video surveillance and remote conferencing, resulting in a significant improvement in user experience. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] in:
[0045] Figure 1 Here is a flowchart of a data transmission adjustment method in one embodiment;
[0046] Figure 2 This is a structural block diagram of a data transmission adjustment device in one embodiment;
[0047] Figure 3 This is a structural block diagram of a computer device in one embodiment. Detailed Implementation
[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0049] like Figure 1 As shown, in one embodiment, a data transmission regulation method is provided, applied to a CPE device, wherein the CPE device is used to forward data from a terminal to a server, and / or forward data from the server to the terminal. The data transmission regulation method specifically includes the following steps:
[0050] S1: Obtain the first RTSP message sent by the server. The first RTSP message is used by the server to request the terminal to establish an RTSP connection.
[0051] S2: Generate a chunking restriction condition in the first RTSP message, the chunking restriction condition carrying a data block limit value, to obtain a second RTSP message; when the terminal transmits data to the server via the CPE device through the RTP protocol, the chunking restriction condition is used to limit the size of a single data packet sent by the terminal in chunks to not exceed the data block limit value;
[0052] S3: Send the second RTSP message to the terminal.
[0053] In this embodiment, the CPE device is used to route and forward data from the terminal to the server, or to forward data from the server to the terminal. The terminal includes, but is not limited to, devices such as cameras, microphones, sensors, and smart wearable devices. The server includes, but is not limited to, web servers, database servers, and cloud servers.
[0054] In step S1 above, the CPE device obtains network traffic from the server and identifies an RTSP (Real-Time Streaming Protocol) session establishment request message targeting a specific terminal, namely the first RTSP message mentioned above.
[0055] Specifically, during CPE device system initialization, the system function `nf_conntrack_helper_register` registers the `nf_conntrack` helper with the netfilter framework in the network subsystem. This helper is associated with the connection stream on the default TCP port 554 of RTSP and implements the helper callback function. When the CPE device system receives the first PTSP packet on TCP port 554, it will trigger the execution of the helper callback function, which retrieves the TCP payload content from the packet.
[0056] In step S2 above, the data block limit value can be a pre-set value or calculated in real time using a predefined method. The preferred approach is to calculate it in real time using a predefined method. This data block limit value is less than the MTU (Maximum Transmission Unit) value of the CPE egress interface. This step is used to modify the first RTSP message by inserting a new data block limit value, thus transforming the first RTSP message into a second RTSP message.
[0057] Preferably, the CPE device can periodically or as needed recalculate the MTU value of its export interface and dynamically update the data block limit value.
[0058] In step S3 above, the CPE device sends the modified second RSTP (should be RTSP) message to the target terminal through its internal network forwarding mechanism.
[0059] This embodiment effectively avoids the need for IP fragmentation during subsequent RTP data transmission by informing the terminal of the data block limit value of the CPE device during the RTSP session establishment phase, significantly improving transmission efficiency and data integrity. It also reduces the risk of packet loss caused by IP fragmentation, thereby improving the transmission quality of multimedia data. This is especially beneficial in application scenarios with high requirements for real-time performance and stability, such as video surveillance and remote conferencing, resulting in a significant improvement in user experience.
[0060] In one specific embodiment, step S2, which involves generating a block restriction condition in the first RTSP message, wherein the block restriction condition carries a data block restriction value, to obtain a second RTSP message, includes:
[0061] S201: Parse the first RTSP message;
[0062] S202: Determine whether the first RTSP message contains initial block restriction conditions;
[0063] S203: If the initial block restriction condition is included, then extract the initial data block restriction value from the initial block restriction condition;
[0064] S204: Compare the initial data block limit value with the preset limit value;
[0065] S205: Determine whether the initial data block limit value is greater than the preset limit value;
[0066] S206: If it is greater than the preset limit value, then the preset limit value is used as the data block limit value, and the initial data block limit value is replaced to update the initial block restriction condition and the first RTSP message, and the updated initial block restriction condition is used as the block restriction condition, and the updated first RTSP message is used as the second RTSP message.
[0067] In this embodiment, in steps S201-S202 above, the received first RTSP packet undergoes syntax analysis to extract its payload content. The aforementioned initial chunking constraint refers to the original constraint in the first RTSP packet used to specify the data block size. Specifically, a helper callback function can be used to determine whether the TCP payload content contains the string "SETUPrtsp: / / " (representing an RTSP SETUP session) and whether it carries the "Transport" field (this field must be carried in a SETUP session).
[0068] In step S203 above, the initial data block limit is the maximum size of each data block specified in the first RTSP message. During system initialization or configuration, a fixed data block size can be manually determined as the initial data block limit based on known conditions such as network bandwidth and device performance, as well as the expected streaming media data transmission requirements. Alternatively, based on the system's real-time monitoring and feedback mechanism, the server can set the data block size in real-time as the initial data block limit based on current network conditions, device load, and other factors, requiring the terminal to provide a specific data packet size. The terminal can freely use a data packet size smaller than the requested initial data block limit. The initial data block limit does not include the size of low-level headers such as IP, UDP, or RTP in the transmitted data packets.
[0069] Specifically, when the helper callback function determines that the RTSP SETUP session carries a "Blocksize" field, it obtains the value of the "Blocksize" field carried by the RTSP SETUP session through the helper callback function, which is the aforementioned initial data block limit value.
[0070] In step S204 above, the preset limit value is a predefined threshold used to limit the data block size. The preset limit value is associated with the CPE device's egress MTU value. When the data packet transmitted from the terminal is smaller than this preset limit value, the CPE device does not need to perform IP fragmentation during forwarding. Preferably, the preset limit value employs a dynamic adjustment mechanism, adjusting it dynamically based on the CPE device's network conditions and device performance. For example, when network bandwidth is sufficient and device performance is high, the preset limit value can be appropriately increased; conversely, it should be decreased.
[0071] In steps S205-S206 above, if the initial data block limit value is greater than the preset limit value, it indicates that the initial data block limit value given in the first RTSP message is too large and needs to be adjusted. The preset limit value is used as the new data block limit value, replacing the initial data block limit value in the original message. In this way, the updated initial block restriction condition becomes the new block restriction condition, and the updated RTSP message becomes the second RTSP message.
[0072] In one specific embodiment, after step S202 of determining whether the first RTSP message contains initial block restriction conditions, the method further includes:
[0073] S213: If the initial block restriction condition is not included, then the block restriction condition is written into the first RTSP message, the preset restriction value is used as the data block restriction value in the block restriction condition, and the first RTSP message with the block restriction condition written into it is used as the second RTSP message.
[0074] In this embodiment, if the first RTSP message does not contain initial block restriction conditions, such as not carrying the "Transport" field, the above-mentioned preset restriction value is inserted into the first RTSP message through the helper callback function, that is, the "Blocksize" field and the corresponding preset restriction value are inserted.
[0075] In one specific embodiment, after step S205 of determining whether the initial data block limit value is greater than the preset limit value, the method further includes:
[0076] S216: If it is not greater than the preset limit value, then the initial data block limit value is used as the data block limit value, and the first RTSP message is directly used as the second RTSP message.
[0077] In this embodiment, if the value is not greater than the preset limit, there is no need to modify the content of the first RTSP message. The first RTSP message is directly forwarded to the terminal as the second RTSP message.
[0078] In one specific embodiment, before step S204 of comparing the initial data block limit value with the preset limit value, the method further includes:
[0079] S207: Obtain the maximum transmission unit value of the data output interface of the CPE device;
[0080] S208: Subtract the first preset header value of the data block from the maximum transmission unit value to calculate the preset limit value.
[0081] In this embodiment, the first preset header value is the sum of the sizes of the IP header, UDP header, and RTP header. The Maximum Transmission Unit (MTU) value refers to the maximum size of a data packet allowed to be transmitted by a network layer protocol, including the data packet itself and necessary header information.
[0082] In step S207, the maximum transmission unit value supported by the data output interface of the CPE device can be queried by reading the preset MTU value in the device configuration file.
[0083] In step S208: The first preset header value refers to the sum of the sizes of the header information that needs to be attached to the data packet during transmission. This includes, for example, the sizes of the IP header, UDP header, and RTP header. The IP header contains the header information of the IP data packet, including key information such as the source address, destination address, and protocol type. The UDP header (User Datagram Protocol) is used to encapsulate user data and some necessary control information. The RTP header (Real-time Transport Protocol) is used for real-time data transmission and contains information such as timestamps and sequence numbers. The preset limit value is calculated by subtracting the first preset header value (i.e., the sum of the sizes of the IP header, UDP header, and RTP header) from the MTU value obtained from the CPE device. Specifically, the MTU of the CPE device's egress interface is converted to a Blocksize value; Blocksize represents the size of each data packet block, excluding the IP, UDP, and RTP headers. Therefore, the conversion relationship between MTU and Blocksize is as follows: MTU = IP header + UDP header + RTP header + Blocksize. Therefore, this embodiment can ensure that data packets transmitted from the terminal can be directly forwarded by the CPE device without the need for data packet splitting, thus avoiding the problem of reduced transmission performance.
[0084] In one specific embodiment, before step S1 of obtaining the first RTSP message sent by the server, the method further includes:
[0085] S01: When establishing a TCP connection with the server, obtain the maximum segment length determined during the TCP three-way handshake process;
[0086] S02: Subtract the second preset header value of the data block from the maximum segment length to obtain the first calculated value;
[0087] S03: Obtain the maximum transmission unit value of the data output interface of the CPE device;
[0088] S04: Subtract the first preset header value of the data block from the maximum transmission unit value to obtain the second calculated value;
[0089] S05: Compare the first calculated value and the second calculated value, and take the smaller value as the preset limit value.
[0090] In this embodiment, the second preset header value is the sum of the sizes of the UDP header and the RTP header.
[0091] In step S01 above, the Maximum Segment Size (MSS) determined during the TCP three-way handshake is obtained. This value is typically negotiated and determined by both parties during the TCP connection's three-way handshake. Specifically, the MSS value of each TCP stream during the three-way handshake is recorded in the nf_conntrack connection tracking table of the network subsystem. If the data packet sent by the terminal device meets the MTU of the CPE device, but the MSS value is exceeded when the CPE device forwards it to the server, the data packet will still be fragmented for transmission, increasing transmission latency and additional processing.
[0092] In step S02 above, the second preset header value refers to the sum of the sizes of the header information that needs to be added to the data packet during transmission, in addition to the TCP header. In this embodiment, this includes the sizes of the UDP header and the RTP header. The first calculated value is obtained by subtracting the second preset header value (i.e., the sum of the sizes of the UDP header and the RTP header) from the MSS value.
[0093] Specifically, the helper callback function reads the system's nf_conntrack connection tracking table to obtain the MSS value of the TCP connection stream, and converts the MSS value into a Blocksize value. Blocksize represents the size of each packet block, excluding IP, UDP, and RTP headers. Therefore, the MTU to Blocksize conversion relationship is as follows: MTU = IP header + UDP header + RTP header + Blocksize. Furthermore, since MTU = IP header + MSS, the MSS to Blocksize conversion relationship is as follows: MSS = UDP header + RTP header + Blocksize.
[0094] Steps S03 to S04 are executed in the same way as S207 and S208 in the previous embodiment, and will not be described again here. The MTU of the CPE device's egress interface is converted into a Blocksize value; Blocksize represents the size of each data packet block, excluding IP, UDP, and RTP headers. Therefore, the conversion relationship between MTU and Blocksize is as follows: MTU = IP header + UDP header + RTP header + Blocksize.
[0095] In step S05, the smaller value between the first calculated value and the second calculated value is used as the preset limit value. Specifically, the minimum value of the Blocksize values after conversion between the two is used as the "minimum Blocksize value (i.e., the preset limit value)" and is used as the basis for modifying the first RTSP message in subsequent steps.
[0096] Furthermore, the helper callback function inserts the "minimum Blocksize value" into the "Blocksize" field in the first RTSP packet. The helper callback function then calls the system function `nf_nat_mangle_tcp_packet` to re-adjust the TCP packets in the TCP connection stream (primarily adjusting the TCP sequence number (Seq) and record mapping). After the helper callback function finishes processing, the CPE device performs the next step of forwarding the network packets.
[0097] This embodiment calculates and determines preset limit values to ensure that data packets sent in the TCP connection and network layer do not exceed their respective maximum limits due to the addition of header information. This effectively avoids problems such as data packet fragmentation, transmission delay, and packet loss, thereby improving the stability and efficiency of data transmission.
[0098] Figure 2 A data transmission adjustment device is shown in one embodiment, disposed within a CPE device, the CPE device being used to forward data from a terminal to a server, and / or forward data from the server to a terminal, the device comprising:
[0099] The message acquisition module 10 is used to acquire the first RTSP message sent by the server, the first RTSP message being used by the server to request the terminal to establish an RTSP connection;
[0100] The message modification module 20 is used to generate a block restriction condition in the first RTSP message, the block restriction condition carrying a data block limit value, to obtain a second RTSP message; when the terminal transmits data to the server via the CPE device through the RTP protocol, the block restriction condition is used to limit the size of a single data packet sent by the terminal in the form of data packets to not exceed the data block limit value;
[0101] The message sending module 30 is used to send the second RTSP message to the terminal.
[0102] In one specific embodiment, the message modification module 20 includes:
[0103] The message parsing unit is used to parse the first RTSP message;
[0104] The first judgment unit is used to determine whether the first RTSP message contains initial block restriction conditions;
[0105] A data extraction unit is configured to extract an initial data block limit value from the initial block restriction condition if the initial block restriction condition is included.
[0106] A numerical comparison unit is used to compare the initial data block limit value with a preset limit value;
[0107] The second judgment unit is used to determine whether the initial data block limit value is greater than the preset limit value;
[0108] The first generation unit is configured to, if the value is greater than the preset limit value, use the preset limit value as the data block limit value and replace the initial data block limit value to update the initial block restriction condition and the first RTSP message, and use the updated initial block restriction condition as the block restriction condition, and use the updated first RTSP message as the second RTSP message.
[0109] In one specific embodiment, the message modification module 20 further includes:
[0110] The second generation unit is configured to, if the initial block restriction condition is not included, write the block restriction condition into the first RTSP message, use the preset restriction value as the data block restriction value in the block restriction condition, and use the first RTSP message with the block restriction condition written in it as the second RTSP message.
[0111] In one specific embodiment, the message modification module 20 further includes:
[0112] The third generation unit is used to take the initial data block limit value as the data block limit value and directly take the first RTSP message as the second RTSP message if the limit value is not greater than the preset limit value.
[0113] In one specific embodiment, the message modification module 20 further includes:
[0114] MTU acquisition unit, used to acquire the maximum transmission unit value of the data output interface of the CPE device;
[0115] The first calculation unit is used to subtract the first preset header value of the data block from the maximum transmission unit value to calculate the preset limit value.
[0116] In one specific embodiment, the data transmission adjustment device further includes:
[0117] The MSS acquisition module is used to obtain the maximum segment length determined during the TCP three-way handshake process when establishing a TCP connection with the server.
[0118] The first calculation module is used to subtract the second preset header value of the data block from the maximum segment length to calculate the first calculated value.
[0119] The MTU acquisition module is used to acquire the maximum transmission unit value of the data output interface of the CPE device.
[0120] The second calculation module is used to subtract the first preset header value of the data block from the maximum transmission unit value to calculate the second calculated value.
[0121] The data determination module is used to compare the first calculated value and the second calculated value, and take the smaller value of the two as the preset limit value.
[0122] In one specific embodiment, the first preset header value is the sum of the sizes of the IP header, UDP header, and RTP header, and the second preset header value is the sum of the sizes of the UDP header and RTP header.
[0123] The device in this embodiment effectively avoids the need for IP fragmentation during subsequent RTP data transmission by informing the terminal of the data block limit value of the CPE device during the RTSP session establishment phase, which significantly improves transmission efficiency and data integrity. It also reduces the risk of packet loss caused by IP fragmentation, thereby improving the transmission quality of multimedia data. In particular, in application scenarios with high requirements for real-time performance and stability, such as video surveillance and remote conferencing, the user experience is significantly improved.
[0124] Figure 3 An internal structural diagram of a computer device in one embodiment is shown. This computer device can specifically be a terminal or a server. Figure 3 As shown, the computer device includes a processor, memory, and network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program enables the processor to implement a data transmission regulation method. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to implement a data transmission regulation method. Those skilled in the art will understand that… Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0125] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the following steps:
[0126] Obtain the first RTSP message sent by the server, which is used by the server to request the terminal to establish an RTSP connection.
[0127] A chunking constraint is generated in the first RTSP message, and the chunking constraint carries a data block limit value to obtain a second RTSP message; when the terminal transmits data to the server via the CPE device through the RTP protocol, the chunking constraint is used to limit the size of a single data packet sent by the terminal in chunks to not exceed the data block limit value.
[0128] Send the second RTSP message to the terminal.
[0129] This embodiment effectively avoids the need for IP fragmentation during subsequent RTP data transmission by informing the terminal of the data block limit value of the CPE device during the RTSP session establishment phase, significantly improving transmission efficiency and data integrity. It also reduces the risk of packet loss caused by IP fragmentation, thereby improving the transmission quality of multimedia data. This is especially beneficial in application scenarios with high requirements for real-time performance and stability, such as video surveillance and remote conferencing, resulting in a significant improvement in user experience.
[0130] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, causes the processor to perform the following steps:
[0131] Obtain the first RTSP message sent by the server, which is used by the server to request the terminal to establish an RTSP connection.
[0132] A chunking constraint is generated in the first RTSP message, and the chunking constraint carries a data block limit value to obtain a second RTSP message; when the terminal transmits data to the server via the CPE device through the RTP protocol, the chunking constraint is used to limit the size of a single data packet sent by the terminal in chunks to not exceed the data block limit value.
[0133] Send the second RTSP message to the terminal.
[0134] This embodiment effectively avoids the need for IP fragmentation during subsequent RTP data transmission by informing the terminal of the data block limit value of the CPE device during the RTSP session establishment phase, significantly improving transmission efficiency and data integrity. It also reduces the risk of packet loss caused by IP fragmentation, thereby improving the transmission quality of multimedia data. This is especially beneficial in application scenarios with high requirements for real-time performance and stability, such as video surveillance and remote conferencing, resulting in a significant improvement in user experience.
[0135] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0136] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0137] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A data transmission adjustment method, characterized by, The method is applied to a CPE device used for forwarding data of a terminal to a server and / or forwarding data of the server to the terminal, and comprises the following steps: acquiring a maximum packet length determined in a TCP three-way handshake process when a TCP connection is established with the server; subtracting a second preset header value of a data block from the maximum packet length to obtain a first calculation value; acquiring a maximum transmission unit value of a data output interface of the CPE device; the CPE device re-calculates the maximum transmission unit value of the outlet interface periodically or on demand; subtracting a first preset header value of a data block from the maximum transmission unit value to obtain a second calculation value; comparing the first calculation value and the second calculation value, and taking the smaller one as a preset limit value; acquiring a first RTSP packet sent by the server, the first RTSP packet being used for the server to request the establishment of an RTSP connection to the terminal; generating a chunk limit condition in the first RTSP packet, the chunk limit condition carrying a data block limit value to obtain a second RTSP packet; when the terminal transmits data to the server through the CPE device via an RTP protocol, the chunk limit condition is used to limit the size of a single data packet sent by the terminal to be no greater than the data block limit value; the step of generating the chunk limit condition in the first RTSP packet, the chunk limit condition carrying the data block limit value to obtain the second RTSP packet, comprises the following steps: parsing the first RTSP packet; judging whether the first RTSP packet contains an initial chunk limit condition; if the initial chunk limit condition is contained, extracting an initial data block limit value from the initial chunk limit condition; comparing the initial data block limit value with a preset limit value; the preset limit value is dynamically adjusted according to the network status and device performance of the CPE device; judging whether the initial data block limit value is greater than the preset limit value; if the initial data block limit value is greater than the preset limit value, taking the preset limit value as the data block limit value, replacing the initial data block limit value, updating the initial chunk limit condition and the first RTSP packet, taking the updated initial chunk limit condition as the chunk limit condition, and taking the updated first RTSP packet as the second RTSP packet; sending the second RTSP packet to the terminal.
2. The data transmission adjustment method of claim 1, wherein, after the step of judging whether the first RTSP packet contains the initial chunk limit condition, the method further comprises the following steps: if the initial chunk limit condition is not contained, writing the chunk limit condition in the first RTSP packet, taking the preset limit value as the data block limit value in the chunk limit condition, and taking the first RTSP packet with the written chunk limit condition as the second RTSP packet.
3. The data transmission adjustment method of claim 1, wherein, after the step of judging whether the initial data block limit value is greater than the preset limit value, the method further comprises the following steps: If the initial data block limit value is not greater than the preset limit value, the initial data block limit value is taken as the data block limit value, and the first RTSP message is directly taken as the second RTSP message.
4. The data transmission adjustment method of claim 1, wherein, Before the step of comparing the initial data block limit value with the preset limit value, the method further comprises: obtaining a maximum transmission unit value of a data output interface of the CPE device; subtracting a first preset header value of a data block from the maximum transmission unit value to obtain the preset limit value.
5. The data transmission adjustment method of claim 1, wherein, The first preset header value is a sum of sizes of an IP header, a UDP header and an RTP header, and the second preset header value is a sum of sizes of the UDP header and the RTP header.
6. A data transmission regulating apparatus characterized by comprising: The device is arranged in a CPE device, the CPE device is used for forwarding data of a terminal to a server and / or forwarding data of the server to the terminal, and the device comprises: an MSS obtaining module, configured to obtain a maximum message segment length determined in a TCP three-way handshake process when a TCP connection is established with the server; a first calculation module, configured to subtract a second preset header value of a data block from the maximum message segment length to obtain a first calculation value; an MTU obtaining module, configured to obtain a maximum transmission unit value of a data output interface of the CPE device; the CPE device periodically or on demand re-calculates the maximum transmission unit value of the outlet interface thereof; a second calculation module, configured to subtract a first preset header value of a data block from the maximum transmission unit value to obtain a second calculation value; a data determining module, configured to compare the first calculation value and the second calculation value, and take a smaller one of the two as a preset limit value; a message obtaining module, configured to obtain a first RTSP message sent by a server, the first RTSP message being used for the server to request establishment of an RTSP connection to the terminal; a message modifying module, configured to generate a block limit condition in the first RTSP message, the block limit condition carrying a data block limit value, to obtain a second RTSP message; when the terminal transmits data to the server through an RTP protocol via the CPE device, the block limit condition is used to limit a size of a single data packet of the data packeted and sent by the terminal to be not greater than the data block limit value; the message modifying module comprises: a message analyzing unit, configured to analyze the first RTSP message; a first judging unit, configured to judge whether an initial block limit condition is contained in the first RTSP message; a data extracting unit, configured to extract an initial data block limit value from the initial block limit condition if the initial block limit condition is contained; a value comparing unit, configured to compare the initial data block limit value with a preset limit value; the preset limit value is dynamically adjusted according to network conditions and device performance of the CPE device; a second judging unit, configured to judge whether the initial data block limit value is greater than the preset limit value. The first generating unit is configured to, if the data block limit value is greater than the preset limit value, replace the initial data block limit value with the preset limit value as the data block limit value, update the initial chunk limit condition and the first RTSP packet, and take the updated initial chunk limit condition as the chunk limit condition and take the updated first RTSP packet as the second RTSP packet. The packet sending module is configured to send the second RTSP packet to the terminal.
7. A computer readable storage medium characterized in that, The computer program is stored in the memory and is executed by the processor to enable the processor to perform the steps of the data transmission adjustment method according to any one of claims 1 to 5.
8. A computer device, comprising: The device comprises a memory and a processor, and the memory stores a computer program which is executed by the processor to enable the processor to perform the steps of the data transmission adjustment method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Maximum transmission unit consultation method and data terminal
CN102868609A