CN114189487B - RTP-based data reordering method, system, equipment and medium - Google Patents

RTP-based data reordering method, system, equipment and medium Download PDF

Info

Publication number
CN114189487B
CN114189487B CN202111321277.0A CN202111321277A CN114189487B CN 114189487 B CN114189487 B CN 114189487B CN 202111321277 A CN202111321277 A CN 202111321277A CN 114189487 B CN114189487 B CN 114189487B
Authority
CN
China
Prior art keywords
rtp
linked list
array
data packet
sequence number
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111321277.0A
Other languages
Chinese (zh)
Other versions
CN114189487A (en
Inventor
陈弘诺
曾汉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Yitong Lianyun Intelligent Information Co ltd
Original Assignee
Guangdong Yitong Lianyun Intelligent Information Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Yitong Lianyun Intelligent Information Co ltd filed Critical Guangdong Yitong Lianyun Intelligent Information Co ltd
Priority to CN202111321277.0A priority Critical patent/CN114189487B/en
Publication of CN114189487A publication Critical patent/CN114189487A/en
Application granted granted Critical
Publication of CN114189487B publication Critical patent/CN114189487B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

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

Abstract

The invention discloses a data reordering method, a system, equipment and a medium based on RTP, wherein the method comprises the following steps: receiving RTP data packets; analyzing the sequence number and the time stamp in the RTP data packet; when the sequence number is not increased in sequence, the RTP data packet is sent to a double-linked list, otherwise, the RTP data packet is sent to a sending buffer queue, and the step of receiving the RTP data packet is returned; when three data packets with different time stamps exist in the doubly-linked list, extracting the data packet with the smallest time stamp in the doubly-linked list to a first array, otherwise, returning to the step of receiving the RTP data packet; traversing the continuous data packets to be a second array when the rest data packets in the bidirectional linked list are continuous with the data packet sequence numbers of the first array, and sending the first array and the second array to a sending buffer queue, otherwise, sending the first array to the sending buffer queue; the method can reorder the data packets and can be widely applied to the technical field of data communication.

Description

RTP-based data reordering method, system, equipment and medium
Technical Field
The invention relates to the technical field of data communication, in particular to a data reordering method, a system, equipment and a medium based on RTP.
Background
RTP is a network real-time transport protocol that details the standard format for delivering audio and video data packets over the internet and is therefore commonly used for various streaming protocols attached to audio and video transport protocols, such as the live network protocols GB/T28181, ONVIF, and WebRTC. The RTP is also an indispensable protocol in most live broadcast platforms, however, in practical use, due to the requirement of live broadcast real-time, a manner of transmitting RTP based on UDP is adopted, which also results in packet loss or disorder in the receiver of the RTP media stream. The prior art carries out a segmentation ordering algorithm according to the self-increasing seq field of the RTP packet header and the self-set network jitter prevention threshold time, the methods need to set parameters, and the data structure used by encoding is complex and the real-time performance is low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, a system, a device, and a medium for reordering data based on RTP, so as to enhance network adaptability, reduce encoding time, and improve real-time performance of data transmission.
In one aspect, the present invention provides a data reordering method based on RTP, including:
Receiving RTP data packets;
analyzing the sequence number and the time stamp in the RTP data packet;
when the sequence number is not increased in sequence, the RTP data packet is sent to a double-linked list, otherwise, the RTP data packet is sent to a sending buffer queue, and the step of receiving the RTP data packet is returned;
When three data packets with different time stamps exist in the doubly-linked list, extracting the data packet with the smallest time stamp in the doubly-linked list to a first array, otherwise, returning to the step of receiving RTP data packets;
And traversing the continuous data packets to be a second array when the rest data packets in the doubly linked list are continuous with the data packet serial numbers of the first array, and sending the first array and the second array to a sending buffer queue, otherwise, sending the first array to the sending buffer queue.
Optionally, before the receiving RTP data packet, the method further includes:
initializing a double-linked list and a sending buffer queue, wherein the double-linked list is used for sequentially storing RTP data packets, and the sending buffer queue is used for sending the sequenced RTP data packets to an upper application;
And initializing a sequence variable to be a first numerical value, wherein the sequence variable is used for judging whether the sequence numbers are sequentially increased.
Optionally, when the sequence numbers increment non-sequentially, the method includes:
when the sequence variable is equal to the first numerical value, the sequence number is increased in a non-sequence manner;
When the sequence variable is equal to the sequence number of the RTP data packet and the length of the doubly linked list is zero, the sequence number sequentially increases, and the sequence variable is determined to be the sequence number of the RTP data packet plus one.
Optionally, when there are three data packets with different time stamps in the doubly linked list, extracting the data packet with the smallest time stamp in the doubly linked list to the first array includes:
acquiring the sequence number of the last data packet in the first array;
and determining the sequence variable to be the sequence number plus one.
Optionally, when the remaining data packets in the doubly linked list are consecutive to the data packet sequence number of the first array, traversing the consecutive data packets to be the second array, including:
When the sequence numbers of the data packets in the double-linked list are equal to the sequence variable, the rest data packets in the double-linked list are continuous with the sequence numbers of the data packets of the first array, and the continuous data packets in the double-linked list are traversed to be a second array;
And determining the sequence variable to be the last data packet sequence number in the second array plus one.
Optionally, when the sequence numbers are not sequentially increased, the method further comprises:
When the sequence variable is equal to the sequence number of the RTP data packet and the length of the doubly-linked list is non-zero, traversing the data packet which is continuous with the sequence number of the RTP data packet in the doubly-linked list, and determining the data packet as a third data group;
And determining the sequence variable to be the sequence number of the last data packet in the third data group plus one, wherein the sequence number is sequentially increased.
Optionally, sending the RTP packet to a doubly linked list includes:
traversing the double linked list from back to front according to the RTP data packet, and determining the position of the inserted sequence number;
and inserting the RTP data packet into the doubly linked list according to the insertion sequence number position.
On the other hand, the embodiment of the invention also discloses a data reordering system based on RTP, which comprises:
A first module for receiving RTP data packets;
A second module, configured to parse the sequence number and the timestamp in the RTP packet;
A third module, configured to send the RTP packet to a doubly linked list when the sequence number is not sequentially incremented, or send the RTP packet to a sending buffer queue, and return to the step of receiving the RTP packet;
A fourth module, configured to extract, when there are three data packets with different time stamps in the doubly linked list, a data packet with a smallest time stamp in the doubly linked list to a first array, and otherwise, return to the step of receiving RTP data packets;
And a fifth module, configured to traverse the consecutive data packets to a second array when the remaining data packets in the doubly linked list are consecutive with the data packet sequence numbers of the first array, and send the first array and the second array to a sending buffer queue, otherwise, send the first array to the sending buffer queue.
On the other hand, the embodiment of the invention also discloses electronic equipment, which comprises a processor and a memory;
the memory is used for storing programs;
the processor executes the program to implement the method as described above.
In another aspect, embodiments of the present invention also disclose a computer readable storage medium storing a program for execution by a processor to implement a method as described above.
In another aspect, embodiments of the present invention also disclose a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions may be read from a computer-readable storage medium by a processor of a computer device, and executed by the processor, to cause the computer device to perform the foregoing method.
Compared with the prior art, the technical scheme provided by the invention has the following technical effects: the invention receives RTP data package; analyzing the sequence number and the time stamp in the RTP data packet; when the sequence number is not increased in sequence, the RTP data packet is sent to a double-linked list, otherwise, the RTP data packet is sent to a sending buffer queue, and the step of receiving the RTP data packet is returned; when three data packets with different time stamps exist in the doubly-linked list, extracting the data packet with the smallest time stamp in the doubly-linked list to a first array, otherwise, returning to the step of receiving RTP data packets; traversing the continuous data packets to be a second array when the rest data packets in the doubly linked list are continuous with the data packet serial numbers of the first array, and sending the first array and the second array to a sending buffer queue, otherwise, sending the first array to the sending buffer queue; the data packets can be reordered through the sequence numbers and the time stamps, and the data packets are sent according to the time stamps of the data packets, so that the waiting time for the data packets is reduced, the complexity of an algorithm can be reduced, the instantaneity of data transmission is improved, and a data sending end is not required to modify a protocol.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a reordering method based on RTP data according to an embodiment of the invention.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Referring to fig. 1, an embodiment of the present invention provides a data reordering method based on RTP, including:
S101, receiving RTP data packets;
S102, analyzing the sequence number and the time stamp in the RTP data packet;
s103, when the sequence numbers are not sequentially increased, the RTP data packet is sent to a bidirectional linked list, otherwise, the RTP data packet is sent to a sending buffer queue, and the step of receiving the RTP data packet is returned;
S104, when three data packets with different time stamps exist in the doubly-linked list, extracting the data packet with the smallest time stamp in the doubly-linked list to a first array, otherwise, returning to the step of receiving RTP data packets;
And S105, traversing the continuous data packets to be a second array when the rest data packets in the doubly linked list are continuous with the data packet serial numbers of the first array, and sending the first array and the second array to a sending buffer queue, otherwise, sending the first array to the sending buffer queue.
Further as a preferred embodiment, before said receiving the RTP data packet, the method further comprises:
initializing a double-linked list and a sending buffer queue, wherein the double-linked list is used for sequentially storing RTP data packets, and the sending buffer queue is used for sending the sequenced RTP data packets to an upper application;
And initializing a sequence variable to be a first numerical value, wherein the sequence variable is used for judging whether the sequence numbers are sequentially increased.
The embodiment of the invention initializes a double-linked list and is responsible for storing RTP data packets to be ordered in the sequence of sequence numbers from small to large; initializing a sending buffer queue, which is responsible for sending the ordered RTP data packets to an upper layer application; and initializing a sequence variable for judging whether the sequence number of the received RTP data packet is increased in sequence. The first value is assigned when the sequence variable is initialized, the first value is a negative integer, and the negative one is used as the first value in the embodiment of the invention. In order to correspond to the RTP protocol, the embodiment of the present invention sets the data type of the sequence variable to int32. The embodiment of the invention can initialize a structural data type, wherein the members of the structural data type are data packet serial numbers of int32, data packet time stamps of unit32 and RTP data packets of data type as an array. When receiving RTP packets, the RTP packets are not received in sequence for various reasons, so that the RTP packets need to be reordered and the ordered RTP packets are sent to a transmission buffer queue for transmission to an upper layer application.
Further, in a preferred embodiment, in the step S103, when the sequence numbers are not sequentially incremented, the method includes:
when the sequence variable is equal to the first numerical value, the sequence number is increased in a non-sequence manner;
When the sequence variable is equal to the sequence number of the RTP data packet and the length of the doubly linked list is zero, the sequence number sequentially increases, and the sequence variable is determined to be the sequence number of the RTP data packet plus one.
When the RTP data packets are judged in sequential increasing mode, judgment is carried out through sequential variables. When the sequence variable is equal to the first value, the sequence number of the first RTP data packet is a random value, so that the sequence number of the current RTP data packet is forcedly judged to be in non-sequential increment, and the RTP data packet is sent to a doubly linked list for storage so as to be reordered later. When the sequence variable is equal to the sequence number of the RTP data packet and no data is stored in the doubly linked list, the sequence of the RTP data packet is correct at the moment, and the RTP data packet is gradually increased, and can be sent to a sending buffer queue and received to the next RTP data packet. And simultaneously, the sequence variable is modified to be the increment of the sequence of the RTP data packets at the moment, namely, the sequence of the RTP data packets at the moment is increased by one. The advantage of determining the sequence variable as the packet sequence plus one is that it can be determined whether the sequence of the next RTP packet is correct or ascending in order.
Further as a preferred embodiment, in step S104, when there are three data packets with different time stamps in the doubly linked list, extracting the data packet with the smallest time stamp in the doubly linked list to the first array includes:
acquiring the sequence number of the last data packet in the first array;
and determining the sequence variable to be the sequence number plus one.
And when the RTP data packets are judged not to be sequentially increased, inserting the RTP data packets into the doubly linked list. When three data packets with different time stamps exist in the doubly-linked list, the doubly-linked list can be reordered, and all the data packets with the smallest time stamps in the doubly-linked list are extracted as a first array and deleted from the doubly-linked list. And simultaneously acquiring the sequence number of the last data packet in the first array, and modifying the sequence variable to be the sequence number plus one.
In a further preferred embodiment, in step S105, when the remaining packets in the doubly linked list are consecutive to the packet sequence number of the first array, traversing the consecutive packets to be the second array includes:
When the sequence numbers of the data packets in the double-linked list are equal to the sequence variable, the rest data packets in the double-linked list are continuous with the sequence numbers of the data packets of the first array, and the continuous data packets in the double-linked list are traversed to be a second array;
And determining the sequence variable to be the last data packet sequence number in the second array plus one.
The embodiment of the invention compares the sequence variable with the sequence number of the data packet in the double-linked list, checks whether the sequence variable is equal to the sequence number, if so, the data packet which is continuous with the sequence number of the first array is stored in the double-linked list, then traverses from the double-linked list, searches the sequence number and the data packet which is continuous with the sequence number, and determines the continuous data packets as the second array. At this time, the sequence variable is modified to be the sequence number of the last data packet in the second array plus one.
Further as a preferred embodiment, when the sequence numbers increment non-sequentially, the method further includes:
When the sequence variable is equal to the sequence number of the RTP data packet and the length of the doubly-linked list is non-zero, traversing the data packet which is continuous with the sequence number of the RTP data packet in the doubly-linked list, and determining the data packet as a third data group;
And determining the sequence variable to be the sequence number of the last data packet in the third data group plus one, wherein the sequence number is sequentially increased.
When the sequence variable is equal to the sequence number of the RTP data packet and the length of the doubly-linked list is non-zero, it is indicated that the doubly-linked list stores disordered data, and at this time, the sequence number of the RTP data packet is correct, and it is required to find whether the doubly-linked list stores the next data packet of the RTP data packet according to the sequence number. Traversing the two-way linked list to find the next data packet of the RTP data packet and the continuous data packets. And determining the data packets as a third data group, determining that the sequence numbers of the RTP data packets are sequentially increased at the moment, and sending the third data group to a sending buffer queue. The modified sequential traversal increments the sequence number of the last packet in the third data set by one.
Further as a preferred embodiment, sending the RTP packet to a doubly linked list includes:
traversing the double linked list from back to front according to the RTP data packet, and determining the position of the inserted sequence number;
and inserting the RTP data packet into the doubly linked list according to the insertion sequence number position.
When the RTP data packet is sent to the doubly linked list, the doubly linked list is traversed from back to front according to the sequence number of the RTP data packet at the moment, and other algorithms such as a minimum heap are not adopted here, because the data packet is mostly inserted in an incremental mode, unnecessary binary tree balance operation is reduced, and finally the insertion sequence number position of the RTP data packet is determined. According to the insertion sequence number position, RTP data packets are inserted into the double-linked list, meanwhile, whether the sequence number of the last data packet in the double-linked list is fast to the maximum value of the uint16 is judged, and the sequence number of the data packet to be inserted is far smaller than the maximum value of the uint16, the sequence number value of the linked list element structure body is set to be 0x10000 for the sequence number of the data packet to be inserted, so that the insertion comparison in the subsequent linked list is convenient, and 0x10000 can be automatically subtracted when the sequence number value of the linked list element is acquired by the external program of the subsequent linked list.
The flow of the invention specifically comprises: the embodiment of the invention receives the RTP data packet, analyzes the received RTP data packet to obtain the sequence number and the timestamp, and can store the analyzed sequence number, timestamp and data packet by using the structure body. Judging whether the sequence number of the RTP data packet is sequentially increased, if not, sending the RTP data packet to a double-linked list, otherwise, sending the RTP data packet to a sending buffer queue, and returning to the step of receiving the RTP data packet to receive the next data packet. And when the sequence numbers of the RTP data packets are not sequentially increased, the RTP data packets are sent to a double-linked list, the next RTP data packet is continuously received after the RTP data packets are sent, and the sequential increasing judgment is carried out on the RTP data packets received at the moment again. When three data packets with different time stamps are stored in the doubly linked list, the data packet with the smallest time stamp in the doubly linked list is extracted to the first array. Otherwise, returning to the step of receiving RTP data packets; when the rest data packets in the bidirectional linked list are continuous with the last sequence number of the data packets of the first array, traversing the continuous data packets into the second array, wherein the sequence numbers of the second array and the first array can continuously indicate that the data packets of the two arrays are correctly ordered, and sending the first array and the second array to a sending buffer queue, otherwise, sending the first array to the sending buffer queue.
Corresponding to the method of fig. 1, the embodiment of the present invention further provides a data reordering system based on RTP, including:
A first module for receiving RTP data packets;
A second module, configured to parse the sequence number and the timestamp in the RTP packet;
A third module, configured to send the RTP packet to a doubly linked list when the sequence number is not sequentially incremented, or send the RTP packet to a sending buffer queue, and return to the step of receiving the RTP packet;
A fourth module, configured to extract, when there are three data packets with different time stamps in the doubly linked list, a data packet with a smallest time stamp in the doubly linked list to a first array, and otherwise, return to the step of receiving RTP data packets;
And a fifth module, configured to traverse the consecutive data packets to a second array when the remaining data packets in the doubly linked list are consecutive with the data packet sequence numbers of the first array, and send the first array and the second array to a sending buffer queue, otherwise, send the first array to the sending buffer queue.
Corresponding to the method of fig. 1, the embodiment of the invention also provides an electronic device, which comprises a processor and a memory; the memory is used for storing programs; the processor executes the program to implement the method as described above.
Corresponding to the method of fig. 1, an embodiment of the present invention also provides a computer-readable storage medium storing a program to be executed by a processor to implement the method as described above.
Embodiments of the present invention also disclose a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions may be read from a computer-readable storage medium by a processor of a computer device, and executed by the processor, to cause the computer device to perform the method shown in fig. 1.
In summary, the embodiment of the invention has the following advantages:
(1) According to the embodiment of the invention, the sequence number and the time stamp of the RTP data packet are reordered, so that the complexity of an algorithm can be reduced;
(2) According to the embodiment of the invention, the data packet is sent through the timestamp of the RTP data packet, and the data packet waiting for outdated is abandoned, so that the instantaneity of data transmission can be improved;
(3) According to the RTP-based data reordering method, the data can be reordered without modifying an RTP protocol by a data sending end, and the data transmission efficiency is improved.
In some alternative embodiments, the functions/acts noted in the block diagrams may occur out of the order noted in the operational illustrations. For example, two blocks shown in succession may in fact be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved. Furthermore, the embodiments presented and described in the flowcharts of the present invention are provided by way of example in order to provide a more thorough understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed, and in which sub-operations described as part of a larger operation are performed independently.
Furthermore, while the invention is described in the context of functional modules, it should be appreciated that, unless otherwise indicated, one or more of the described functions and/or features may be integrated in a single physical device and/or software module or one or more functions and/or features may be implemented in separate physical devices or software modules. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary to an understanding of the present invention. Rather, the actual implementation of the various functional modules in the apparatus disclosed herein will be apparent to those skilled in the art from consideration of their attributes, functions and internal relationships. Accordingly, one of ordinary skill in the art can implement the invention as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are merely illustrative and are not intended to be limiting upon the scope of the invention, which is to be defined in the appended claims and their full scope of equivalents.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: many changes, modifications, substitutions and variations may be made to the embodiments without departing from the spirit and principles of the invention, the scope of which is defined by the claims and their equivalents.
While the preferred embodiment of the present application has been described in detail, the present application is not limited to the embodiments described above, and those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present application, and these equivalent modifications or substitutions are included in the scope of the present application as defined in the appended claims.

Claims (10)

1. A method for reordering data based on RTP, comprising:
Receiving RTP data packets;
analyzing the sequence number and the time stamp in the RTP data packet;
when the sequence number is not increased in sequence, the RTP data packet is sent to a double-linked list, otherwise, the RTP data packet is sent to a sending buffer queue, and the step of receiving the RTP data packet is returned;
When three data packets with different time stamps exist in the doubly-linked list, extracting the data packet with the smallest time stamp in the doubly-linked list to a first array, otherwise, returning to the step of receiving RTP data packets;
And traversing the continuous data packets to be a second array when the rest data packets in the doubly linked list are continuous with the data packet serial numbers of the first array, and sending the first array and the second array to a sending buffer queue, otherwise, sending the first array to the sending buffer queue.
2. The RTP-based data reordering method of claim 1, further comprising, prior to said receiving RTP packets:
initializing a double-linked list and a sending buffer queue, wherein the double-linked list is used for sequentially storing RTP data packets, and the sending buffer queue is used for sending the sequenced RTP data packets to an upper application;
And initializing a sequence variable to be a first numerical value, wherein the sequence variable is used for judging whether the sequence numbers are sequentially increased.
3. A method of reordering RTP-based data according to claim 2, characterized in that said method comprises, when said sequence number is not sequentially incremented:
when the sequence variable is equal to the first numerical value, the sequence number is increased in a non-sequence manner;
When the sequence variable is equal to the sequence number of the RTP data packet and the length of the doubly linked list is zero, the sequence number sequentially increases, and the sequence variable is determined to be the sequence number of the RTP data packet plus one.
4. The RTP-based data reordering method of claim 2 wherein, when there are three packets with different time stamps in the doubly linked list, extracting the packet with the smallest time stamp in the doubly linked list to the first array comprises:
acquiring the sequence number of the last data packet in the first array;
and determining the sequence variable to be the sequence number plus one.
5. The RTP-based data reordering method of claim 1 wherein traversing consecutive packets to a second array when the remaining packets in the doubly linked list are consecutive to the packet sequence number of the first array comprises:
When the sequence numbers of the data packets in the double-linked list are equal to the sequence variable, the rest data packets in the double-linked list are continuous with the sequence numbers of the data packets of the first array, and the continuous data packets in the double-linked list are traversed to be a second array;
And determining the sequence variable to be the last data packet sequence number in the second array plus one.
6. A method for RTP-based data reordering according to claim 3, further comprising, when said sequence number is not sequentially incremented:
When the sequence variable is equal to the sequence number of the RTP data packet and the length of the doubly-linked list is non-zero, traversing the data packet which is continuous with the sequence number of the RTP data packet in the doubly-linked list, and determining the data packet as a third data group;
And determining the sequence variable to be the sequence number of the last data packet in the third data group plus one, wherein the sequence number is sequentially increased.
7. The RTP-based data reordering method of claim 1 wherein transmitting the RTP packets to a doubly linked list comprises:
traversing the double linked list from back to front according to the RTP data packet, and determining the position of the inserted sequence number;
and inserting the RTP data packet into the doubly linked list according to the insertion sequence number position.
8. A RTP-based data reordering system comprising:
A first module for receiving RTP data packets;
A second module, configured to parse the sequence number and the timestamp in the RTP packet;
A third module, configured to send the RTP packet to a doubly linked list when the sequence number is not sequentially incremented, or send the RTP packet to a sending buffer queue, and return to the first module;
a fourth module, configured to extract, when three data packets with different time stamps exist in the doubly linked list, a data packet with a smallest time stamp in the doubly linked list to a first array, and otherwise, return to the first module;
And a fifth module, configured to traverse the consecutive data packets to a second array when the remaining data packets in the doubly linked list are consecutive with the data packet sequence numbers of the first array, and send the first array and the second array to a sending buffer queue, otherwise, send the first array to the sending buffer queue.
9. An electronic device comprising a processor and a memory;
the memory is used for storing programs;
The processor executing the program to implement the method of any one of claims 1-7.
10. A computer readable storage medium, characterized in that the storage medium stores a program, which is executed by a processor to implement the method of any one of claims 1-7.
CN202111321277.0A 2021-11-09 2021-11-09 RTP-based data reordering method, system, equipment and medium Active CN114189487B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111321277.0A CN114189487B (en) 2021-11-09 2021-11-09 RTP-based data reordering method, system, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111321277.0A CN114189487B (en) 2021-11-09 2021-11-09 RTP-based data reordering method, system, equipment and medium

Publications (2)

Publication Number Publication Date
CN114189487A CN114189487A (en) 2022-03-15
CN114189487B true CN114189487B (en) 2024-05-14

Family

ID=80601464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111321277.0A Active CN114189487B (en) 2021-11-09 2021-11-09 RTP-based data reordering method, system, equipment and medium

Country Status (1)

Country Link
CN (1) CN114189487B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20080049876A (en) * 2006-12-01 2008-06-05 엘지노텔 주식회사 Apparatus and method for processing jitter and rearranging packet sequence in network based on udp/rtp
CN101505316A (en) * 2008-02-04 2009-08-12 阿尔卡特朗讯公司 Method and device for reordering and multiplexing multimedia packets from multimedia streams pertaining to interrelated sessions
CN103152134A (en) * 2013-02-26 2013-06-12 汉柏科技有限公司 Real time protocol (RTP)-based method and system for rearranging voice packets at receiving end
WO2017118273A1 (en) * 2016-01-04 2017-07-13 中兴通讯股份有限公司 Method and device for transmitting and receiving timestamp information
CN109547359A (en) * 2018-11-30 2019-03-29 高新兴科技集团股份有限公司 RTP data packet disorder rearrangement method, device, storage medium and electronic equipment
CN111447148A (en) * 2020-03-12 2020-07-24 深圳震有科技股份有限公司 RTP data packet sequencing method, system and storage medium
CN113014586A (en) * 2021-03-04 2021-06-22 即时匹配(上海)网络科技有限公司 RTP data packet out-of-order processing and framing method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20080049876A (en) * 2006-12-01 2008-06-05 엘지노텔 주식회사 Apparatus and method for processing jitter and rearranging packet sequence in network based on udp/rtp
CN101505316A (en) * 2008-02-04 2009-08-12 阿尔卡特朗讯公司 Method and device for reordering and multiplexing multimedia packets from multimedia streams pertaining to interrelated sessions
CN103152134A (en) * 2013-02-26 2013-06-12 汉柏科技有限公司 Real time protocol (RTP)-based method and system for rearranging voice packets at receiving end
WO2017118273A1 (en) * 2016-01-04 2017-07-13 中兴通讯股份有限公司 Method and device for transmitting and receiving timestamp information
CN109547359A (en) * 2018-11-30 2019-03-29 高新兴科技集团股份有限公司 RTP data packet disorder rearrangement method, device, storage medium and electronic equipment
CN111447148A (en) * 2020-03-12 2020-07-24 深圳震有科技股份有限公司 RTP data packet sequencing method, system and storage medium
CN113014586A (en) * 2021-03-04 2021-06-22 即时匹配(上海)网络科技有限公司 RTP data packet out-of-order processing and framing method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于RTP协议的音频传输技术的研究与实现;赵莹莹;张兰芬;;现代电子技术(第10期);全文 *

Also Published As

Publication number Publication date
CN114189487A (en) 2022-03-15

Similar Documents

Publication Publication Date Title
US10587286B1 (en) Methods and devices for handling equiprobable symbols in entropy coding
CN105916058B (en) A kind of streaming media buffer playback method, device and display equipment
JP5780684B2 (en) Content reproduction information estimation apparatus, method, and program
US9420022B2 (en) Media requests to counter latency and minimize network bursts
US9363684B2 (en) Determining loss of IP packets
EP3142381A1 (en) Network video playing method and device
US9253510B2 (en) Methods, a client and a server for handling an MPEG transport stream
CN114640886B (en) Self-adaptive bandwidth audio/video transmission method, device, computer equipment and medium
CN111901678B (en) Anti-jitter smoothing method and system for TCP real-time video stream
CN113259256A (en) Repeating data packet filtering method and system and readable storage medium
CN104202656B (en) Network audio MP3 flows out of order segmentation decoding method
CN114189487B (en) RTP-based data reordering method, system, equipment and medium
CN108055595A (en) Reorientation method, the computer readable storage medium of video image
CN108124192B (en) HLS streaming media playing method and system
US8209593B2 (en) Method and DVB-H terminal for confirming integrity of container
US11057312B2 (en) Apparatus and method for configuring MMT payload header
US11212232B2 (en) Transmission and reception of a data stream
CN112887054A (en) Data stream packaging method, unpacking method and system based on length escape
CN101296166A (en) Method for measuring multimedia data based on index
CN113409801A (en) Noise processing method, system, medium, and apparatus for real-time audio stream playback
CN111988674A (en) Multimedia data transmission method, device, equipment and storage medium
CN111555842B (en) Method and device for transmitting data frame
CN115942000B (en) H.264 format video stream transcoding method, device, equipment and medium
CN109756745B (en) Live streaming data sending method, live acceleration server and terminal
US20020083125A1 (en) Interactive processing system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 510630 room 1101, building 1, No.16 Keyun Road, Tianhe District, Guangzhou City, Guangdong Province (office use only)

Applicant after: Guangdong Yitong Lianyun Intelligent Information Co.,Ltd.

Address before: 510630 building 1101, No.16 Keyun Road, Tianhe District, Guangzhou City, Guangdong Province

Applicant before: YITONG CENTURY INTERNET OF THINGS RESEARCH INSTITUTE (GUANGZHOU) Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant