CN114189487A - Data reordering method, system, equipment and medium based on RTP - Google Patents

Data reordering method, system, equipment and medium based on RTP Download PDF

Info

Publication number
CN114189487A
CN114189487A CN202111321277.0A CN202111321277A CN114189487A CN 114189487 A CN114189487 A CN 114189487A CN 202111321277 A CN202111321277 A CN 202111321277A CN 114189487 A CN114189487 A CN 114189487A
Authority
CN
China
Prior art keywords
rtp
linked list
data packet
array
sequence
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.)
Granted
Application number
CN202111321277.0A
Other languages
Chinese (zh)
Other versions
CN114189487B (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.)
Yitong Century Internet Of Things Research Institute Guangzhou Co ltd
Original Assignee
Yitong Century Internet Of Things Research Institute Guangzhou 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 Yitong Century Internet Of Things Research Institute Guangzhou Co ltd filed Critical Yitong Century Internet Of Things Research Institute Guangzhou 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

Images

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, a device and a medium based on RTP, wherein the method comprises the following steps: receiving an RTP data packet; analyzing the sequence number and the time stamp in the RTP data packet; when the sequence numbers are increased in a non-sequential manner, sending the RTP data packets to a two-way linked list, otherwise, sending the RTP data packets to a sending buffer queue, and returning to the step of receiving the RTP data packets; when three data packets with different timestamps exist in the doubly linked list, extracting the data packet with the smallest timestamp in the doubly linked list to a first array, and if not, returning to the step of receiving the RTP data packet; when the data packets left in the double linked list are continuous with the data packet sequence number of the first array, traversing the continuous data packets into a second 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

Data reordering method, system, equipment and medium based on RTP
Technical Field
The present invention relates to the field of data communication technologies, and in particular, to a method, a system, a device, and a medium for reordering data based on RTP.
Background
RTP is a network real-time transport protocol, which specifies a standard format for transmitting audio/video data packets over the internet, and is therefore often used for audio/video transport protocols attached to various streaming media protocols, such as the live webcast protocols GB/T28181, ONVIF and WebRTC. This also makes RTP an indispensable protocol in most live broadcast platforms, however, in practical use, because of the requirement of live broadcast real-time, a UDP-based RTP transmission mode is adopted, and a packet loss or disorder situation may occur at the receiver of the RTP media stream. In the prior art, a segmentation sorting algorithm is performed according to a self-increment seq field of an RTP packet header and self-set network jitter prevention threshold time, parameters need to be set in the methods, and a data structure used for encoding is complex and has low real-time performance.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data reordering method, system, device and medium 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 an RTP data packet;
analyzing the sequence number and the timestamp in the RTP data packet;
when the sequence numbers are increased in a non-sequential manner, the RTP data packets are sent to a two-way linked list, otherwise, the RTP data packets are sent to a sending buffer queue, and the step of receiving the RTP data packets is returned;
when three data packets with different timestamps exist in the doubly linked list, extracting the data packet with the smallest timestamp in the doubly linked list to a first array, and if not, returning to the step of receiving the RTP data packet;
and when the data packets left in the double linked list are continuous with the data packet sequence number of the first array, traversing the continuous data packets into a second 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 the RTP packet, the method further includes:
initializing a bidirectional linked list and a sending buffer queue, wherein the bidirectional linked list is used for storing RTP data packets in sequence, and the sending buffer queue is used for sending the sequenced RTP data packets to an upper layer application;
initializing a sequence variable as a first numerical value, wherein the sequence variable is used for judging whether the sequence numbers are sequentially increased.
Optionally, when the sequence number is non-sequentially incremented, the method includes:
when the sequential variable is equal to a first value, the sequence number is non-sequentially incremented;
and when the sequence variable is equal to the sequence number of the RTP data packet and the length of the bidirectional linked list is zero, the sequence number is sequentially increased, 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 timestamps in the doubly linked list, extracting the data packet with the smallest timestamp 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 as the sequence number plus one.
Optionally, when the remaining packets in the doubly linked list are consecutive to the packet sequence number of the first array, traversing consecutive packets to a second array includes:
when the sequence number of the data packet in the double linked list is equal to the sequence variable, the remaining data packets in the double linked list are continuous with the sequence number of the data packet of the first array, and the data packets which are continuous in the double linked list are traversed to be a second array;
and determining the sequence variable as the last data packet sequence number plus one in the second array.
Optionally, when the sequence number is non-sequentially incremented, the method further includes:
when the sequence variable is equal to the serial number of the RTP data packet and the length of the double linked list is nonzero, traversing the data packets which are continuous with the serial number of the RTP data packet in the double linked list to determine the data packets as a third data group;
and determining that the sequence variable is 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:
according to the RTP data packet, traversing the bidirectional linked list from back to front to determine the position of an insertion 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 the following steps:
a first module for receiving an RTP data packet;
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 numbers increase in a non-sequential manner, 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 three data packets with different timestamps exist in the doubly linked list, the data packet with the smallest timestamp in the doubly linked list to the first array, and otherwise, return to the step of receiving the RTP data packet;
and the fifth module is used for traversing the continuous data packets into a second array when the data packets left in the double 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.
On the other hand, the embodiment of the invention also discloses 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.
On the other hand, the embodiment of the invention also discloses a computer readable storage medium, wherein the storage medium stores a program, and the program is executed by a processor to realize the method.
In another aspect, an embodiment of the present invention further discloses a computer program product or a computer program, where the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The computer instructions may be read by a processor of a computer device from a computer-readable storage medium, and the computer instructions executed by the processor cause the computer device to perform the foregoing method.
Compared with the prior art, the invention adopting the technical scheme has the following technical effects: the invention receives RTP data packet; analyzing the sequence number and the timestamp in the RTP data packet; when the sequence numbers are increased in a non-sequential manner, the RTP data packets are sent to a two-way linked list, otherwise, the RTP data packets are sent to a sending buffer queue, and the step of receiving the RTP data packets is returned; when three data packets with different timestamps exist in the doubly linked list, extracting the data packet with the smallest timestamp in the doubly linked list to a first array, and if not, returning to the step of receiving the RTP data packet; when the data packets left in the double linked list are continuous with the data packet sequence number of the first array, traversing the continuous data packets into a second 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 timestamps, the data packets are sent according to the timestamps of the data packets, the waiting time of the data packets is reduced, the complexity of an algorithm can be reduced, the real-time performance of data transmission is improved, and a protocol is not required to be modified by a data sending end.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a method for reordering data based on RTP according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Referring to fig. 1, an embodiment of the present invention provides a data reordering method based on RTP, including:
s101, receiving an RTP data packet;
s102, analyzing the sequence number and the time stamp in the RTP data packet;
s103, when the sequence numbers are increased in a non-sequential manner, the RTP data packets are sent to a bidirectional linked list, otherwise, the RTP data packets are sent to a sending buffer queue, and the step of receiving the RTP data packets is returned;
s104, when three data packets with different timestamps exist in the doubly linked list, extracting the data packet with the smallest timestamp in the doubly linked list to a first array, and if not, returning to the step of receiving the RTP data packet;
s105, when the data packets left in the double linked list are continuous with the data packet sequence number of the first array, traversing the continuous data packets into a second 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 the receiving the RTP packet, the method further includes:
initializing a bidirectional linked list and a sending buffer queue, wherein the bidirectional linked list is used for storing RTP data packets in sequence, and the sending buffer queue is used for sending the sequenced RTP data packets to an upper layer application;
initializing a sequence variable as 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 sequenced in the sequence of sequence numbers from small to large; initializing a sending buffer queue, and sending the sequenced RTP data packets to an upper layer application; initializing a sequence variable for judging whether the sequence number of the received RTP data packet is increased in sequence. When the sequence variable is initialized, the value is assigned as a first numerical value, the first numerical value is a negative integer, and the embodiment of the invention adopts a negative one as the first numerical value. To correspond to the RTP protocol, the embodiment of the present invention sets the data type of the sequence variable to int 32. The embodiment of the present invention may further initialize a data type of the structure body, and the members of the data type are a data packet sequence number of int32, a data packet timestamp of unit32, and an RTP data packet of which the data type is an array. It should be noted that, when receiving the RTP packets, the RTP packets are not received in sequence for various reasons, and therefore the RTP packets need to be reordered, and the ordered RTP packets are sent to the sending buffer queue to be sent to the upper layer application.
In a further preferred embodiment, in step S103, when the sequence numbers are incremented non-sequentially, the method further includes:
when the sequential variable is equal to a first value, the sequence number is non-sequentially incremented;
and when the sequence variable is equal to the sequence number of the RTP data packet and the length of the bidirectional linked list is zero, the sequence number is sequentially increased, and the sequence variable is determined to be the sequence number of the RTP data packet plus one.
When the RTP data packet is judged in sequence increasing mode, the RTP data packet is judged through sequence 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 forcibly judged to be non-sequentially increased, and the RTP data packet is sent to the doubly linked list for storage, so that the RTP data packets can be reordered subsequently. 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 at this time, the sequence of the RTP data packet at this time can be determined to be correct, the sequence is increased progressively, and the RTP data packet can be sent to a sending buffer queue and receive the next RTP data packet. And meanwhile, 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 next RTP packet is in the correct sequence, or in an ascending sequence.
Further as a preferred embodiment, in the step S104, when there are three data packets with different timestamps in the doubly linked list, extracting the data packet with the smallest timestamp 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 as 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 timestamps exist in the doubly linked list, the doubly linked list can be reordered, all the data packets with the smallest timestamps in the doubly linked list are extracted as a first array, and the data packets are 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 into the sequence number plus one.
Further preferably, 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 a second array includes:
when the sequence number of the data packet in the double linked list is equal to the sequence variable, the remaining data packets in the double linked list are continuous with the sequence number of the data packet of the first array, and the data packets which are continuous in the double linked list are traversed to be a second array;
and determining the sequence variable as the last data packet sequence number plus one in the second array.
The method comprises the steps of comparing sequence variables with sequence numbers of data packets in a doubly linked list, checking whether the sequence numbers are equal, if so, indicating that the doubly linked list stores data packets which are continuous with the sequence number of a first array, traversing from the doubly linked list, searching the sequence number and the data packets which are continuous with the sequence number, and determining the continuous data packets as a 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 are not sequentially incremented, the method further includes:
when the sequence variable is equal to the serial number of the RTP data packet and the length of the double linked list is nonzero, traversing the data packets which are continuous with the serial number of the RTP data packet in the double linked list to determine the data packets as a third data group;
and determining that the sequence variable is 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 serial number of the RTP data packet and the length of the doubly linked list is nonzero, it is indicated that data out of sequence is stored in the doubly linked list, and at this time, the serial number of the RTP data packet is correct, and whether the doubly linked list stores the next data packet of the RTP data packet at this time needs to be searched according to the serial number. And traversing the doubly linked list, and searching the next data packet and the continuous data packet of the RTP data packet at the moment. And determining the data packets as a third data group, determining that the sequence number of the RTP data packet is increased progressively at the moment, and sending the third data group to a sending buffer queue. The modified sequence traverses the sequence number of the last packet in the third data group plus one.
Further as a preferred embodiment, sending the RTP packet to a doubly linked list includes:
according to the RTP data packet, traversing the bidirectional linked list from back to front to determine the position of an insertion 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 minimum heap are not adopted, because the data packet is mostly inserted in an increasing mode, unnecessary binary tree balance operation is reduced, and finally the position of the inserted sequence number of the RTP data packet is determined. Inserting RTP data packets into the doubly-linked list according to the positions of the inserted serial numbers, judging whether the serial number of the last data packet in the doubly-linked list is as fast as the maximum value of the uint16 or not, setting the serial number value of the linked list element structure body to be 0x10000 greater than the serial number of the uint16 when the serial number of the data packet to be inserted is far smaller than the maximum value of the uint16, facilitating the insertion comparison inside the subsequent linked list, and automatically subtracting 0x10000 when the serial number value of the linked list element is acquired by a program outside the subsequent linked list.
The process of the invention specifically comprises the following steps: 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 structural body. And judging whether the sequence number of the RTP data packet is sequentially increased, if not, sending the RTP data packet to a doubly linked list, otherwise, sending the RTP data packet to a sending buffer queue, returning to the step of receiving the RTP data packet, and receiving the next data packet. And when the sequence number of the RTP data packet is increased in a non-sequential manner, the RTP data packet is sent to the doubly linked list, the next RTP data packet is continuously received after the RTP data packet is sent, and the sequential increasing judgment is carried out on the RTP data packet received at the moment again. When three data packets with different timestamps are stored in the doubly linked list, extracting the data packet with the smallest timestamp in the doubly linked list to the first array. Otherwise, returning to the step of receiving the RTP data packet; and when the rest data packets in the doubly linked list are continuous with the last sequence number of the data packet of the first array, traversing the continuous data packets to be 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 sequenced, 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 in fig. 1, an embodiment of the present invention further provides an RTP-based data reordering system, including:
a first module for receiving an RTP data packet;
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 numbers increase in a non-sequential manner, 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 three data packets with different timestamps exist in the doubly linked list, the data packet with the smallest timestamp in the doubly linked list to the first array, and otherwise, return to the step of receiving the RTP data packet;
and the fifth module is used for traversing the continuous data packets into a second array when the data packets left in the double 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.
Corresponding to the method of fig. 1, an embodiment of the present invention further provides an electronic device, including 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, the embodiment of the present invention also provides a computer-readable storage medium, which stores a program, and the program is executed by a processor to implement the method as described above.
The embodiment of the invention also discloses a computer program product or a computer program, which comprises computer instructions, and the computer instructions are stored in a computer readable storage medium. The computer instructions may be read by a processor of a computer device from a computer-readable storage medium, and executed by the processor to cause the computer device to perform the method illustrated in fig. 1.
In summary, the embodiments of the present invention have the following advantages:
(1) the embodiment of the invention reorders the RTP data packets by the sequence numbers and the timestamps, thereby reducing the complexity of the algorithm;
(2) the embodiment of the invention sends the data packet through the timestamp of the RTP data packet, abandons the data packet which is waited for to be out of date, and can improve the real-time performance of data transmission;
(3) the data reordering method based on the RTP can reorder the data without modifying the RTP protocol by the data sending end, thereby improving the efficiency of data transmission.
In 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 flow charts 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 larger operations are performed independently.
Furthermore, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise stated to the contrary, 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 a separate physical device or software module. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary for an understanding of the present invention. Rather, the actual implementation of the various functional modules in the apparatus disclosed herein will be understood within the ordinary skill of an engineer, given the nature, function, and internal relationship of the modules. Accordingly, those skilled in the art can, using ordinary skill, practice 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 of and not intended to limit the scope of the invention, which is defined by 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 such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement 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). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can 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 should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean 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 invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. 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 invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
While the preferred embodiments of the present invention have been illustrated and described, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A method for reordering data based on RTP, comprising:
receiving an RTP data packet;
analyzing the sequence number and the timestamp in the RTP data packet;
when the sequence numbers are increased in a non-sequential manner, the RTP data packets are sent to a two-way linked list, otherwise, the RTP data packets are sent to a sending buffer queue, and the step of receiving the RTP data packets is returned;
when three data packets with different timestamps exist in the doubly linked list, extracting the data packet with the smallest timestamp in the doubly linked list to a first array, and if not, returning to the step of receiving the RTP data packet;
and when the data packets left in the double linked list are continuous with the data packet sequence number of the first array, traversing the continuous data packets into a second 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 method of claim 1, wherein before the receiving the RTP data packet, the method further comprises:
initializing a bidirectional linked list and a sending buffer queue, wherein the bidirectional linked list is used for storing RTP data packets in sequence, and the sending buffer queue is used for sending the sequenced RTP data packets to an upper layer application;
initializing a sequence variable as a first numerical value, wherein the sequence variable is used for judging whether the sequence numbers are sequentially increased.
3. The RTP-based data reordering method according to claim 2, wherein when the sequence numbers are non-sequentially incremented, the method comprises:
when the sequential variable is equal to a first value, the sequence number is non-sequentially incremented;
and when the sequence variable is equal to the sequence number of the RTP data packet and the length of the bidirectional linked list is zero, the sequence number is sequentially increased, 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 according to claim 2, wherein when there are three packets with different timestamps in the doubly-linked list, extracting the packet with the smallest timestamp 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 as the sequence number plus one.
5. The method of claim 1, wherein traversing consecutive packets to a second number when the remaining packets in the doubly linked list are consecutive to the packet sequence number of the first number comprises:
when the sequence number of the data packet in the double linked list is equal to the sequence variable, the remaining data packets in the double linked list are continuous with the sequence number of the data packet of the first array, and the data packets which are continuous in the double linked list are traversed to be a second array; and determining the sequence variable as the last data packet sequence number plus one in the second array.
6. The method of claim 3, wherein when the sequence numbers are non-sequentially incremented, the method further comprises:
when the sequence variable is equal to the serial number of the RTP data packet and the length of the double linked list is nonzero, traversing the data packets which are continuous with the serial number of the RTP data packet in the double linked list to determine the data packets as a third data group;
and determining that the sequence variable is the sequence number of the last data packet in the third data group plus one, wherein the sequence number is sequentially increased.
7. The method of claim 1, wherein sending the RTP packets to a doubly linked list comprises:
according to the RTP data packet, traversing the bidirectional linked list from back to front to determine the position of an insertion sequence number;
and inserting the RTP data packet into the doubly linked list according to the insertion sequence number position.
8. An RTP-based data reordering system, comprising:
a first module for receiving an RTP data packet;
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 numbers increase in a non-sequential manner, 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 three data packets with different timestamps exist in the doubly linked list, the data packet with the smallest timestamp in the doubly linked list to the first array, and otherwise, return to the step of receiving the RTP data packet;
and the fifth module is used for traversing the continuous data packets into a second array when the data packets left in the double 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.
9. An electronic device comprising a processor and a memory;
the memory is used for storing programs;
the processor executing the program realizes the method according to 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 according to 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 true CN114189487A (en) 2022-03-15
CN114189487B 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协议的音频传输技术的研究与实现", 现代电子技术, no. 10 *

Also Published As

Publication number Publication date
CN114189487B (en) 2024-05-14

Similar Documents

Publication Publication Date Title
CN1513252A (en) Real-time packetization and retransmission in streaming applications
EP2482558A1 (en) Method, apparatus and system for evaluation of video quality
EP2086174A1 (en) A method and system of multimedia service performance monitoring
CN114584560B (en) Method and device for reorganizing fragmented frames
CN113259256B (en) Repeating data packet filtering method and system and readable storage medium
CN104202656B (en) Network audio MP3 flows out of order segmentation decoding method
CN110087142B (en) Video slicing method, device, terminal and storage medium
CN113300916B (en) Data center network congestion detection system and method based on stream watermarking
CN109728879B (en) Synchronous error correction method for serial burst access application layer SLIP protocol message
CN114189487A (en) Data reordering method, system, equipment and medium based on RTP
US20020003840A1 (en) Header-estimating moving picture receiving apparatus and output apparatus
US11057312B2 (en) Apparatus and method for configuring MMT payload header
US11212232B2 (en) Transmission and reception of a data stream
CN111385060B (en) Data transmission method, device, equipment and storage medium
CN115379233B (en) Big data video information analysis method and system
US9559857B2 (en) Preprocessing unit for network data
CN101296166B (en) Method for measuring multimedia data based on index
CN114422807B (en) Transmission optimization method based on Spice protocol
CN110868373A (en) Multimedia data transmission method, device and computer readable storage medium
CN114422624A (en) Data receiving method
CN114302140A (en) Pre-frame loss method, system, equipment and computer readable storage medium
CN114430488A (en) Method and device for video coding and video decoding
US8015588B2 (en) Method of managing auxiliary programs and a corresponding receiver and system
CN116962512B (en) Message processing method, device, storage medium and apparatus
CN111083067A (en) Data stream splicing method and device, storage medium and terminal equipment

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
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.

GR01 Patent grant
GR01 Patent grant