A method and device for calculating time delay
By using delay calculation methods in multimedia scenarios to determine and adjust loopback delay, the problem of excessive bandwidth occupancy of RTCP traffic and inability to obtain network delay in real time is solved, real-time network delay monitoring and network quality improvement is achieved.
Patent Information
- Application Number
- CN202210956625.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-10
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2042-08-10
AI Technical Summary
In multimedia scenarios, as the number of video/voice recipients increases, the bandwidth of RTCP traffic occupies increases, resulting in the exhaustion of RTP audio/video data bandwidth, and reducing the frequency of RTCP packets may lead to the inability to obtain network delay information in real time, affecting the real-time evaluation of network quality.
A delay calculation method is provided, by determining the current reference delay, calculating the one-way transmission delay, determining the delay deviation, and adjusting the loopback delay, ensuring that the message delay can still be calculated in real time when the frequency of the RTCP protocol is reduced.
It realizes that the network delay can still be monitored in real time when the frequency of RTCP packet transmission is reduced, reduces the requirement of RTP on the frequency of RTCP protocol packet transmission, and improves network quality.
Smart Images

Figure CN115499342B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data transmission, and particularly to a method and device for calculating delay. Background Art
[0002] RTP (Real-time Transport Protocol) provides an end-to-end transport service for multimedia data such as voice and images that need to be transmitted in real time over IP. The RTP standard defines two sub-protocols: RTP and RTCP (RTP Control Protocol). The data transmission protocol RTP is used for real-time data transmission, and the information provided by this protocol includes: timestamp (for synchronization), sequence number (for detecting packet loss and reordering), and payload format (for indicating the encoding format of the data); the RTCP control protocol is used for statistical information feedback and synchronizing media streams, and one important piece of information is network delay.
[0003] In a multimedia scenario, as the number of video / voice receivers increases, the end-to-end RTCP traffic will constitute a large amount of bandwidth used on the sender's machine. The more participants there are, the more total Internet bandwidth is used for these RTCP reports, so much so that the bandwidth for RTP audio / video data itself may be exhausted. To avoid this situation, the protocol reduces the sending frequency of RTCP's SR / RR packets to ensure that it does not occupy too much bandwidth. This results in the protocol being unable to obtain network delay information in real time when the SR / RR packet frequency of RTCP is low enough, thereby affecting the real-time assessment of network quality. Summary of the Invention
[0004] This application provides a method and device for calculating delay.
[0005] In a first aspect, this application provides a method for calculating delay, which is applied to a first terminal device. There is a Real-time Transport Protocol (RTP) running between the first terminal device and a second terminal device. The method includes:
[0006] Determine the current reference delay, where the current reference delay is the loopback delay calculated based on RTCP packets and is between the first terminal device and the second terminal device;
[0007] If an RTP packet sent by the second terminal device is received, calculate the one-way transmission delay of transmitting the RTP packet based on the reception timestamp of receiving the RTP packet and the transmission timestamp carried in the RTP packet indicating that the second terminal device sent the RTP packet;
[0008] Based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time, determine the deviation of the one-way transmission delay between two RTP packets;
[0009] Adjust the loopback delay with the second terminal device based on the current reference delay and the one-way transmission delay deviation, and use the adjusted loopback delay as the new current reference delay.
[0010] Optionally, the step of determining the one-way transmission delay deviation between two RTP packets based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time includes:
[0011] Determine the difference between the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time as the one-way transmission delay deviation between two RTP packets.
[0012] Optionally, the step of adjusting the loopback delay with the second terminal device based on the current reference delay and the one-way transmission delay deviation includes:
[0013] Use the sum of the current reference delay and twice the one-way transmission delay deviation as the current loopback delay with the second terminal device.
[0014] Optionally, the received RTP packet from the second terminal device is an extended RTP packet, and the extended RTP packet also carries the one-way transmission delay deviation between two RTP packets calculated by the second terminal device; the method further includes:
[0015] Adjust the loopback delay with the second terminal device based on the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation between two RTP packets calculated by the second terminal device carried in the extended RTP packet, and use the adjusted loopback delay as the new current reference delay.
[0016] Optionally, the step of adjusting the loopback delay with the second terminal device based on the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation between two RTP packets calculated by the second terminal device carried in the extended RTP packet, and using the adjusted loopback delay as the new current reference delay includes:
[0017] Use the sum of the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation between two RTP packets calculated by the second terminal device carried in the extended RTP packet as the current loopback delay with the second terminal device.
[0018] Optionally, the method further includes:
[0019] If an RTP control protocol packet is received, recalculate the loopback delay with the second terminal device based on the received RTP control protocol packet, and use the calculated loopback delay as the new current reference delay.
[0020] In a second aspect, the present application provides a delay calculation device, which is applied to a first terminal device. There is a Real-Time Transport Protocol (RTP) running between the first terminal device and the second terminal device. The device includes:
[0021] A first determination unit, configured to determine a current reference delay, where the current reference delay is the loopback delay calculated based on an RTP control protocol packet and is between the first terminal device and the second terminal device;
[0022] A calculation unit, if an RTP packet sent by the second terminal device is received, the calculation unit is configured to calculate the one-way transmission delay of transmitting the RTP packet based on the reception timestamp of receiving the RTP packet and the transmission timestamp of the second terminal device carrying the RTP packet when sending the RTP packet;
[0023] A second determination unit, configured to determine the one-way transmission delay deviation between two RTP packets based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time;
[0024] An adjustment unit, configured to adjust the loopback delay with the second terminal device based on the current reference delay and the one-way transmission delay deviation, and use the adjusted loopback delay as the new current reference delay.
[0025] Optionally, when determining the one-way transmission delay deviation between two RTP packets based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time, the second determination unit is specifically configured to:
[0026] Determine the difference between the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time as the one-way transmission delay deviation between two RTP packets.
[0027] Optionally, when adjusting the loopback delay with the second terminal device based on the current reference delay and the one-way transmission delay deviation, the adjustment unit is specifically configured to:
[0028] Use the sum of the current reference delay and twice the one-way transmission delay deviation as the current loopback delay between the first terminal device and the second terminal device.
[0029] Optionally, the received RTP packet sent by the second terminal device is an extended RTP packet, and the extended RTP packet also carries the one-way transmission delay deviation of two RTP packets calculated by the second terminal device; the adjustment unit is further configured to:
[0030] Based on the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation of two RTP packets calculated by the second terminal device carried in the extended RTP packet, adjust the loopback delay between the second terminal device, and use the adjusted loopback delay as the new current reference delay.
[0031] Optionally, when adjusting the loopback delay between the second terminal device based on the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation of two RTP packets calculated by the second terminal device carried in the extended RTP packet, and using the adjusted loopback delay as the new current reference delay, the adjustment unit is specifically configured to:
[0032] Use the sum of the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation of two RTP packets calculated by the second terminal device carried in the extended RTP packet as the current loopback delay between the second terminal device.
[0033] Optionally, if an RTP control protocol packet is received, the calculation unit is further configured to recalculate the loopback delay between the second terminal device based on the received RTP control protocol packet, and use the calculated loopback delay as the new current reference delay.
[0034] In a third aspect, an embodiment of the present application provides a delay calculation device, and the delay calculation device includes:
[0035] A memory for storing program instructions;
[0036] A processor for calling the program instructions stored in the memory and executing the steps of the method according to any one of the above first aspects according to the obtained program instructions.
[0037] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, and the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause the computer to execute the steps of the method according to any one of the above first aspects.
[0038] In summary, the delay calculation method provided in the embodiment of the present application is applied to a first terminal device, and a Real-Time Transport Protocol (RTP) is running between the first terminal device and a second terminal device. The method includes: determining a current reference delay, where the current reference delay is a loopback delay calculated based on Real-Time Transport Control Protocol (RTCP) packets and is between the first terminal device and the second terminal device; if an RTP packet sent by the second terminal device is received, calculating a one-way transmission delay for transmitting the RTP packet based on the reception timestamp of the RTP packet and the transmission timestamp carried in the RTP packet indicating that the second terminal device sent the RTP packet; determining a one-way transmission delay deviation between two RTP packets based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time; adjusting the loopback delay between the first terminal device and the second terminal device based on the current reference delay and the one-way transmission delay deviation, and using the adjusted loopback delay as the new current reference delay.
[0039] By using the delay calculation method provided in the embodiment of the present application, the packet delay is calculated in real time through the combination of RTP and RTCP protocols, which can ensure the real-time monitoring of the network delay situation when the RTCP protocol frequency is reduced. It can also reflect the network delay situation in real time when partial loss of SR / RR packets occurs. At the same time, this method can reduce the requirement for the RTCP protocol packet sending frequency to a certain extent. Fewer RTCP packets can enable more bandwidth to be used for the transmission of RTP packets, thereby improving the network quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or in the prior art, the following will briefly introduce the drawings required for describing the embodiments of the present application or the prior art. Obviously, the drawings described below are only some embodiments recorded in the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings in the embodiments of the present application.
[0041] Figure 1 is a detailed flowchart of a delay calculation method provided in an embodiment of the present application;
[0042] Figure 2 is a schematic structural diagram of a delay calculation device provided in an embodiment of the present application;
[0043] Figure 3 is a schematic hardware architecture diagram of a delay calculation device provided in an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0044] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments and do not limit the present application. The singular forms "a", "the", and "said" used in the present application and the claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to any or all possible combinations of one or more of the associated listed items.
[0045] It should be understood that although the terms first, second, third, etc. may be used in the embodiments of the present application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, in addition, the word "if" used may be interpreted as "when" or "while" or "in response to a determination".
[0046] Exemplarily, refer to Figure 1 As shown, it is a detailed flowchart of a delay calculation method provided by an embodiment of the present application. This method is applied to a first terminal device, and there is a Real-Time Transport Protocol (RTP) running between the first terminal device and a second terminal device. The method includes the following steps:
[0047] Step 100: Determine the current reference delay, where the current reference delay is the loopback delay calculated based on the Real-Time Transport Control Protocol (RTCP) packets and between the first terminal device and the second terminal device.
[0048] In the embodiments of the present application, the first terminal device first needs to determine the current reference delay between itself and the second terminal device, that is, the initial delay. In practical applications, the first terminal device and the second terminal device perform delay detection based on the RTCP protocol. Then, the current reference delay may be the loopback delay calculated by the first terminal device based on the RTCP packets and between the first terminal device and the second terminal device.
[0049] For example, at time t1, the S side (such as the first terminal device) sends an SR packet to the C side. After the C side (such as the second terminal device) receives the SR packet, it sends an SR / RR packet to the S side, and the packet carries DLSR (the time interval from the last received SR packet to the current sending of the SR / RR packet). After the S side receives the SR / RR packet sent by the C side, it records the current time t2. Then, t2 - t1 - DLSR is the packet loopback delay TTL at time t2; at the same time, update the RTP delay to TTL (the current reference delay).
[0050] Step 110: If an RTP packet sent by the second terminal device is received, calculate the one-way transmission delay of transmitting the RTP packet based on the reception timestamp of receiving the RTP packet and the transmission timestamp carried in the RTP packet at which the second terminal device sent the RTP packet.
[0051] In practical applications, in order to prevent RTCP packets from occupying too much bandwidth and reduce the RTCP packet sending frequency, in the embodiments of the present application, the first terminal device may correct and adjust the loopback delay with the second terminal device based on the RTP packets sent between the first terminal device and the second terminal device.
[0052] Specifically, the first terminal device may process the RTP packets sent by the second terminal device received based on a preset rule, record the reception timestamp of receiving the RTP packet, parse the RTP packet, obtain the transmission timestamp carried in the RTP packet at which the second terminal device sent the RTP packet, and calculate the one-way transmission delay of transmitting the RTP packet based on the reception timestamp and the transmission timestamp.
[0053] It should be noted that the first terminal device may process each RTP packet sent by the second terminal device received to obtain the one-way transmission delay corresponding to the RTP packet, or may process the RTP packets sent by the second terminal device received at preset time intervals to obtain the one-way transmission delay corresponding to the RTP packet. In the embodiments of the present application, no specific limitation is made here.
[0054] Step 120: Determine the one-way transmission delay deviation between two RTP packets based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time.
[0055] In the embodiments of the present application, when determining the one-way transmission delay deviation between two RTP packets based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time, a preferred implementation is: determine the difference between the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time as the one-way transmission delay deviation between two RTP packets.
[0056] In the embodiments of the present application, after the first terminal device determines the current reference delay with the second terminal device according to the RTCP packet and calculates the one-way transmission delay of the RTP packet based on the RTP packets sent by the second terminal device for the first time based on a preset rule, starting from the second calculation of the one-way transmission delay of the RTP packet, determine the one-way transmission delay deviation between two adjacent calculated RTP packets.
[0057] For example, the one-way transmission delay of the RTP packet calculated for the first time is X1 = (T 2 - T 1 ), where T 2 is the time when the first terminal device receives the RTP packet, and T 1 is the time when the second terminal device carried by the RTP sends the RTP packet. Similarly, the one-way transmission delay of the RTP packet calculated for the second time is X 2 = (T 4 - T 3 ), where T 4 is the time when the first terminal device receives the RTP packet, and T 3 is the time when the second terminal device carried by the RTP sends the RTP packet. Then, the difference e1 between X 2 and X 1 is the one-way transmission delay deviation between the one-way transmission delay of the RTP packet calculated for the second time and the one-way transmission delay of the RTP packet calculated for the first time, that is, when the second terminal device transmits the RTP packet to the first terminal device for the second time, it takes e1 more / less time than when the second terminal device transmitted the RTP packet to the first terminal device last time.
[0058] Similarly, the one-way transmission delay of the RTP packet calculated for the third time is X 3 = (T 6 - T 5 ), where T 6 is the time when the first terminal device receives the RTP packet, and T 5 is the time when the second terminal device carried by the RTP sends the RTP packet. Then, the difference e2 between X 3 and X 3 is the one-way transmission delay deviation between the one-way transmission delay of the RTP packet calculated for the third time and the one-way transmission delay of the RTP packet calculated for the second time, that is, when the second terminal device transmits the RTP packet to the first terminal device for the third time, it takes e2 more / less time than when the second terminal device transmitted the RTP packet to the first terminal device last time.
[0059] Step 130: Based on the current reference delay and the one-way transmission delay deviation, adjust the loopback delay with the second terminal device, and use the adjusted loopback delay as the new current reference delay.
[0060] In the embodiments of the present application, when adjusting the loopback delay with the second terminal device based on the current reference delay and the one-way transmission delay deviation, a preferred implementation is to use the sum of the current reference delay and twice the one-way transmission delay deviation as the current loopback delay with the second terminal device.
[0061] That is to say, after the first terminal device determines the current reference delay with the second terminal device based on the RTP control protocol message, if no subsequent RTP control protocol message is received for a long time, the current reference delay can be adjusted based on the RTP message. Specifically, according to the one-way transmission delay of the received RTP message, the one-way transmission delay deviation between two adjacent RTP messages is calculated, and then the current reference delay is adjusted based on the calculated one-way transmission delay deviation of the RTP message to obtain a new current reference delay. Each time the one-way transmission delay of the RTP message is calculated subsequently, the one-way transmission delay deviation between the current calculation and the previous calculation of the RTP message can be calculated, and then the current reference delay is adjusted according to the calculated one-way transmission delay deviation.
[0062] Iteratively execute the above steps of adjusting the current reference delay based on the one-way description delay deviation of the RTP message until an RTP control protocol message is received, and then determine the loopback delay with the second terminal device based on the RTP control protocol message, and use the loopback delay as the current reference delay.
[0063] Specifically, if an RTP control protocol message is received, recalculate the loopback delay with the second terminal device based on the received RTP control protocol message, and use the calculated loopback delay as the new current reference delay.
[0064] Further, in the embodiment of the present application, the received RTP message sent by the second terminal device is an extended RTP message, and the extended RTP message also carries the one-way transmission delay deviation of two RTP messages calculated by the second terminal device; then, the above delay calculation method may further include the following steps:
[0065] Based on the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation of two RTP messages calculated by the second terminal device carried in the extended RTP message, adjust the loopback delay with the second terminal device, and use the adjusted loopback delay as the new current reference delay.
[0066] That is to say, the second terminal device can also calculate the one-way transmission delay deviation of the transmission link from the first terminal device to the second terminal device for the RTP packets sent by the first terminal device based on the same rule, and inform the first terminal device of the calculated one-way transmission delay deviation of the transmission link through the extended RTP packets. Then, the first terminal device adjusts the loopback delay between the first terminal device and the second terminal device based on the current reference delay, the one-way transmission delay of the transmission link from the second terminal device to the first terminal device calculated locally, and the one-way transmission delay from the first terminal device to the second terminal device, so as to obtain the adjusted current reference delay.
[0067] Of course, when the first terminal device calculates the one-way transmission delay deviation of the two RTP packets, it can also carry the one-way transmission delay deviation in the extended RTP packet and inform the second terminal device.
[0068] In the embodiment of the present application, when adjusting the loopback delay with the second terminal device based on the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation of the two RTP packets calculated by the second terminal device carried in the extended RTP packet, and using the adjusted loopback delay as the new current reference delay, a preferred implementation is to use the sum of the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation of the two RTP packets calculated by the second terminal device carried in the extended RTP packet as the current loopback delay between the first terminal device and the second terminal device.
[0069] Exemplarily, refer to Figure 2 As shown in the figure, it is a schematic structural diagram of a delay calculation device provided by an embodiment of the present application. The device is applied to the first terminal device, and a Real-time Transport Protocol (RTP) runs between the first terminal device and the second terminal device. The device includes:
[0070] A first determination unit 20, configured to determine a current reference delay, where the current reference delay is the loopback delay between the first terminal device and the second terminal device calculated based on the RTP control protocol packet;
[0071] A calculation unit 21, if receiving an RTP packet sent by the second terminal device, the calculation unit is configured to calculate the one-way transmission delay of transmitting the RTP packet based on the reception timestamp of receiving the RTP packet and the transmission timestamp of the second terminal device carrying the RTP packet when sending the RTP packet;
[0072] A second determination unit 22, configured to determine the one-way transmission delay deviation of the two RTP packets based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time;
[0073] An adjustment unit 23, configured to adjust the loopback delay with the second terminal device based on the current reference delay and the one-way transmission delay deviation, and use the adjusted loopback delay as the new current reference delay.
[0074] Optionally, when determining the one-way transmission delay deviation between two RTP packets based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time, the second determination unit 22 is specifically configured to:
[0075] Determine the difference between the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time as the one-way transmission delay deviation between two RTP packets.
[0076] Optionally, when adjusting the loopback delay with the second terminal device based on the current reference delay and the one-way transmission delay deviation, the adjustment unit 23 is specifically configured to:
[0077] Use the sum of the current reference delay and twice the one-way transmission delay deviation as the current loopback delay with the second terminal device.
[0078] Optionally, the received RTP packet from the second terminal device is an extended RTP packet, and the extended RTP packet further carries the one-way transmission delay deviation between two RTP packets calculated by the second terminal device; the adjustment unit 23 is further configured to:
[0079] Adjust the loopback delay with the second terminal device based on the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation between two RTP packets calculated by the second terminal device carried in the extended RTP packet, and use the adjusted loopback delay as the new current reference delay.
[0080] Optionally, when adjusting the loopback delay with the second terminal device based on the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation between two RTP packets calculated by the second terminal device carried in the extended RTP packet, and using the adjusted loopback delay as the new current reference delay, the adjustment unit 23 is specifically configured to:
[0081] Use the sum of the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation between two RTP packets calculated by the second terminal device carried in the extended RTP packet as the current loopback delay with the second terminal device.
[0082] Optionally, if an RTP control protocol message is received, the computing unit is further configured to recalculate the loopback delay with the second terminal device based on the received RTP control protocol message, and use the calculated loopback delay as the new current reference delay.
[0083] The above units may be one or more integrated circuits configured to implement the above methods. For example: one or more application specific integrated circuits (ASICs), or one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs), etc. Again, when a certain unit above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processors that can call program code. Again, these units may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0084] Furthermore, for the delay calculation device provided in the embodiments of the present application, from a hardware perspective, the schematic diagram of the hardware architecture of the delay calculation device can be seen Figure 3 as shown. The delay calculation device may include: a memory 30 and a processor 31.
[0085] The memory 30 is used to store program instructions; the processor 31 calls the program instructions stored in the memory 30 and executes the above method embodiments according to the obtained program instructions. The specific implementation manners and technical effects are similar and will not be elaborated here.
[0086] Optionally, the present application further provides a terminal device, including at least one processing element (or chip) for executing the above method embodiments.
[0087] Optionally, the present application further provides a program product, such as a computer-readable storage medium, which stores computer-executable instructions for causing the computer to execute the above method embodiments.
[0088] Here, the machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and so on. For example, the machine-readable storage medium can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or a combination thereof.
[0089] The systems, devices, modules, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, and the specific form of the computer can be a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or a combination of any several of these devices.
[0090] For the convenience of description, when describing the above devices, they are described separately as various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0091] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, system, or computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0092] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing devices to generate a machine, such that the instructions executed by the processors of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0093] Moreover, these computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufacture including an instruction device that implements the functions specified in one process Figure 1 or more processes and / or blocks Figure 1 or the functions specified in one block or more blocks.
[0094] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are executed on the computer or other programmable apparatus to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one process Figure 1 or more processes and / or blocks Figure 1 or the functions specified in one block or more blocks.
[0095] The above is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the scope of protection of the present application.
Claims
1. A method for calculating delay, characterized in that, it is applied to a first terminal device, and a Real - Time Transport Protocol (RTP) runs between the first terminal device and a second terminal device. The method includes: Determine the current reference delay, where the current reference delay is the loop - back delay calculated based on the RTP control protocol message and between the first terminal device and the second terminal device; If an RTP message sent by the second terminal device is received, calculate the one - way transmission delay of transmitting the RTP message based on the reception timestamp of receiving the RTP message and the transmission timestamp carried by the RTP message indicating the second terminal device sending the RTP message; Based on the one - way transmission delay of the RTP message and the one - way transmission delay of the RTP message calculated last time, determine the deviation of the one - way transmission delay between two RTP messages; Based on the current reference delay and the one - way transmission delay deviation, adjust the loop - back delay between the first terminal device and the second terminal device, and use the adjusted loop - back delay as the new current reference delay; The step of adjusting the loop - back delay between the first terminal device and the second terminal device based on the current reference delay and the one - way transmission delay deviation includes: Use the sum of the current reference delay and twice the one - way transmission delay deviation as the current loop - back delay between the first terminal device and the second terminal device.
2. The method according to claim 1, characterized in that, The step of determining the deviation of the one - way transmission delay between two RTP messages based on the one - way transmission delay of the RTP message and the one - way transmission delay of the RTP message calculated last time includes: Determine the difference between the one - way transmission delay of the RTP message and the one - way transmission delay of the RTP message calculated last time as the deviation of the one - way transmission delay between two RTP messages.
3. The method according to claim 1, characterized in that, The RTP message received from the second terminal device is an extended RTP message, and the extended RTP message also carries the deviation of the one - way transmission delay between two RTP messages calculated by the second terminal device; The method further includes: Based on the current reference delay, the one - way transmission delay deviation, and the deviation of the one - way transmission delay between two RTP messages carried by the extended RTP message calculated by the second terminal device, adjust the loop - back delay between the first terminal device and the second terminal device, and use the adjusted loop - back delay as the new current reference delay.
4. The method according to claim 3, characterized in that, The step of adjusting the loop - back delay between the first terminal device and the second terminal device based on the current reference delay, the one - way transmission delay deviation, and the deviation of the one - way transmission delay between two RTP messages carried by the extended RTP message calculated by the second terminal device, and using the adjusted loop - back delay as the new current reference delay includes: Use the sum of the current reference delay, the one - way transmission delay deviation, and the deviation of the one - way transmission delay between two RTP messages carried by the extended RTP message calculated by the second terminal device as the current loop - back delay between the first terminal device and the second terminal device.
5. The method according to claim 1, characterized in that, The method further includes: If an RTP control protocol packet is received, recalculate the loopback delay with the second terminal device based on the received RTP control protocol packet, and use the calculated loopback delay as the new current reference delay.
6. A delay calculation device, characterized in that, applied to a first terminal device, where a Real-time Transport Protocol (RTP) runs between the first terminal device and a second terminal device, and the device includes: A first determination unit, configured to determine a current reference delay, where the current reference delay is the loopback delay calculated based on an RTP control protocol packet with the second terminal device; A calculation unit, if an RTP packet sent by the second terminal device is received, the calculation unit is configured to calculate the one-way transmission delay of transmitting the RTP packet based on the reception timestamp of receiving the RTP packet and the transmission timestamp of the second terminal device carrying the RTP packet when sending the RTP packet; A second determination unit, configured to determine the one-way transmission delay deviation between two RTP packets based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time; An adjustment unit, configured to adjust the loopback delay with the second terminal device based on the current reference delay and the one-way transmission delay deviation, and use the adjusted loopback delay as the new current reference delay; When adjusting the loopback delay with the second terminal device based on the current reference delay and the one-way transmission delay deviation, the adjustment unit is specifically configured to: Use the sum of the current reference delay and twice the one-way transmission delay deviation as the current loopback delay with the second terminal device.
7. The device according to claim 6, characterized in that, when determining the one-way transmission delay deviation between two RTP packets based on the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time, the second determination unit is specifically configured to: Determine the difference between the one-way transmission delay of the RTP packet and the one-way transmission delay of the RTP packet calculated last time as the one-way transmission delay deviation between two RTP packets.
8. The device according to claim 6, characterized in that, the RTP packet received from the second terminal device is an extended RTP packet, and the extended RTP packet also carries the one-way transmission delay deviation between two RTP packets calculated by the second terminal device; the adjustment unit is further configured to: Adjust the loopback delay with the second terminal device based on the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation between two RTP packets calculated by the second terminal device carried in the extended RTP packet, and use the adjusted loopback delay as the new current reference delay.
9. The device according to claim 8, characterized in that, Based on the current reference delay, the one-way transmission delay deviation and the one-way transmission delay deviation of two RTP packets calculated by the second terminal device carried in the extended RTP packet, when adjusting the loopback delay with the second terminal device and using the adjusted loopback delay as the new current reference delay, the adjustment unit is specifically configured to: Use the sum of the current reference delay, the one-way transmission delay deviation, and the one-way transmission delay deviation of two RTP packets calculated by the second terminal device carried in the extended RTP packet as the current loopback delay with the second terminal device.
10. The apparatus according to claim 6, characterized in that if an RTP control protocol packet is received, the calculation unit is further configured to recalculate the loopback delay with the second terminal device based on the received RTP control protocol packet, and use the calculated loopback delay as the new current reference delay.
Citation Information
Patent Citations
Packet forwarding time delay measuring method, device and system
CN106161121A