WO2015003557A1 - 一种实现数据包重组的方法和装置 - Google Patents
一种实现数据包重组的方法和装置 Download PDFInfo
- Publication number
- WO2015003557A1 WO2015003557A1 PCT/CN2014/081036 CN2014081036W WO2015003557A1 WO 2015003557 A1 WO2015003557 A1 WO 2015003557A1 CN 2014081036 W CN2014081036 W CN 2014081036W WO 2015003557 A1 WO2015003557 A1 WO 2015003557A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- media
- media frame
- sequence number
- data packet
- list
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 68
- 239000000872 buffer Substances 0.000 claims description 128
- 238000012545 processing Methods 0.000 claims description 9
- 238000004806 packaging method and process Methods 0.000 claims description 3
- 238000012217 deletion Methods 0.000 claims 2
- 230000037430 deletion Effects 0.000 claims 2
- 230000001174 ascending effect Effects 0.000 claims 1
- 238000004891 communication Methods 0.000 description 23
- 238000005516 engineering process Methods 0.000 description 17
- 238000010586 diagram Methods 0.000 description 12
- 230000005540 biological transmission Effects 0.000 description 11
- 230000008521 reorganization Effects 0.000 description 6
- 238000006243 chemical reaction Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000003139 buffering effect Effects 0.000 description 3
- 230000006798 recombination Effects 0.000 description 3
- 238000005215 recombination Methods 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 238000012856 packing Methods 0.000 description 2
- 238000012937 correction Methods 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/64—Hybrid switching systems
- H04L12/6418—Hybrid transport
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/65—Network streaming protocols, e.g. real-time transport protocol [RTP] or real-time control protocol [RTCP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/70—Media network packetisation
Definitions
- the present invention relates to the field of communications technologies, and in particular, to a method and apparatus for implementing packet reassembly. Background technique
- VoIP Voice over Internet Protocol
- media streams such as audio and video are usually transmitted over IP networks such as the Internet using Real-Time Transport Protocol (RTP) packets.
- RTP Real-Time Transport Protocol
- FEC forward error correction
- the current redundancy technology is an application scenario in which both the primary and the called terminals support redundant processing, that is, the usage scenario (C2C) of the VOIP client to the VOIP client in the VoIP service.
- the usage scenario (C2C) of the VOIP client to the VOIP client in the VoIP service For the VOIP client (Client) and the terminal's native phone (Phone), that is, the non-VOIP client, the interworking scenario (C2P or P2C for short), because the Phone terminal is usually an existing device, including the fixed telephone of the traditional circuit domain. Mobile phones, SIP hard terminals in the data domain, etc., usually do not support redundancy technology, and are difficult to upgrade, so the existing redundancy technology cannot be fully utilized to improve voice quality. Summary of the invention
- Embodiments of the present invention provide a method and apparatus for data packet reassembly to solve the problem that voice quality cannot be improved when a non-VOIP terminal does not support redundancy technology.
- a method for packet reassembly includes:
- the network device establishes a media channel for transmitting RTP data packets between the VOIP terminal and the non-VOIP terminal;
- the untransmitted media frames are respectively packaged into RTP data packets, and the packed RTP data packets are sent to the non-VOIP terminal, and the sequence number of the transmitted media frames is recorded.
- the sending the packaged RTP data packet to the non-VOIP terminal specifically includes: using the packaged RTP data packet according to the RTP data packet
- the sequence numbers of the media frames in the medium are sent to the non-VOIP terminal in descending order.
- the method further includes: creating a list corresponding to the media channel, where the media channel is recorded The serial number of the media frame that has been sent;
- the recording the sequence number of the transmitted media frame specifically includes: recording, in the list, the sequence number of the sent media frame.
- the method further includes: determining, according to the length of the list and the sequence number of the latest media frame recorded in the list, The serial number of the media frame, the sequence number of the expired media frame in the list is deleted.
- a method for packet reassembly includes:
- the network device establishes a media channel for transmitting RTP data packets between the VOIP terminal and the non-VOIP terminal;
- the preset number of media frames before the sequence number of the media frame is read from the buffer area includes:
- the determined sequence number of media frames is determined to read the corresponding media frame from the buffer.
- the method further includes: ignoring the read failure in the process of reading the corresponding media frame from the buffer area Media frame.
- the method further includes:
- the determining the sequence number of the predetermined number of media frames from the buffer area to read the corresponding media frame specifically includes:
- the method further includes: Determining, according to the length of the list and the sequence number of the latest media frame recorded in the list, the sequence number of the expired media frame, deleting the sequence number of the expired media frame in the list, and correspondingly deleting the buffered area Expired media frames.
- an apparatus for implementing packet reassembly includes:
- a creating unit configured to establish a media channel for transmitting an RTP data packet between the VOIP terminal and the non-VOIP terminal;
- a receiving unit configured to receive a redundantly processed RTP data packet that is sent by the VOIP terminal to the non-VOIP terminal by using the media channel;
- a parsing unit configured to acquire a media frame in the RTP data packet received by the receiving unit, and a sequence number of the media frame, and provide the data frame to the recombining unit;
- the recombining unit is configured to distinguish, according to the sequence number of the media frame that has been sent in the media channel recorded in the history, the transmitted media frame and the untransmitted media frame from the obtained media frame;
- the transmitted media frames are respectively packaged into RTP data packets, sent to the non-VOIP terminal by the sending unit, and the serial number of the transmitted media frame is recorded;
- the sending unit is configured to send the packaged RTP data packet to the non-VOIP terminal.
- the sending unit is specifically configured to send, by using the sequence number of the media frame in the RTP data packet, a low-to-high sequence to the RTP data packet in the RTP data packet.
- a non-VOIP terminal is specifically configured to send, by using the sequence number of the media frame in the RTP data packet, a low-to-high sequence to the RTP data packet in the RTP data packet.
- the creating unit is further configured to create a list corresponding to the media channel for recording the media The sequence number of the media frame that has been sent in the channel;
- the recombining unit when recording the sequence number of the transmitted media frame, places the sequence number of the transmitted media frame in the list.
- the apparatus further includes:
- a deleting unit configured to determine, according to the length of the list and the sequence number of the latest media frame recorded in the list, the sequence number of the expired media frame, and the sequence number of the expired media frame in the list Delete.
- an apparatus for implementing packet reassembly includes:
- a creating unit configured to establish a media channel for transmitting an RTP data packet between the VOIP terminal and the non-VOIP terminal;
- a parsing unit configured to acquire a media frame in the RTP data packet received by the receiving unit, and a sequence number of the media frame, and provide the data frame to the recombining unit;
- the recombining unit is configured to: before the serial number of the media frame is read from the buffer area according to the sequence number of the media frame acquired from the parsing unit, a preset number of media frames corresponding to the media channel, and saved The media frame received from the history; the media frame obtained from the parsing unit and the media frame read from the buffer area are packaged into an RTP data packet, sent to the non-VOIP terminal by the sending unit, and cached The media frame that is obtained from the parsing unit is cached in the area, and the sending unit is configured to send the RTP data packet that is packaged by the recombining unit to the VOIP client.
- the recombining unit includes: a determining subunit, configured to: according to a sequence number of the media frame acquired by the parsing unit, and a preset read subunit, configured to Determining, by the subunit, a predetermined number of media frame numbers to read corresponding media frames from the buffer area;
- a packing subunit configured to package the media frame acquired from the parsing unit and the media frame read from the buffer area into an RTP data packet
- a buffer subunit configured to cache a media frame obtained from the parsing unit in a buffer area.
- the read subunit is further configured to ignore reading in a process of reading a corresponding media frame from the buffer area. Take the failed media frame.
- the creating unit is further configured to create a list corresponding to the buffer area for recording the cache a sequence number of the media frame buffered in the area, where the location of the media frame buffered in the buffer area corresponds to the position of the sequence number of the media frame recorded in the list;
- the reading subunit is specifically configured to search, in the list, a sequence number of a predetermined number of media frames determined by the determining subunit, determine a location of the found sequence number, and read from a corresponding location of the buffer area.
- the apparatus further includes:
- a deleting unit configured to determine, according to the length of the list and the sequence number of the latest media frame recorded in the list, the sequence number of the expired media frame, and delete the sequence number of the expired media frame in the list, and delete the corresponding An expired media frame in the buffer.
- the VOIP terminal side that is prone to network packet loss uses the redundancy technology to transmit the media frame, which reduces the impact of packet loss on the media frame transmission in the Internet, and the redundant data packet and non-redundancy by the network device.
- the remaining data packets are converted and transmitted in non-redundant data packets in a highly reliable telecommunication network, so that non-VOIP terminals can be correctly decoded or encoded. Thereby improving the quality of the call between the VOIP terminal and the non-VOIP terminal.
- 1 is a network structure diagram of a call between a VOIP terminal and a non-VOIP terminal;
- FIG. 2 is a flowchart of a method for reassembling a data packet according to an embodiment of the present invention
- FIG. 3 is a flowchart of a data packet recombining method according to another embodiment of the present invention.
- FIG. 4 is a schematic diagram of an embodiment of the present invention for converting redundant data packets into non-redundant data packets
- FIG. 5 is a flowchart of a method for reassembling a data packet according to another embodiment of the present invention
- 6 is a flowchart of a method for reassembling a data packet according to another embodiment of the present invention
- FIG. 7 is a schematic diagram of converting a non-redundant data packet into a redundant data packet according to an embodiment of the present invention
- FIG. 8 is a schematic structural diagram of a data packet recombining apparatus according to another embodiment of the present invention
- FIG. 9 is a schematic structural diagram of a data packet recombining apparatus according to another embodiment of the present invention
- FIG. 11 is a schematic structural diagram of a packet reassembly apparatus according to another embodiment of the present invention
- FIG. 12 is a schematic diagram of a hardware structure of a packet reassembly apparatus according to an embodiment of the present invention.
- the terminal that makes a call through the VOIP client is referred to as a VOIP terminal.
- a terminal that does not make a call through a VOIP client is called a non-VOIP terminal.
- the VOIP terminal may be a terminal such as a computer, a tablet computer or a mobile phone.
- Non-VOIP terminals can be terminals such as landline phones, mobile phones, or SIP hard terminals. The main difference between a VOIP terminal and a non-VOIP terminal is whether or not a call is made through a VOIP client.
- the mobile phone when a mobile phone uses a VOIP client to make a call, the mobile phone is a VOIP terminal; when the mobile phone does not use the VOIP client, but uses the mobile phone's native telephone system to make a call, the mobile phone is a non-VOIP client.
- the network in which the VOIP terminal makes a call with the non-VOIP terminal includes an Internet (Internet) and a public land mobile network (PLMN) or a public interactive telephone network provided by the operator ( Publ ic swi tched te lephone network , PSTN ).
- the VOIP terminal is connected to the interne t network and sent over the internet. Send or receive data.
- the non-VOIP terminal accesses the telecommunication network PLMN/PSTN, and transmits or receives data through the PLMN/PSTN network.
- the network where the VOIP terminal makes a call with the non-VOIP terminal further includes a network device for implementing interworking between the Internet and the telecommunication network, such as a VOIP softswitch device and/or a landing gateway.
- a network device for implementing interworking between the Internet and the telecommunication network such as a VOIP softswitch device and/or a landing gateway.
- the solution of the embodiment of the present invention may be implemented on a VO IP softswitch device or on a landing gateway.
- the network device in a call process between a VOIP terminal and a non-VOIP terminal, if it is an audio call, the network device establishes two audio media channels in different directions for the VOIP terminal and the non-VOIP terminal, one from the VOIP terminal to the non-VOIP terminal, and the other. From non-VOIP terminals to VOIP terminals.
- two different video media channels can be created for transmitting video.
- the VOIP terminal transmits the local audio or video media to the network device (VOIP softswitch device and/or landing gateway) through the internet network, and then the network device transmits the data to the non-VOIP terminal through the telecommunication network.
- the embodiment of the present invention provides a network device (for example, a VOIP softswitch device or a landing gateway).
- a network device for example, a VOIP softswitch device or a landing gateway.
- the network equipment converts the transmitted data packets between redundant and non-redundant, realizes the data transmitted by the redundant technology in the Internet, and improves the anti-drop capability of the Internet, and The data transmitted in the telecommunication network does not use redundancy technology, so that non-VOIP terminals can correctly decode or encode.
- the redundancy in the embodiment of the present invention refers to carrying the media frame that has been sent in the data packet that sends the current media frame, where the transmitted media frame that needs to be carried is determined by the redundancy multiple.
- the data packet in the embodiment of the present invention is an RTP data packet.
- the method for reorganizing data from a VOIP terminal to a non-VOIP terminal includes:
- the network device establishes a media channel for transmitting the RTP data packet between the VOIP terminal and the non-VOIP terminal.
- the VOIP terminal is a terminal that performs the call through the VOIP client.
- the network device In the process of establishing a call between a VOIP terminal and a non-VOIP terminal, the network device establishes a separate A media channel from a VOIP terminal to a non-VOIP terminal and a media channel from a non-VOIP terminal to a VOIP terminal.
- the media channel in the direction of establishing the VOIP terminal to the non-VOIP terminal is taken as an example for description.
- the network device receives the redundantly processed RTP data packet sent by the VOIP terminal to the non-VOIP terminal through the media channel.
- the VOIP terminal collects the media frames of the local end, and packs the collected media frames into RTP data packets according to a preset redundancy multiple.
- the redundancy processing of the media frame can be implemented by using the existing redundancy technology, and details are not described herein again.
- the network device acquires a media frame in the RTP data packet and a sequence number of the media frame. After receiving the RTP data packet sent by the VOIP terminal, the network device parses the received RTP data packet to obtain the media frame and the sequence number of the media frame in the RTP data packet.
- the network device distinguishes the transmitted media frame from the untransmitted media frame from the obtained media frame according to the sequence number of the media frame that has been sent in the media channel recorded in the history.
- the network device records the sequence number of the media frame sent in the media channel. After the network device parses the sequence number of the media frame and the media frame, the sequence number of the parsed media frame is matched with the sequence number of the media frame that has been sent in the media channel of the history record, and if the same sequence number is matched, it indicates The media frame has been sent; if the same sequence number is not matched, it indicates that the media frame has not been sent.
- the network device separately packages the untransmitted media frames into RTP data packets, and sends the packetized RTP data packets to the non-VOIP terminal, and records the sequence number of the sent media frame.
- non-VOIP terminals do not support RTP packets carrying redundant media frames, non-VOIP terminals cannot parse RTP packets carrying multiple media frames. Therefore, each packet is individually packaged when it is packaged for RTP packets sent to non-VOIP terminals.
- the network device can also create a list corresponding to the media channel for recording the sequence number of the transmitted media frame.
- the list in the embodiment of the present invention does not specifically refer to a table structure, and may also include a linear table of data structures such as a queue or a stack, which may be implemented by an array or a linked list.
- the sequence number of the media frame sent is recorded to distinguish the redundant media frame in the RTP data packet when the RTP data packet is received next time.
- the VO IP terminal side that is prone to network packet loss uses the redundancy technology to transmit the media frame, that is, the method uses the redundant media frame in the data packet to transmit, which reduces the transmission in the Internet.
- Packet loss and the network device converts the redundantly processed data packet into a non-redundant data packet, so that the non-VOIP terminal can correctly decode.
- the voice quality is improved in the case where the non-VOIP terminal does not support the redundancy technique.
- the network device converts the redundantly processed data packet into a non-redundant data packet, it is not necessary to cache all the media frames and then convert, but by recording the sequence number of the transmitted media frame, for each data.
- the package performs real-time judgment and conversion, realizing the immediate turn. Therefore, the delay provided by the solution provided by the embodiment of the present invention during conversion is also very small.
- the sending the packaged RTP data packet to the non-VOIP terminal in step S208 may specifically include: The sequence numbers of the media frames in the RTP data packet are sent to the non-VO IP terminal in descending order. The serial number is deleted. Thereby saving storage resources of the network device. Specifically, the network device may determine the sequence number of the expired media frame according to the length of the list and the sequence number of the latest media frame recorded in the list, and then delete the sequence number of the expired media frame in the list. Among them, it is implemented according to the length and column of the list. For example, suppose the algorithm is M-N+1, where N is used to record the transmitted media.
- the sequence number of the expired media frame can be determined in real time by the method in this embodiment.
- FIG. 3 is a data reorganization method from a VOIP terminal to a non-VOIP terminal, and the method includes:
- the VOIP terminal initiates a call to the non-VOIP terminal.
- the network device establishes a media channel for transmitting the RTP data packet between the VOIP terminal and the non-VOIP terminal.
- a media channel in the direction of establishing the VOIP terminal to the non-VOIP terminal will be described as an example.
- the network device creates a list of corresponding media channels for recording sequence numbers of the media frames that have been sent in the media channel.
- the list created by the network device is recorded as list 1, and the length of the list is recorded as N (N is a positive integer).
- the length of the list can be flexibly set, and the range is usually 10_200.
- the list in the embodiment of the present invention does not specifically refer to a table structure, but may also include a linear table of data structures such as a stack and a queue.
- the network device receives the redundantly processed RTP data packet sent by the VOIP terminal to the non-VOIP terminal through the media channel.
- the VOIP terminal when the VOIP terminal performs redundancy processing, in addition to carrying the media frame to be currently transmitted in the RTP data packet, the VOIP terminal also carries the k media frames before the current media frame. If there are less than k media frames before the current media frame, all media frames before the current frame are carried in the RTP data packet.
- the RTP packet When an A 2 frame is sent, the RTP packet carries A. , , A 2 , where A. , Ai is a redundant media frame.
- a 3 frame is transmitted, the RTP data packet carries Ai, A 2, A 3, wherein, Ai, A 2 redundant media frames, and so on, each frame 2-fold redundancy.
- the network device parses the data packet, and obtains a media frame in the data packet and a sequence number of the media frame.
- the network device matches the obtained media frame sequence number with the transmitted media frame sequence number recorded in the list, and if the same sequence number is matched in the list, executing S312; if the same sequence number is not matched in the list, Then execute S314.
- the network device discards the media frame that matches the same sequence number.
- the media frame is a redundant media frame, so the media frame is discarded.
- S314 The network device packages the unrecognized media frames of the same sequence into independent RTP data packets, and sends the packaged RTP data packets to the non-VOIP terminal, and records the sequence number of the sent media frame in the list.
- the network device deletes the sequence number of the expired media frame in the list.
- the network device serial number in the list may be further deleted.
- M-N+1 is only an example, and those skilled in the art can also think of other calculation methods according to the example, for example, M-N+2 can also be used.
- Figure 4 shows redundant data.
- the VOIP terminal sends three data packets: ⁇ , B, and C, where packet A carries three media frames with sequence numbers 5, 6, and 7, and packet B carries three media frames with sequence numbers 6, 7, and 8.
- Packet C carries three media frames with sequence numbers 7, 8, and 9.
- Packet B is lost due to network packet loss.
- the network device VOIP softswitch device or landing gateway
- the network device when the network device (the VO IP softswitch device or the landing gateway) receives the data packet C, it parses three media frames with the sequence numbers 7, 8, and 9, respectively. Since the sequence number frame 7 is also carried in the data packet A, the network device can match the sequence number of the frame from the list, thereby determining that the frame is a transmitted media frame. The network device discards frame 7. For the media frame numbered 8, the packet B is lost. Therefore, when the packet C arrives at the network device, the network device receives the frame 8 for the first time, and the network device cannot match the sequence number of the frame in the list. Therefore, the network device separately packages the frame to the non-VO IP terminal. For the media frame with sequence number 9, the network device is also received for the first time. Therefore, the network device also separately packages the frame 9 and sends it to the non-VO IP terminal.
- the solution provided by the embodiment of the present invention can successfully resist the packet loss problem of the Internet.
- FIG. 5 is a flowchart of a method for reassembling a data packet according to an embodiment of the present invention, including:
- the network device establishes a media channel for transmitting RTP data packets between the VOIP terminal and the non-VO IP terminal.
- the network device During the call setup process of the VOIP terminal and the non-VO IP terminal, the network device establishes a media channel from the VOIP terminal to the non-VO IP terminal direction and a media channel from the non-VO IP terminal to the VOIP terminal direction, respectively.
- This embodiment describes a data re-grouping method from a non-VOIP terminal to a VO IP terminal. Therefore, the present embodiment will be described by taking a media channel from a non-VOIP terminal to a VOIP terminal as an example.
- the network device can also create a buffer corresponding to the media channel when establishing the media channel. Used to cache received media frames.
- the network device receives the non-redundant RTP data packet sent by the non-VOIP terminal to the VOIP terminal through the media channel.
- the non-VOIP terminal collects the media frames of the local end, and packages the collected media frames into independent RTP data packets. Since the non-VOIP terminal does not support the redundancy processing of the media frame, each RTP data packet carries one media frame when it is packaged.
- the network device acquires a media frame in the RTP data packet and a sequence number of the media frame, and reads a preset number of media frames from the buffer area according to the sequence number of the media frame.
- the buffer area corresponds to the media channel, and the historically received media frame is saved.
- the preset number of media frames before the sequence number of the media frame is read from the buffer area may specifically include:
- the network device determines a sequence number of the preset number of media frames before the sequence number of the media frame according to the sequence number of the media frame in the RTP data packet and a preset redundancy multiple; determining the sequence number of the media frame from the buffer area Media frame.
- the network device may ignore the read failed media frame in the process of reading the corresponding media frame from the buffer area.
- the network device Since the time when the data packet arrives at the network device is sequential, there may be a case where the network device arrives at the network device after the media frame with the previous sequence number. Therefore, the network device cannot find the media frame in the buffer area, causing the read failure. In this case, the network device can continue to perform subsequent operations, ignoring the failed failed media frames.
- S506 The network device packs the media frame obtained from the RTP data packet and the media frame read from the buffer into an RTP data packet, and sends the packaged RTP data packet to the VOIP terminal.
- the network device caches the media frame obtained from the RTP data packet in the buffer area.
- the network device converts the non-redundant data packet sent by the non-VOIP terminal It is replaced by a redundantly processed packet and then sent to the VOIP terminal over the Internet, so that when the non-VOIP terminal does not support the redundancy technology, redundancy techniques can still be used to improve the voice quality.
- the network device may also create a list of serial numbers for recording media frames buffered in the buffer.
- the location of the media frame buffered in the buffer corresponds to the location of the sequence number of the media frame recorded in the list.
- the determining, by the network device, the sequence number of the predetermined number of media frames, the corresponding media frame being read from the buffer area may include: searching a predetermined number of media frames in the list, and determining a location of the found sequence number, And reading the media frame corresponding to the serial number from the corresponding location of the buffer area. If there is an unknown serial number in the search process, the serial number is ignored. Since the search speed in the list is faster than the search in the buffer area, the efficiency of reading the media frames to be redundantly processed can be improved.
- the position of the found serial number refers to the offset position of the serial number relative to the beginning of the list.
- the location of the media frame buffered in the buffer area corresponds to the position of the sequence number of the media frame recorded in the list, and the offset position of the media frame in the buffer area relative to the start position of the buffer area is the same as the sequence number of the media frame.
- the offset positions in the list are the same.
- the media frame in the number and the buffer area is deleted, thereby saving the storage resources of the network device.
- the network device may determine the sequence number of the expired media frame according to the length of the list and the sequence number of the latest media frame recorded in the list, and then delete the sequence number of the expired media frame in the list and delete the corresponding media frame in the buffer area.
- determining the sequence number of the expired media frame according to the length of the list and the sequence number of the latest media frame recorded in the list may be implemented by an algorithm. For example, suppose the algorithm is
- N is the length of the list for recording the sequence number of the media frame buffered in the buffer area
- M is the sequence number of the latest media frame recorded in the list
- the network device has the sequence number less than or equal to M-
- the N+1 media frame is determined to be an expired media frame.
- the network device After determining the sequence number of the expired media frame, the network device searches for the sequence number of the expired media frame from the list, and finds the corresponding corresponding in the buffer area according to the found sequence number.
- Media frame delete the serial number in the list and the corresponding media frame in the buffer.
- the sequence number of the expired media frame can be determined in real time by the method in this embodiment.
- FIG. 6 is a data reorganization method from a non-VOIP terminal to a VOIP terminal, and the method includes:
- the non-VOIP terminal initiates a call to the VOIP terminal.
- the network device establishes a media channel for transmitting the RTP data packet between the non-VOIP terminal and the VOIP terminal.
- the media channel in the direction of establishing the non-VOIP terminal to the VOIP terminal will be described as an example.
- the network device creates a buffer corresponding to the media channel for buffering the received media frame, and creates a list for recording the sequence number of the media frame buffered in the buffer.
- the location of the media frame buffered in the buffer area corresponds to the location of the sequence number of the media frame recorded in the list. That is, the offset position of the media frame in the buffer area relative to the start position of the buffer area is the same as the offset position of the sequence number of the media frame in the list.
- the list created by the network device in this embodiment is recorded as list 2, and the length of the list is recorded as N (N is a positive integer).
- the length of the list can be flexibly set, and the range is usually 10_200.
- the list in the embodiment of the present invention does not specifically refer to a table structure, but may also include a linear table of data structures such as a stack and a queue.
- the network device receives the non-redundant RTP data packet sent by the non-VOIP terminal to the VOIP terminal through the media channel.
- the non-VOIP terminal collects the media frames of the local end, and packages the collected media frames into RTP data packets. Since the non-VOIP terminal does not support the redundancy processing of the media frame, each RTP data packet carries one media frame when it is packaged.
- S610 Determine, according to the sequence number of the media frame parsed from the RTP data packet and a preset redundancy multiple, a sequence number of the preset number of media frames before the sequence number of the media frame.
- the preset number of media frames before the parsed media frame number is k (k is a redundancy multiple) media frames before the parsed media frame.
- the sequence number of the preset number of media frames before determining the sequence number of the parsed media frame according to the sequence number of the parsed media frame and the pre-set redundancy factor in step S610 specifically includes: subtracting the serial numbers of the parsed media frames respectively
- the sequence numbers obtained from 1 to k are the sequence numbers of the media frames to be redundantly processed.
- the sequence number of the parsed media frame is ⁇ ⁇
- the numbers of k media frames before ⁇ ⁇ are ⁇ ⁇ -1, ⁇ ⁇ -2, ..., A n -k 0
- the media frame whose sequence number is ⁇ ⁇ _1, ⁇ ⁇ -2, ..., A n _k is a preset number of media frames before the serial number of the parsed media frame.
- step S612 searching for the determined sequence number of the media frame in the list. If there is no search sequence number in the list, step S614 is performed; when there is a search sequence number in the list, step S616 is performed.
- sequence number of the search does not exist in the list, if the sequence number is not the sequence number of the last media frame that needs to be redundantly processed, the network device ignores the sequence number and continues to search for other media frames that need to be redundantly processed in the list. No.; If the sequence number is the sequence number of the last media frame that needs to be redundantly processed, the result is searched.
- S616 Determine a location of the found sequence number, and read a media frame corresponding to the sequence number from a corresponding location of the buffer area.
- the network device first determines an offset position of the sequence number in the list, and then acquires a corresponding media frame at a corresponding offset position of the buffer area.
- the media frame obtained from the RTP data packet and the media frame read from the buffer area are packetized into one RTP data packet, and the packaged RTP data packet is sent to the VOIP terminal.
- S620 Cache the media frame obtained from the RTP data packet in the buffer area, and record in the list Record the serial number of the media frame.
- the location of the media frame buffered in the buffer area corresponds to the location of the sequence number of the media frame recorded in the list. Expired media frame.
- the network device may further delete the expired media frame and the sequence number of the media frame.
- the network device may determine the expired media frame in the list according to the length of the list and the sequence number of the latest media frame recorded in the list. Specifically, if the sequence number of the latest media frame recorded in the list is M, the media frame whose sequence number is not greater than M-N+1 may be regarded as an expired media frame. By calculating the expired media frame in this manner, the sequence number of one media frame can be judged once, so that the sequence number of the early record of the list and the media frame corresponding to the sequence number in the buffer area can be deleted in real time.
- M-N+1 is only an example, and those skilled in the art can also think of other calculation methods according to the example, for example, M-N+2 can also be used.
- the sequence number of the media frame that needs to be redundantly processed is calculated according to the sequence number of the media frame in the data packet C and the redundancy multiple to be used, that is, the data packet C is used.
- the positions of 7 and 8 in the list are the 3rd and 4th positions respectively (ie, the offsets from the starting position of the list are 3 and 4 respectively), and then the 3rd and 4th positions in the buffer are read.
- the corresponding media frame is output.
- the read media frames with sequence numbers 7 and 8 and the received media frame with sequence number 9 are packaged into one RTP data packet, where the media frame 7 and the media frame 8 in the RTP data packet are redundant frames.
- the packaged RTP data packet is then sent to the VOIP terminal.
- the solution provided by the embodiment of the present invention can successfully resist the packet loss problem of the Internet.
- the network device in the foregoing method embodiment may be a VO IP soft switching device or a landing gateway in the network architecture shown in FIG.
- a network device is a device that implements a packet reassembly function.
- FIG. 8 is a schematic structural diagram of an apparatus 800 for implementing data packet reassembly according to an embodiment of the present invention.
- a data packet is reorganized to reassemble a redundant data packet into a non-redundant data packet, and the apparatus 800 is used.
- the creating unit 801 is configured to establish a media channel for transmitting RTP data packets between the VOIP terminal and the non-VOIP terminal.
- the V0 IP terminal is a terminal that performs the call through the V0IP client.
- the receiving unit 802 is configured to receive the redundantly processed RTP data packet sent by the V0 IP terminal to the non-VOIP terminal through the media channel created by the creating unit 801.
- the parsing unit 803 is configured to obtain the media frame in the RTP data packet received by the receiving unit 802 and the sequence number of the media frame, and provide the sequence to the recombining unit 804.
- the reorganizing unit 804 is configured to distinguish, according to the sequence number of the media frames that have been sent in the media channel of the history, the transmitted media frame and the untransmitted media frame from the obtained media frame;
- the media frames are respectively packaged into independent RTP data packets, and the packaged RTP data packets are sent to the non-V0IP terminal through the sending unit 805, and the serial number of the transmitted media frame is recorded.
- the sending unit 805 is configured to send the RTP data packet packed by the recombining unit 804 to the non-V0 IP terminal.
- the creating unit 801 can separately establish a media channel from the VOIP terminal to the non-VOIP terminal direction and a media channel from the non-VO IP terminal to the VOIP terminal direction when creating the media channel.
- the embodiment shown in FIG. 8 is for explaining the case where the VOIP terminal sends a data packet to the non-VO IP terminal. Therefore, the media channel in the direction of establishing the VOIP terminal to the non-VO IP terminal is taken as an example for description.
- the receiving unit 802 After receiving the RTP data packet, the receiving unit 802 sends the RTP data packet to the parsing unit 803 for parsing.
- the parsing unit 803 parses out the media frame carried in the RTP data packet and the sequence number of the media frame, and then provides the reassembly unit 804 for packet reassembly.
- the reassembly unit 804 performs packet reassembly to reassemble the RTP data packet from the redundant data packet to the non-redundant data packet. Specifically, after receiving the sequence of the media frame and the media frame parsed by the parsing unit 803, the recombining unit 804 matches the sequence number of the parsed media frame with the sequence number of the media frame that has been sent in the media channel of the history record. If the same sequence number is matched, it indicates that the media frame has been sent; if the same sequence number is not matched, it indicates that the media frame has not been sent.
- the reassembly unit 804 discards the transmitted media frames, packages the untransmitted media frames into independent RTP data packets, and sends the packaged RTP data packets to the non-VIP terminal through the sending unit 805, and records the transmission.
- the serial number of the media frame is not limited to “0,001,001,001,001,001,001,001,001,001,001,001,001,001,001,001,001,001,001, and sends the packaged RTP data packets to the non-VIP terminal through the sending unit 805, and records the transmission.
- the serial number of the media frame is the serial number of the media frame.
- the creating unit 801 when creating the media channel, may also create a list corresponding to the media channel for recording the sequence number of the transmitted media frame.
- the reassembly unit 804 can obtain the sequence number of the media frames that have been transmitted in the media channel recorded in history from the list.
- the reassembly unit 804 records the sequence number of the transmitted media frame in the list to distinguish the redundant media frames in the RTP data packet the next time the RTP data packet is received.
- the list in the embodiment of the present invention does not specifically refer to a table structure, and may also include a linear table of data structures such as a queue or a stack, which may be implemented by an array or a linked list.
- the transmitting unit 805 may send the packetized RTP data packet to the non-VIP terminal in descending order according to the sequence number of the media frame in the RTP data packet when transmitting the RTP data packet.
- the apparatus 800 may further include: a deleting unit 806, configured to determine an expired according to the length of the list and the sequence number of the latest media frame recorded in the list. The sequence number of the media frame, which deletes the sequence number of the expired media frame in the list.
- the deleting unit 806 can determine the sequence number of the expired media frame in real time by an algorithm.
- the algorithm is assumed to be M-N+1, where N is a list length for recording the sequence number of the transmitted media frame, and M is the sequence number of the latest media frame recorded in the list, and the deleting unit 806 sets the sequence number to be smaller than A media frame equal to or equal to M-N+1 is determined to be an expired media frame.
- the list of serial numbers used to store the transmitted media frames may be located inside the device 800 or external to the device 800.
- the device 800 may further include: a storage unit 807 for storing the list created by the creating unit 801.
- the VO IP terminal side that is prone to network packet loss uses the redundancy technology to transmit the media frame, that is, the method uses the redundant media frame in the data packet to transmit, which reduces the transmission in the Internet.
- Packet loss and the network device converts the redundantly processed data packet into a non-redundant data packet, so that the non-VO IP terminal can correctly decode.
- the voice quality is improved in the case where the non-VO I P terminal does not support the redundancy technique.
- the network device converts the redundantly processed data packet into a non-redundant data packet, it is not necessary to cache all the media frames and then convert, but by recording the sequence number of the transmitted media frame, for each data.
- the package performs real-time judgment and conversion, realizing the immediate turn. Therefore, the delay provided by the solution provided by the embodiment of the present invention during conversion is also very small.
- FIG. 10 is a packet reassembly according to an embodiment of the present invention.
- the creating unit 1001 is configured to establish a media channel for transmitting RTP data packets between the VOIP terminal and the non-VOIP terminal.
- the VOIP terminal is a terminal that performs a call through a VOIP client.
- the receiving unit 1002 receives the non-redundant RTP data packet sent by the non-VOIP terminal to the V0IP terminal through the media channel created by the creating unit 1001.
- the parsing unit 1003 is configured to obtain a media frame in the RTP data packet received by the receiving unit 1002 and a sequence number of the media frame, and provide the sequence to the recombining unit 1004.
- the recombination unit 1004 is configured to: before the serial number of the media frame is read from the buffer area, a preset number of media frames, according to the sequence number of the media frame parsed by the parsing unit 1003, where the buffer area corresponds to the media channel, and And storing the media frame received from the parsing unit 1003 and the media frame read from the buffer area into one RTP data packet, and sending the data frame to the non-VIP terminal through the sending unit 1005, and The media frame acquired from the parsing unit 1003 is buffered in the buffer area.
- the sending unit 1005 is configured to send the RTP data packet packed by the reorganization unit 1004 to the V0IP client.
- the creating unit 1001 can separately establish a media channel from the V0IP terminal to the non-V0IP terminal direction and a media channel from the non-V0IP terminal to the V0IP terminal direction when establishing the media channel.
- the embodiment shown in FIG. 10 is described as an example for facilitating the transmission of data packets by a non-VIP terminal to a V0IP terminal. Therefore, an example is to establish a media channel from a non-VIP terminal to a V0IP terminal.
- the creating unit 1001 may also create a buffer corresponding to the media channel for buffering the media frame to be redundantly processed when the media channel is established.
- the network device converts the non-redundant data packet sent by the non-VOIP terminal into the redundantly processed data packet, and then sends the data packet to the V0IP terminal through the Internet, so that the non-V0IP terminal does not support the redundancy technology. Redundancy can still be used to improve voice quality.
- the specific structure of the recombining unit 1004 will be further described below. As shown in FIG. 11, in the structural diagram 11 of the apparatus 10 for performing data packet reassembly according to another embodiment of the present invention, the reorganization unit 1004 may specifically include:
- the determining subunit 10041 is configured to determine a sequence number of the preset number of media frames before the serial number of the media frame according to the sequence number of the media frame acquired from the parsing unit 1003 and a preset redundancy multiple.
- the reading subunit 10042 is configured to determine a sequence number of the preset number of media frames determined by the subunit 10041 to read a corresponding media frame from the buffer area;
- a packing subunit 10043 configured to package the media frame acquired from the parsing unit 1003 and the media frame read from the buffer area into one RTP data packet;
- the buffer subunit 10044 is configured to buffer the media frame acquired from the parsing unit 1003 in the buffer area.
- the read subunit 10042 can ignore the read failed media frame in the process of reading the corresponding media frame from the buffer area.
- the creating unit 1001 is further configured to create a list corresponding to the buffer area for recording the media buffered in the buffer area, in order to improve the efficiency of reading the media frame that needs to be redundantly processed from the buffer area.
- the serial number of the frame The location of the media frame buffered in the buffer corresponds to the location of the sequence number of the media frame recorded in the list.
- the reading subunit 10042 is specifically configured to search the list for the determined number of preset media frames, determine the location of the found sequence number, and read the corresponding number from the corresponding location of the buffer. Media frame. Among them, the reading subunit 10042 can ignore the unfinished serial number during the searching process.
- the read subunit 10042 Since the time when the data packet arrives at the network device is sequential, there may be a case where the media frame of the serial number arrives at the device 10, and therefore, the read subunit 10042 cannot find the media frame in the buffer area, resulting in a read failure. In this case, the read subunit 10042 can continue to perform subsequent operations, ignoring the failed failed media frame.
- the position of the serial number found refers to the deviation of the serial number from the beginning of the list. Move position.
- the location of the media frame buffered in the buffer area corresponds to the position of the sequence number of the media frame recorded in the list, and the offset position of the media frame in the buffer area relative to the start position of the buffer area is the same as the sequence number of the media frame.
- the offset positions in the list are the same.
- the device 10 may also search for the sequence number of the expired media frame in the list and the expired media frame in the buffer area, and delete the expired media frame sequence number and the media frame, thereby saving the network device. Storage resources. Therefore, as shown in FIG. 11, the apparatus 10 may further include: a deleting unit 1006, configured to determine, according to the length of the list and the sequence number of the latest media frame recorded in the list, the sequence number of the expired media frame, and the expired media in the list The sequence number of the frame and the expired media frame in the buffer are deleted.
- a deleting unit 1006 configured to determine, according to the length of the list and the sequence number of the latest media frame recorded in the list, the sequence number of the expired media frame, and the expired media in the list The sequence number of the frame and the expired media frame in the buffer are deleted.
- the deleting unit 1006 can determine the sequence number of the expired media frame in real time by an algorithm. For example, assume that the algorithm is M-N+1, where N is the length of the list of the sequence numbers of the media frames buffered in the buffer, and M is the sequence number of the latest media frame recorded in the list, then the deleting unit 1006 Determines a media frame whose sequence number is less than or equal to M-N+1 as an expired media frame. After determining the sequence number of the expired media frame, the deleting unit 1006 searches for the sequence number of the expired media frame from the list, and finds the corresponding media frame in the buffer area according to the found sequence number, and deletes the serial number in the list and the corresponding media in the buffer area. frame.
- the buffer for storing media frames and the list of serial numbers for recording the transmitted media frames may be located inside the device 10 or external to the device 800.
- the device 10 may further include: a storage unit 1007.
- the creating unit 1001 creates a cache area and a list in the storage unit 1007.
- the network device in the embodiment of the present invention may be implemented based on the hardware structure of the computer system.
- the hardware structure of the network device may include a memory 1201, a communication interface 1202, a processor 1203, and a bus 1204.
- the processor 1203, the memory 1201, and the communication interface 1202 are connected through the bus 1204. Letter connection.
- the memory 1201 may be a read only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM).
- the memory 1201 can store instructions of the operating system and other applications as well as application data. The instructions stored in the memory 1201 are executed by the processor 1203.
- Communication interface 1202 is used to enable communication between network devices and other devices or communication networks such as, but not limited to, PLMN/PSTN, the Internet, and the like.
- the processor 1203 can use a general-purpose central processing unit (CPU), a processor, an application specific integrated circuit (ASIC), or one or more integrated circuits for executing related programs.
- CPU central processing unit
- ASIC application specific integrated circuit
- the processor 1203 is configured to execute an instruction in the memory 1201.
- Bus 1204 can include a path for communicating information between various components (e.g., processor 1203, memory 1201, and communication interface 1202).
- the specific implementations of the processor 1203, the memory 1201, and the communication interface 1202 in the network device shown in FIG. 12 are as follows:
- the communication interface 1202 is configured to establish, under the control of the processor 1203, a media channel for transmitting an RTP data packet between the VIP terminal and the non-VOIP terminal; and receive the redundant processing sent by the V0IP terminal to the non-VOIP terminal through the media channel. RTP packet.
- the processor 1203 is configured to establish, by the communication interface 1202, a media channel between the V0IP terminal and the non-VOIP terminal; acquire a media frame in the RTP data packet received by the communication interface 1202, and a sequence number of the media frame; according to the history record The sequence number of the media frame that has been sent in the media channel, distinguishing the transmitted media frame from the untransmitted media frame from the obtained media frame; and packaging the unsent media frames into independent RTP data packets, The packetized RTP data packet is transmitted to the non-VOIP terminal through the communication interface 1202, and the serial number of the transmitted media frame is recorded in the memory 1201.
- the communication interface 1202 is further configured to send the RTP data packet packed by the processor 1 203 to the non-VO IP terminal.
- the communication interface 1 202 After receiving the RTP data packet, the communication interface 1 202 sends the RTP data packet to the processor 1203 for parsing.
- the processor 1203 parses out the media frame carried in the RTP data packet and the sequence number of the media frame, and then performs packet reassembly.
- Processor 1 203 performs packet reassembly to reassemble RTP packets from redundant packets to non-redundant packets. Specifically, after the processor 1203 parses the serial number of the media frame and the media frame, the sequence number of the parsed media frame is matched with the sequence number of the media frame that has been sent in the media channel of the history record, if the same is matched. The serial number indicates that the media frame has been sent; if the same sequence number is not matched, it indicates that the media frame has not been sent.
- the processor 1203 discards the transmitted media frames, packages the untransmitted media frames into independent RTP data packets, and sends the packaged RTP data packets to the non-VO IP terminal through the communication interface 1202, and The sequence number of the transmitted media frame is recorded in the memory 1 201.
- the processor 1203 can create a list in the memory 1 201 corresponding to the media channel for recording the sequence number of the transmitted media frame.
- the processor 1 203 can obtain the serial number of the media frame that has been transmitted in the media channel recorded in the history from the list. Moreover, when transmitting the media frame, the processor 1 203 can record the sequence number of the transmitted media frame in the list, so as to distinguish the redundant media frame in the RTP data packet when the RTP data packet is received next time.
- the list in the embodiment of the present invention does not specifically refer to a table structure, and may also include a linear table of data structures such as a queue or a stack, which may be implemented by an array or a linked list.
- the memory 1 201 is used to store a list created by the processor 1203.
- the processor 1203 may further determine the sequence number of the expired media frame according to the length of the list and the sequence number of the latest media frame recorded in the list, and delete the sequence number of the expired media frame in the list.
- the above embodiment is an embodiment in which a network device reassembles redundant data packets into non-redundant data packets.
- the network device can also implement reassembly of non-redundant data packets into redundancy. Data packet.
- the specific implementations of the processor 1203, the memory 1201, and the communication interface 1202 in the network device shown in FIG. 12 are as follows:
- a communication interface 1202 configured to establish, by the processor 1203, a media channel for transmitting an RTP data packet between the VO IP terminal and the non-VOIP terminal; and receiving the non-VOIP terminal to send the VO IP terminal through the media channel without redundancy The remaining RTP packets.
- the processor 1203 is configured to establish, by using the communication interface 1202, a media channel between the V0IP terminal and the non-VOIP terminal; and configured to acquire a media frame in the RTP data packet received by the communication interface 1202 and a sequence number of the media frame; according to the acquired media frame
- the serial number is a preset number of media frames before the serial number of the media frame is read from the buffer area, where the buffer area corresponds to the media channel, and the historically received media frame is saved; the obtained media frame and the slave are
- the media frame read in the buffer is packaged into an RTP data packet, sent to the non-V0 IP terminal through the communication interface 1202, and the media frame in the RTP data packet is obtained from the communication interface 1202 in the buffer area.
- the communication interface 1202 is further configured to send the RTP data packet packaged by the processor 1203 to the V0 IP terminal.
- the processor 1203 determines a sequence number of the preset number of media frames before the sequence number of the media frame according to the obtained sequence number of the media frame and a preset redundancy multiple; determining the predetermined number of media frame numbers from the buffer area Reading the corresponding media frame; packaging the obtained media frame and the media frame read from the buffer into an RTP data packet; and buffering the acquired media frame in the buffer area.
- the processor 1203 may ignore the failed media frame during the process of reading the corresponding media frame from the buffer area.
- the processor 1203 is further configured to create a list corresponding to the buffer area for recording the media buffered in the buffer area.
- the location of the media frame buffered in the buffer area corresponds to the location of the sequence number of the media frame recorded in the list.
- the processor 1203 The specific implementation of determining the sequence number of the media frame from the buffer to read the corresponding media frame is as follows:
- the processor 1 203 can search the list for the determined preset number of media frames, and determine the search.
- the location of the sequence number to which the media number corresponding to the sequence number is read from the corresponding location of the buffer zone.
- the processor 1203 can ignore the unfinished sequence number during the searching process.
- processor 1 203 Since the time when the data packet arrives at the network device is sequential, there may be a case where the serial number arrives before the media frame. Therefore, the processor 1 203 cannot find the media frame in the buffer area, causing the reading to fail. In this case, processor 1 203 can continue to perform subsequent operations, ignoring read failed media frames.
- the position of the found serial number refers to the offset position of the serial number relative to the beginning of the list.
- the location of the media frame buffered in the buffer area corresponds to the position of the sequence number of the media frame recorded in the list, and the offset position of the media frame in the buffer area relative to the start position of the buffer area is the same as the sequence number of the media frame.
- the offset positions in the list are the same.
- the processor 1203 may further determine the sequence number of the expired media frame according to the length of the list and the sequence number of the latest media frame recorded in the list, and the expired media frame in the list. The serial number and the media frame that has expired in the cache are deleted.
- the list created by the processor 1 203 and the buffer area may all be located in the memory 1201.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Telephonic Communication Services (AREA)
Abstract
本发明公开了一种数据包重组的方法和装置,该方法包括:网络设备在VOIP终端和非VOIP终端间建立用于传输RTP数据包的媒体通道;在 VOIP终端向非VOIP终端发送经过冗余处理的RTP数据包时,网络设备将该RTP数据包转换为非冗余的RTP数据包发送给非VOIP终端;或者,在非VOIP终端向VOIP终端发送经过未做冗余处理的RTP数据包时,将该数据包转换为携带冗余帧的RTP数据包发送给VOIP终端。应用本发明实施例,提高了VOIP终端和非VOIP终端之间进行通话的质量。
Description
一种实现数据包重组的方法和装置 本申请要求 2013年 7月 12 日递交的申请号为 201310294052. X、 发明名 称为 "一种实现数据包重组的方法和装置" 的中国专利申请的优先权, 其全 部内容通过引用结合在本申请中。 技术领域
本发明涉及通信技术领域, 特别涉及一种实现数据包重组的方法和装 置。 背景技术
在基于 IP的语音传输( Voice over Internet Protocol , VoIP ) 网络电话的 通话过程中, 音频和视频等媒体流通常釆用实时传输协议 (Real-Time Transport Protocol, RTP )数据包经过互联网等 IP网络传输。 而在互联网传 输中, 丟包是最常见的问题之一, 导致电话的声音断断续续和视频卡顿等现 象,严重影响 VoIP电话的通信质量。 冗余传输技术是最主要的抗丟包技术, 常见的冗余技术有前向纠错( forward error correction, FEC )等。
但目前的冗余技术是针对主、 被叫双方的终端都支持冗余处理的应用 场景, 即 VoIP业务中的 VOIP客户端到 VOIP客户端的使用场景 ( C2C ) 。 而对于 VOIP客户端( Client )与终端的原生电话( Phone ) , 即非 VOIP客户 端, 的互通场景 (简称 C2P或 P2C ) , 由于 Phone端通常是现有的设备, 包 括传统电路域的固定话机、 手机、 以及数据域的 SIP硬终端等, 通常是不支 持冗余技术的, 也难以升级, 所以不能充分利用现有冗余技术来提高话音质 量。 发明内容
本发明实施例提供一种数据包重组的方法和装置以解决在非 VOIP终 端不支持冗余技术的情况下, 无法提高话音质量的问题。
第一方面, 一种数据包重组的方法, 包括:
网络设备在 VOIP终端和非 VOIP终端间建立用于传输 RTP数据包的 媒体通道;
接收所述 VOIP终端通过所述媒体通道向所述非 VOIP终端发送的经 过冗余处理的 RTP数据包;
获取所述 RTP数据包中的媒体帧以及所述媒体帧的序号; 的媒体帧中区分出已发送过的媒体帧和未发送过的媒体帧;
将未发送过的媒体帧分别打包为 RTP数据包, 并将打包后的 RTP数 据包发送给所述非 VOIP终端, 记录下所述发送的媒体帧的序号。
在第一方面的第一种可能的实现方式中, 所述将所述打包后的 RTP 数据包发送给所述非 VOIP终端具体包括:将所述打包后的 RTP数据包按 照所述 RTP数据包中的媒体帧的序号由低到高顺序发送给所述非 VOIP终 端。
结合第一方面或第一方面的第一种可能的实现方式, 在第二种可能的 实现方式中, 所述方法还包括: 创建与所述媒体通道对应的列表用于记录 所述媒体通道中已发送过的媒体帧的序号;
所述记录下所述发送的媒体帧的序号具体包括: 将所述发送的媒体帧 的序号记录在所述列表中。
结合第一方面的第二种可能的实现方式, 在第三种可能的实现方式 中, 所述方法还包括: 根据所述列表的长度和所述列表中记录的最新的媒 体帧的序号确定过期的媒体帧的序号, 将所述列表中已过期的媒体帧的序 号删除。
第二方面, 一种数据包重组的方法, 包括:
网络设备在 VOIP终端和非 VOIP终端间建立用于传输 RTP数据包的 媒体通道, ;
接收所述非 VOIP终端通过所述媒体通道向所述 VOIP终端发送的未 经冗余处理的 RTP数据包;
获取所述 RTP数据包中的媒体帧以及所述媒体帧的序号, 并从緩存 区中读取所述媒体帧的序号之前预设数量的媒体帧, 所述緩存区与所述媒 体通道对应, 并保存有历史接收到的媒体帧;
将从所述 RTP数据包中获取的媒体帧与从所述緩存区中读取的媒体 帧打包为一个 RTP数据包, 并将打包后的 RTP数据包发送给所述 VOIP 终端;
在所述緩存区中緩存从所述 RTP数据包中获取的媒体帧。
在第二方面的第一种可能的实现方式中, 所述从所述緩存区中读取所 述媒体帧的序号之前预设数量的媒体帧包括:
根据所述媒体帧的序号和预先设置的冗余倍数确定所述媒体帧的序 号之前预设数量的媒体帧的序号;
以确定出的预设数量的媒体帧的序号从所述緩存区中读取对应的媒 体帧。
结合第二方面的第一种可能的实现方式, 在第二种可能的实现方式 中, 所述方法还包括: 在从所述緩存区中读取对应的媒体帧的过程中忽略 读取失败的媒体帧。
结合第二方面的第二种可能的实现方式, 在第三种可能的实现方式 中, 所述方法还包括:
创建与所述緩存区对应的列表用于记录所述緩存区中緩存的媒体帧 的序号, 所述緩存区中緩存的媒体帧的位置与所述列表中记录的所述媒体 帧的序号的位置相对应;
所述以确定出的预定数量的媒体帧的序号从所述緩存区中读取对应 的媒体帧具体包括:
在所述列表中查找所述确定出的预定数量的媒体帧的序号, 确定查找 到的所述序号的位置, 并从緩存区的对应位置读取所述序号对应的媒体 帧。
结合第二方面的第三种可能的实现方式, 在第四种可能的实现方式 中, 所述方法还包括:
根据所述列表的长度和所述列表中记录的最新的媒体帧的序号确定 过期的媒体帧的序号, 将所述列表中已过期的媒体帧的序号删除, 并对应 删除所述緩存区中已过期的媒体帧。
第三方面, 一种实现数据包重组的装置, 包括:
创建单元, 用于在 VOIP终端和非 VOIP终端间建立用于传输 RTP数 据包的媒体通道;
接收单元 ,用于接收所述 VOIP终端通过所述媒体通道向所述非 VOIP 终端发送的经过冗余处理的 RTP数据包;
解析单元, 用于获取所述接收单元接收到的 RTP数据包中的媒体帧 以及所述媒体帧的序号, 并提供给重组单元;
所述重组单元, 用于根据历史上记录的所述媒体通道中已发送过的媒 体帧的序号, 从获取的媒体帧中区分出已发送过的媒体帧和未发送过的媒 体帧; 将未发送过的媒体帧分别打包为 RTP数据包,通过发送单元发送给 所述非 VOIP终端, 并记录下所述发送的媒体帧的序号;
所述发送单元, 用于将打包后的所述 RTP数据包发送给所述非 VOIP 终端。
在第三方面的第一种可能的实现方式中, 所述发送单元具体用于将所 述打包后的 RTP数据包按照所述 RTP数据包中的媒体帧的序号由低到高 顺序发送给所述非 VOIP终端。
结合第三方面或第三方面的第一种可能的实现方式, 在第二种可能的 实现方式中, 所述创建单元还用于在创建与所述媒体通道对应的列表用于 记录所述媒体通道中已发送过的媒体帧的序号;
所述重组单元在记录所述发送的媒体帧的序号时, 将所述发送的媒体 帧的序号在所述列表中。
结合第三方面或第三方面的第一种可能或第三方面的第二种可能的 实现方式, 在第三种可能的实现方式中, 所述装置还包括:
删除单元, 用于根据所述列表的长度和所述列表中记录的最新的媒体 帧的序号确定过期的媒体帧的序号, 将所述列表中已过期的媒体帧的序号
删除。
第四方面, 一种实现数据包重组的装置, 包括:
创建单元, 用于在 VOIP终端和非 VOIP终端间建立用于传输 RTP数 据包的媒体通道;
接收单元, 接收所述非 VOIP终端通过所述媒体通道向所述 VOIP终 端发送的未经冗余处理的 RTP数据包;
解析单元, 用于获取所述接收单元接收到的 RTP数据包中的媒体帧 以及所述媒体帧的序号, 并提供给重组单元;
所述重组单元, 用于根据从所述解析单元获取的媒体帧的序号从緩存 区中读取所述媒体帧的序号之前预设数量的媒体帧, 与所述媒体通道对应 的, 并保存有历史接收到的媒体帧; 将从所述解析单元获取的媒体帧与从 所述緩存区中读取的媒体帧打包为一个 RTP数据包 ,通过发送单元发送给 所述非 VOIP终端, 并在緩存区中緩存从所述解析单元获取的媒体帧; 所述发送单元, 用于将所述重组单元打包后的 RTP数据包发送给所 述 VOIP客户端。
在第四方面的第一种可能的实现方式中, 所述重组单元包括: 确定子单元, 用于根据所述解析单元获取的媒体帧的序号和预先设置 读取子单元, 用于以所述确定子单元确定出的预设数量的媒体帧的序 号从所述緩存区中读取对应的媒体帧;
打包子单元, 用于将从所述解析单元获取的媒体帧与从所述緩存区中 读取的媒体帧打包为一个 RTP数据包;
緩存子单元, 用于在緩存区中緩存从所述解析单元中获取的媒体帧。 结合第四方面的第一种可能的实现方式, 在第二种可能的实现方式 中, 所述读取子单元还用于在从所述緩存区中读取对应的媒体帧的过程中 忽略读取失败的媒体帧。
结合第四方面的第二种可能的实现方式, 在第三种可能的实现方式 中, 所述创建单元还用于创建与所述緩存区对应的列表用于记录所述緩存
区中緩存的媒体帧的序号, 所述緩存区中緩存的媒体帧的位置与所述列表 中记录的所述媒体帧的序号的位置相对应;
所述读取子单元具体用于在所述列表中查找所述确定子单元确定出 的预定数量的媒体帧的序号, 确定查找到的所述序号的位置, 并从緩存区 的对应位置读取所述序号对应的媒体帧, 其中, 在所述查找过程中忽略未 查找到的序号。
结合第四方面的第三种可能的实现方式, 在第四种可能的实现方式 中, 所述装置还包括:
删除单元, 用于根据所述列表的长度和所述列表中记录的最新的媒体 帧的序号确定过期的媒体帧的序号, 将所述列表中已过期的媒体帧的序号 删除, 并对应删除所述緩存区中已过期的媒体帧。
本发明实施例在易发生网络丟包的 VOIP终端侧釆用冗余技术对媒体 帧传输, 减少了互联网中丟包对媒体帧传输产生的影响, 并由网络设备对 冗余数据包和非冗余数据包进行转换, 在可靠性较高的电信网中釆用非冗 余数据包进行传输, 使非 VOIP 终端可以正确解码或编码。 从而提高了 VOIP终端和非 VOIP终端之间的通话质量。 附图说明
为了更清楚地说明本发明实施例的技术方案, 下面将对实施例中所需 要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发 明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的 前提下, 还可以根据这些附图获得其他的附图。
图 1是 VOIP终端与非 VOIP终端进行通话的网络结构图;
图 2是本发明实施例提供的数据包重组方法的流程图;
图 3是本发明另一实施例提供的数据包重组方法的流程图;
图 4 是本发明实施例提供将冗余数据包转换为非冗余数据包的示意 图;
图 5是本发明另一实施例提供的数据包重组方法的流程图;
图 6是本发明另一实施例提供的数据包重组方法的流程图; 图 7 是本发明实施例提供将非冗余数据包转换为冗余数据包的示意 图;
图 8是本发明另一实施例提供的数据包重组装置的结构示意图; 图 9是本发明另一实施例提供的数据包重组装置的结构示意图; 图 10是本发明另一实施例提供的数据包重组装置的结构示意图; 图 11是本发明另一实施例提供的数据包重组装置的结构示意图; 图 12是本发明实施例提供的数据包重组装置的硬件结构示意图。
具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进 行清楚、 完整地描述,显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没 有作出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的 范围。
本发明实施例中, 将通过 VOIP客户端进行通话的终端称之为 VOIP终 端。 反之, 未通过 VOIP客户端进行通话的的终端则称之为非 VOIP终端。 其中, VOIP终端可以是计算机、 平板电脑或手机等终端。 非 VOIP终端可 以是固定电话、 手机或 SIP硬终端等终端。 VOIP终端与非 VOIP终端的主 要区别在于是否通过 VOIP客户端进行通话。以手机为例,在手机釆用 VOIP 客户端进行呼叫通话时, 手机是 VOIP终端; 当手机未釆用 VOIP客户端, 而是釆用手机的原生电话系统进行通话时, 手机是非 VOIP客户端。
下面通过图 1对 VOIP终端与非 VOIP终端进行通话的网络结构进行说 明。 如图 1所示, 在 VOIP终端与非 VOIP终端进行通话的网络中包括互联 网 ( internet ) 和运营商提供的公用陆地移动网 (pub l ic land mob i le network , PLMN ) 或公用交互电话网 ( publ ic swi tched te lephone network , PSTN ) 。 VOIP终端接入到 interne t网中, 通过 internet网发
送或接收数据。 非 VOIP终端接入到电信网络 PLMN/ PSTN中, 通过 PLMN/ PSTN网络发送或接收数据。 其中, 在 VOIP终端与非 VOIP终端进行通话的 网络中还包括用于在互联网和电信网络间实现互通的网络设备, 如 VOIP 软交换设备和 /或落地网关。 本发明实施例的方案可以在 VO I P软交换设备 上实现, 也可以在落地网关上实现。
具体的,在 VOIP终端与非 VOIP终端的呼叫过程中,如果是音频呼叫 , 网络设备为 VOIP终端与非 VOIP终端建立两条不同方向的音频媒体通道, 一条从 VOIP终端到非 VOIP终端, 另一条从非 VOIP终端到 VOIP终端。 如 果是视频呼叫, 则除了建立两条音频媒体通道外, 还可以建立两条不同方 向的视频媒体通道用于传输视频。 VOIP终端在媒体通道建立后, 将本端的 音频或视频媒体经过 internet网络传输到网络设备( VOIP软交换设备和 / 或落地网关) , 再由网络设备经过电信网络传输到非 VOIP终端。
由于互联网的传输可靠性较差, 容易发生丟包, 而非 VOIP终端又不 支持冗余技术, 因此, 本发明实施例提供了一种在网络设备(如, VOIP 软交换设备或落地网关)进行数据包重组的方案, 由网络设备对传输的数 据包在冗余和非冗余之间进行转换, 实现在互联网中釆用冗余技术传输的 数据, 提高互联网的抗丟包能力, 而对在电信网中传输的数据不釆用冗余 技术, 让非 VOIP终端可以正确解码或编码。
本发明实施例中的冗余是指在发送当前媒体帧的数据包中携带上已 发送过的媒体帧, 其中, 需要携带的已发送过的媒体帧由冗余倍数决定。 本发明实施例中的数据包为 RTP数据包。
图 2为本发明实施例提供的数据包重组的方法的流程图, 本实施例描 述从 VOIP终端到非 VOIP终端的方向的数据重组方法, 具体包括:
S200 , 网络设备在 VOIP终端和非 VOIP终端间建立用于传输 RTP数据 包的媒体通道。 其中, VOIP终端为通过 VOIP客户端来进行该通话的终端。
在 VOIP终端和非 VOIP终端的呼叫建立过程中, 网络设备分别建立从
VOIP终端到非 VOIP终端方向的媒体通道和从非 VOIP终端到 VOIP终端方 向的媒体通道。 本实施例为了方便对 VOIP终端向非 VOIP终端发送数据包 进行说明, 因此, 以建立 VOIP终端到非 VOIP终端方向的媒体通道为例进 行说明。
S202 , 网络设备接收 VOIP终端通过该媒体通道向非 VOIP终端发送的 经过冗余处理的 RTP数据包。
在媒体通道建立后, VOIP终端对本端的媒体帧进行釆集, 并按照预设 的冗余倍数将釆集的媒体帧打包为 RTP数据包。 其中, 对媒体帧的冗余处 理可釆用现有冗余技术来实现, 这里不再赘述。
S 204 , 网络设备获取所述 RTP数据包中的媒体帧以及媒体帧的序号。 网络设备在接收到 VOIP终端发送的 RTP数据包后, 对接收到的 RTP 数据包进行解析, 获得 RTP数据包中的媒体帧以及媒体帧的序号。
S206 , 网络设备根据历史上记录的该媒体通道中已发送过的媒体帧的 序号, 从获取的媒体帧中区分出已发送过的媒体帧和未发送过的媒体帧。
具体的, 网络设备会对该媒体通道中发送过的媒体帧的序号进行记 录。 在网络设备解析出媒体帧和媒体帧的序号后, 将解析出的媒体帧的序 号与历史记录的该媒体通道中已发送过的媒体帧的序号进行匹配, 若匹配 到相同的序号, 则表明该媒体帧已发送过; 若未匹配到相同的序号, 则表 明该媒体帧没有发送过。
S208 , 网络设备将未发送过的媒体帧分别打包为 RTP数据包, 并将打 包后的 RTP数据包发送给非 VOIP终端, 记录下发送的媒体帧的序号。
由于非 VOIP终端不支持 RTP数据包中携带冗余媒体帧, 因为非 VOIP 终端无法解析携带多个媒体帧的 RTP数据包。 因此, 在打包发送给非 VOIP 终端的 RTP数据包时, 将每个媒体帧分别打包。
如果获取的媒体帧属于已发送过的媒体帧, 则说明该媒体帧是冗余的 媒体帧。 此情况下, 可将获取的媒体帧中属于已发送过的媒体帧丟弃。
网络设备在创建媒体通道时 , 还可以创建与该媒体通道对应的列表用 于记录已发送过的媒体帧的序号。 本发明实施例中的列表并不特指表结 构, 还可以包括队列或堆栈等数据结构的线性表, 可以通过数组或链表来 实现。
网络设备在每次给非 VO IP终端发送媒体帧时, 都记录下该次发送的 媒体帧的序号, 以便下次接收到 RTP数据包时对 RTP数据包中的冗余媒体 帧进行区分。
本发明实施例在易发生网络丟包的 VO IP终端侧釆用冗余技术对媒体 帧进行传输, 即釆用在数据包中携带冗余的媒体帧的方式进行传输, 减少 了在互联网中的丟包, 并由网络设备将经过冗余处理的数据包转换为非冗 余的数据包, 使非 VOIP终端可以正确解码。 从而在非 VOIP终端不支持冗 余技术的情况下, 提高了话音质量。 而且, 网络设备在将经过冗余处理的 数据包转换为非冗余的数据包时, 无需将所有媒体帧緩存下来再转换, 而 是通过记录下已发送的媒体帧的序号, 对每个数据包进行实时判断并转 换, 实现了即到即转。 因此, 本发明实施例提供的方案在转换时增加的延 时也非常小。
为了提高非 VO IP终端的解析效率, 在本发明的一个实施例中, 步骤 S208中的将打包后的 RTP数据包发送给非 VOIP终端可以具体包括: 将所 述打包后的 RTP数据包按照所述 RTP数据包中的媒体帧的序号由低到高顺 序发送给非 VO IP终端。 序号删除。 从而节约网络设备的存储资源。 具体的, 网络设备可以根据列 表的长度和列表中记录的最新的媒体帧的序号确定过期的媒体帧的序号, 然后将该列表中已过期的媒体帧的序号删除。 其中, 根据列表的长度和列 来实现。 举例说明, 假设该算法为 M-N+1 , 其中, N为用于记录已发送媒
体帧的序号的列表长度, M为列表中记录的最新的媒体帧的序号, 则网络 设备将序号小于或等于 M-N+1的媒体帧确定为过期媒体帧。 通过本实施例 中的方法可以实时确定过期媒体帧的序号。
下面通过具体实施例来对图 2所示的从 VOIP终端到非 VOIP终端方向 的数据重组方法做更详细的说明, 本实施例中假设冗余倍数为 k (k为整 数, 常用取值有 0, 1, 2, 其中 0表示没有冗余) 。 如图 3所示, 图 3为 从 VOIP终端到非 VOIP终端方向的数据重组方法, 该方法包括:
S300, VOIP终端发起对非 VOIP终端的呼叫。
S302, 网络设备在 VOIP终端和非 VOIP终端间建立用于传输 RTP数据 包的媒体通道。
本实施例为了方便对 VOIP终端向非 VOIP终端发送数据包进行说明, 因此, 以建立 VOIP终端到非 VOIP终端方向的媒体通道为例进行说明。
S304, 网络设备创建对应媒体通道的列表用于记录该媒体通道中已发 送过的媒体帧的序号。
本实施例将网络设备创建的列表记为 list 1,该列表的长度记为 N (N 为正整数) 。 其中, 列表的长度可以灵活设置, 范围通常为 10_200。 需要 说明的是,本发明实施例中的列表并不是特指表结构,而是还可包括堆栈、 队列等数据结构的线性表。
S306, 网络设备接收 VOIP终端通过该媒体通道向非 VOIP终端发送的 经过冗余处理的 RTP数据包。
由于本实施例中冗余倍数为 k, 因此, VOIP终端在进行冗余处理时, 除了在 RTP数据包中携带当前要发送的媒体帧, 还同时携带当前媒体帧之 前的 k个媒体帧。 如果当前媒体帧之前不足 k个媒体帧, 则在 RTP数据包 中携带当前帧之前的所有媒体帧。 下面举例进行说明, 假设有媒体帧 Αο , A! , Α2 , A3 , A4...... AM, 其中 k=2 (即 2倍冗余) , 发送 帧时, 由于 之前不足 3个媒体帧, 因此, RTP数据包中仅携带 A^ Ai, 其中 A。为冗余
媒体帧。 发送 A2帧时, RTP数据包中携带 A。, , A2, 其中, A。,Ai为冗余 媒体帧。 发送 A3帧时, RTP数据包中携带 Ai ,A2 ,A3, 其中, Ai ,A2为冗余 媒体帧, 依次类推, 每个帧都会进行 2倍冗余。
S308, 网络设备解析数据包, 得到数据包中的媒体帧以及该媒体帧的 序号。
S310, 网络设备将得到的媒体帧序号与列表中记录的已发送过的媒体 帧序号进行匹配, 若在列表中匹配到相同的序号, 则执行 S312; 若在列表 中未匹配到相同的序号, 则执行 S314。
S312, 网络设备将匹配到相同序号的媒体帧丟弃。
如果在列表中匹配到相同序号, 则说明该媒体帧是冗余的媒体帧, 因 此, 将该媒体帧丟弃。
S314, 网络设备将未匹配到相同序号媒体帧分别打包为独立的 RTP数 据包, 并将打包后的 RTP数据包发送给非 VOIP终端, 在列表中记录下发 送的媒体帧的序号。
S316, 网络设备删除列表中过期的媒体帧的序号。
网络设备在将媒体帧的序号记录到列表时, 还可以进一步对列表中过 期的媒体帧序号进行删除。 其中, 网络设备可以根据列表的长度和列表中 表中记录的最新的媒体帧的序号为 M, 则可将序号不大于 M-N+1的媒体帧 认为是过期媒体帧。 通过此方式计算过期媒体帧, 可以在每记录一个媒体 帧的序号就判断一次,从而可以实时的将列表早期记录的序号删除。例如, 假设列表的长度 N=50, 当 M=50时 (此时列表已经被存满) , 网络设备将 小于等于 1的媒体帧序号删除。 当然, M-N+1仅是一个举例, 本领域技术 人员也可以根据该例子想到其它的计算方式, 比如也可以釆用 M-N+2来实 现。
为了便于理解, 下面进行举例描述。 如图 4所示, 图 4为将冗余数据
包转换为非冗余数据包的示意图。 假设 VOIP终端发 Λ Α、 B、 C三个数据 包, 其中, 数据包 A携带序号为 5, 6, 7的三个媒体帧, 数据包 B携带序号 为 6, 7, 8的三个媒体帧, 数据包 C携带序号为 7, 8, 9的三个媒体帧。 由于 网络丟包问题, 导致数据包 B丟失。 网络设备(VOIP软交换设备或落地网 关)仅接收到 A和 C两个数据包。 其中, 数据包 A先到达网络设备。
在上述情况下, 当网络设备( VO IP软交换设备或落地网关)接收到数 据包 C时, 解析得到序号分别为 7, 8, 9的三个媒体帧。 由于序号帧 7在数 据包 A也携带有, 因此, 网络设备可以从列表中匹配到该帧的序号, 从而 确定该帧是已发送过的媒体帧。 网络设备将帧 7丟弃。 对于序号为 8的媒 体帧, 由于数据包 B丟失, 因此数据包 C到达网络设备时, 网络设备是首 次收到帧 8 , 网络设备在列表中无法匹配到该帧的序号。 因此, 网络设备 将该帧独立打包发送给非 VO IP终端。 对于序号为 9的媒体帧, 网络设备 也是首次收到, 因此, 网络设备也将帧 9独立打包发送给非 VO IP终端。
通过上述方式, 本发明实施例提供的方案可以成功抵御互联网的丟包 问题。
下面对从非 VO IP终端到 VOIP终端的方向的数据重组方法进行说明, 如图 5所示, 图 5为本发明实施例提供的数据包重组的方法的流程图, 具 体包括:
S500 , 网络设备在 VOIP终端和非 VO IP终端间建立用于传输 RTP数据 包的媒体通道。
在 VOIP终端和非 VO IP终端的呼叫建立过程中, 网络设备分别建立从 VOIP终端到非 VO IP终端方向的媒体通道和从非 VO IP终端到 VOIP终端方 向的媒体通道。 本实施例描述从非 VOIP终端到 VO IP终端的方向的数据重 组方法, 因此, 本实施例以从非 VOIP终端到 VOIP终端的方向的媒体通道 为例进行说明。
网络设备在建立媒体通道时还可以创建与该媒体通道对应的緩存区
用于緩存接收到的媒体帧。
S502 , 网络设备接收非 VOIP终端通过该媒体通道向 VOIP终端发送的 未经冗余处理的 RTP数据包。
在媒体通道建立后, 非 VOIP终端对本端的媒体帧进行釆集, 并将釆 集的媒体帧分别打包为独立的 RTP数据包。 由于非 VOIP终端不支持对媒 体帧的冗余处理, 因此, 在打包时, 每个 RTP数据包中携带一个媒体帧。
S504 , 网络设备获取该 RTP数据包中的媒体帧以及该媒体帧的序号, 并根据该媒体帧的序号从緩存区中读取该媒体帧的序号之前预设数量的 媒体帧。 其中, 该緩存区与媒体通道对应, 并保存有历史接收到的媒体帧 的
其中, 从緩存区中读取该媒体帧的序号之前预设数量的媒体帧具体可 包括:
网络设备根据 RTP数据包中的媒体帧的序号和预先设置的冗余倍数确 定该媒体帧的序号之前预设数量的媒体帧的序号; 以确定出的媒体帧的序 号从緩存区中读取对应的媒体帧。
进一步的, 网络设备在从所述緩存区中读取对应的媒体帧的过程中可 忽略读取失败的媒体帧。
由于数据包到达网络设备的时间有先后, 有可能会存在序号在前的媒 体帧后到达网络设备的情况, 因此, 网络设备在緩存区中无法找到该媒体 帧, 导致读取失败。 在此情况下, 网络设备可以继续执行后续操作, 忽略 读取失败的媒体帧。
S 506 , 网络设备将从 RTP数据包中获取的媒体帧与从緩存区中读取的 媒体帧打包为一个 RTP数据包 ,并将打包后的 RTP数据包发送给所述 VOIP 终端。
S508 , 网络设备在緩存区中緩存从 RTP数据包中获取的媒体帧。
本发明实施例中, 网络设备将非 VOIP终端发送的非冗余的数据包转
换为经过冗余处理的数据包, 然后通过互联网发送给 VOIP终端, 使得在 非 VOIP终端不支持冗余技术的情况下, 仍可釆用冗余技术来提高话音质 量。
为了提高从緩存区读取需要进行冗余处理的媒体帧的效率, 在本发明 的一个实施例中, 网络设备还可以创建用于记录緩存区中緩存的媒体帧的 序号的列表。 其中, 緩存区中緩存的媒体帧的位置与列表中记录的该媒体 帧的序号的位置相对应。 网络设备以确定出的预定数量的媒体帧的序号从 緩存区中读取对应的媒体帧具体可以包括: 在列表中查找确定出的预定数 量的媒体帧的序号, 确定查找到的序号的位置, 并从緩存区的对应位置读 取该序号对应的媒体帧。 其中, 在查找过程中如果有查找不到的序号, 则 忽略该序号。 由于在列表中进行查找速度比在緩存区中查找的速度更快, 因此可以提高读取待进行冗余处理的媒体帧的效率。
上述实施例中, 查找到的序号的位置是指该序号相对列表起始处的偏 移位置。 緩存区中緩存的媒体帧的位置与列表中记录的该媒体帧的序号的 位置相对应是指该媒体帧在緩存区中相对该緩存区起始位置的偏移位置 与该媒体帧的序号在列表中的偏移位置相同。 号和緩存区中媒体帧删除, 从而节约网络设备的存储资源。 网络设备可以 根据列表的长度和列表中记录的最新的媒体帧的序号确定过期的媒体帧 的序号, 然后将该列表中已过期的媒体帧的序号删除和緩存区中对应的媒 体帧删除。 其中, 根据列表的长度和列表中记录的最新的媒体帧的序号确 定过期的媒体帧的序号可以釆用算法来实现。 举例说明, 假设该算法为
M-N+1 , 其中, N为用于记录緩存区中緩存的媒体帧的序号的列表的长度, M为列表中记录的最新的媒体帧的序号, 则网络设备将序号小于或等于 M-N+1的媒体帧确定为过期媒体帧。网络设备确定出过期媒体帧的序号后, 从列表中查找过期媒体帧的序号, 并根据查找到的序号找到緩存区中对应
的媒体帧, 删除列表中的该序号和緩存区中对应的媒体帧。 通过本实施例 中的方法可以实时确定过期媒体帧的序号。
下面通过具体实施例来对图 5所示的从非 VOIP终端到 VOIP终端方向 的数据重组方法做更详细的说明。 本实施例中假设冗余倍数为 k (k为整 数, 常用取值有 0, 1, 2, 其中 0表示没有冗余) 。 如图 6所示, 图 6为 从非 VOIP终端到 VOIP终端方向的数据重组方法, 该方法包括:
S600, 非 VOIP终端发起对 VOIP终端的呼叫。
S602, 网络设备在非 VOIP终端和 VOIP终端间建立用于传输 RTP数据 包的媒体通道。
本实施例为了方便对非 VOIP终端向 VOIP终端发送数据包进行说明, 因此, 以建立非 VOIP终端到 VOIP终端方向的媒体通道为例进行说明。
S604, 网络设备创建与该媒体通道对应的緩存区用于緩存接收到的媒 体帧, 并创建用于记录该緩存区中緩存的媒体帧的序号的列表。
其中, 緩存区中緩存的媒体帧的位置与列表中记录的该媒体帧的序号 的位置相对应。 即媒体帧在緩存区中相对该緩存区起始位置的偏移位置与 该媒体帧的序号在列表中的偏移位置相同。
本实施例中网络设备创建的列表记为 list 2, 该列表的长度记为 N (N 为正整数) 。 其中, 列表的长度可以灵活设置, 范围通常为 10_200。 需要 说明的是,本发明实施例中的列表并不是特指表结构,而是还可包括堆栈、 队列等数据结构的线性表。
S606, 网络设备接收非 VOIP终端通过媒体通道向 VOIP终端发送的未 经冗余处理的 RTP数据包。
在媒体通道建立后, 非 VOIP终端对本端的媒体帧进行釆集, 并将釆 集的媒体帧分别打包为 RTP数据包。 由于非 VOIP终端不支持对媒体帧的 冗余处理, 因此, 在打包时, 每个 RTP数据包中携带一个媒体帧。
S608, 获取接收到的 RTP数据包中的媒体帧和该媒体帧的序号。
网络设备从接收的 RTP数据包中解析出媒体帧和该媒体帧的序号。
S610, 根据从 RTP数据包中解析出的媒体帧的序号和预先设置的冗余 倍数确定该媒体帧的序号之前预设数量的媒体帧的序号。
其中, 解析出的媒体帧的序号之前预设数量的媒体帧为解析出的媒体 帧之前的 k (k为冗余倍数)个媒体帧。 步骤 S610中的根据解析出的媒体 帧的序号和预先设置的冗余倍数确定解析出的媒体帧的序号之前预设数 量的媒体帧的序号具体包括: 将解析出的媒体帧的序号分别减去 1至 k所 得到的序号则为需进行冗余处理的媒体帧的序号。 举例说明, 假设解析得 到的媒体帧的序号为 Απ, 则 Απ之前的 k个媒体帧的序号分别为 Απ-1, Αη-2, ...... , An-k0 其中, 序号为 Απ_1, Αη-2, ...... , An_k的媒体帧则为解 析出的媒体帧的序号之前预设数量的媒体帧。
S612, 在列表中查找确定出的预设数量的媒体帧的序号, 当列表中不 存在查找的序号时则执行步骤 S614;当列表中存在查找的序号时则执行步 骤 S616。
S614, 忽略未查找到的序号。
当列表中不存在查找的序号时, 若该序号不是最后一个需要进行冗余 处理的媒体帧的序号, 则网络设备忽略掉该序号, 继续在列表中查找其它 需要进行冗余处理的媒体帧的序号; 若该序号是最后一个需要进行冗余处 理的媒体帧的序号, 则结果查找流程。
S616, 确定查找到的序号的位置, 并从緩存区的对应位置读取所述序 号对应的媒体帧。
具体的, 网络设备先确定该序号在列表中的偏移位置, 然后在緩存区 的相应偏移位置处获取对应的媒体帧。
S 618 , 将从 RTP数据包中获取的媒体帧与从緩存区中读取的媒体帧打 包为一个 RTP数据包, 将打包后的 RTP数据包发送给所述 VOIP终端。
S620, 在緩存区中緩存从 RTP数据包中获取的媒体帧, 并在列表中记
录该媒体帧的序号。
其中, 緩存区中緩存的媒体帧的位置与列表中记录的该媒体帧的序号 的位置相对应。 过期媒体帧。
网络设备在緩存媒体帧以及媒体帧的序号时, 还可以进一步对过期的 媒体帧和该媒体帧的序号进行删除。 其中, 网络设备可以根据列表的长度 和列表中记录的最新的媒体帧的序号来确定列表中过期的媒体帧。 具体 的,假设列表中记录的最新的媒体帧的序号为 M,则可将序号不大于 M-N+1 的媒体帧认为是过期媒体帧。 通过此方式计算过期媒体帧, 可以在每记录 一个媒体帧的序号就判断一次, 从而可以实时的将列表早期记录的序号以 及緩存区中与该序号对应的媒体帧删除。 例如, 假设列表的长度 N=50 , 当 M=50时,网络设备将序号为 1的媒体帧序号以及緩存区中对应的媒体帧删 除。 当然, M-N+1仅是一个举例, 本领域技术人员也可以根据该例子想到 其它的计算方式, 比如也可以釆用 M-N+2来实现。
为了便于理解, 下面进行举例描述。 如图 7所示, 图 7为将非冗余数 据包转换为冗余数据包的示意图。 假设釆用 2倍冗余(即 k=2 , 每个数据 包除携带当前的媒体帧, 还需同时携带之前的两个媒体帧) , 非 VOIP终 端发出数据包 C , 其中, 数据包 C中携带序号为 9的媒体帧。 假设网络设 备在接收到数据包 C之前, 还接收到分别携带序号为 7和 8的数据包 A和 数据包 B , 并对序号为 7和 8的媒体帧进行了緩存。
在上述情况下, 当网络设备接收到数据包 C时, 根据数据包 C中的媒 体帧的序号和要釆用的冗余倍数计算需要进行冗余处理的媒体帧的序号, 即用数据包 C中的媒体帧的序号 9分别减去 1至 k (本实施例中 k=2 ) , 得到需要进行冗余处理的媒体帧的序号分别为 7和 8。 因此, 在记录有緩 存区中緩存的媒体帧的序号的列表中查找序号 7和 8。 假设查找到的序号
7和 8在列表中的位置分别为第 3和第 4个位置 (即相对列表起始位置的 偏移量为分别为 3和 4 ) , 则在緩存区的第 3和第 4个位置读取出相应的 媒体帧。 将读取出的序号为 7和 8的媒体帧与接收到的序号为 9的媒体帧 打包为一个 RTP数据包, 其中, RTP数据包中的媒体帧 7和媒体帧 8为冗 余帧。 然后将打包后的 RTP数据包发送给 VOIP终端。
通过上述方式, 本发明实施例提供的方案可以成功抵御互联网的丟包 问题。
上述方法实施例中的网络设备可以是图 1所示网络架构中的 VO IP软 交换设备或落地网关等设备。 网络设备为实现数据包重组功能的装置。 如 图 8所示, 图 8为本发明实施例提供的实现数据包重组的装置 800的结构 示意图, 本实施例中数据包重组为将冗余数据包重组为非冗余数据包, 该 装置 800可以包括:
创建单元 801 , 用于在 VOIP终端和非 VOIP终端间建立用于传输 RTP 数据包的媒体通道。 其中, V0 IP终端为通过 V0IP客户端来进行该通话的 终端。
接收单元 802 ,用于接收 V0 IP终端通过创建单元 801创建的媒体通道 向非 V0IP终端发送的经过冗余处理的 RTP数据包。
解析单元 803 , 用于获取接收单元 802接收到的 RTP数据包中的媒体 帧以及该媒体帧的序号, 提供给重组单元 804。
重组单元 804 , 用于根据历史记录的所述媒体通道中已发送过的媒体 帧的序号, 从获取的媒体帧中区分出已发送过的媒体帧和未发送过的媒体 帧; 将未发送过的媒体帧分别打包为独立的 RTP数据包, 并通过发送单元 805将打包后的 RTP数据包发送给非 V0IP终端,记录下发送的媒体帧的序 号。
发送单元 805 ,用于将重组单元 804打包后的 RTP数据包发送给非 V0 IP 终端。
其中, 创建单元 801在创建媒体通道时可以分别建立从 VOIP终端到 非 VOIP终端方向的媒体通道和从非 VO IP终端到 VOIP终端方向的媒体通 道。 图 8所示实施例为了方便对 VOIP终端向非 VO IP终端发送数据包进行 说明, 因此, 以建立 VOIP终端到非 VO IP终端方向的媒体通道为例进行说 明。
接收单元 802接收到 RTP数据包之后, 将该 RTP数据包发送到解析单 元 803进行解析。 解析单元 803解析出 RTP数据包中携带的媒体帧以及该 媒体帧的序号, 然后提供给重组单元 804进行数据包重组。
其中, 重组单元 804进行数据包重组即是将 RTP数据包从冗余数据包 重组为非冗余数据包。 具体的, 重组单元 804接收到解析单元 803解析出 的媒体帧和媒体帧的序号后, 将解析出的媒体帧的序号与历史记录的该媒 体通道中已发送过的媒体帧的序号进行匹配, 若匹配到相同的序号, 则表 明该媒体帧已发送过; 若未匹配到相同的序号, 则表明该媒体帧没有发送 过。 重组单元 804将已发送过的媒体帧丟弃, 将未发送过的媒体帧分别打 包为独立的 RTP数据包, 并将打包后的 RTP数据包通过发送单元 805发送 给非 V0IP终端, 记录下发送的媒体帧的序号。
本发明实施例中, 创建单元 801在创建媒体通道时, 还可以创建与该 媒体通道对应的列表用于记录已发送过的媒体帧的序号。 重组单元 804可 以从该列表中获取历史上记录的该媒体通道中已发送过的媒体帧的序号。 在发送媒体帧时, 重组单元 804在列表中记录下发送的媒体帧的序号, 以 便下次接收到 RTP数据包时对 RTP数据包中的冗余媒体帧进行区分。 本发 明实施例中的列表并不特指表结构, 还可以包括队列或堆栈等数据结构的 线性表, 可以通过数组或链表来实现。
为了提高非 V0 IP终端的解析效率, 发送单元 805在发送 RTP数据包 时可以将打包后的 RTP数据包按照该 RTP数据包中的媒体帧的序号由低到 高顺序发送给非 V0IP终端。
在本发明另一实施例中, 如图 9所示, 为了节约资源, 装置 800还可 以进一步包括: 删除单元 806 , 用于根据列表的长度和列表中记录的最新 的媒体帧的序号确定过期的媒体帧的序号, 将列表中已过期的媒体帧的序 号删除。 其中, 删除单元 806可以通过算法实时确定过期媒体帧的序号。 举例说明, 假设该算法为 M-N+1 , 其中, N为用于记录已发送媒体帧的序 号的列表长度, M为列表中记录的最新的媒体帧的序号, 则删除单元 806 将序号小于或等于 M-N+ 1的媒体帧确定为过期媒体帧。
需要说明的是, 用于存储已发送的媒体帧的序号的列表可以位于装置 800内部, 也可以装置 800外部。 当该列表位于装置 800内部时, 如图 9 所示, 装置 800还可包括: 存储单元 807 , 用于存储创建单元 801创建的 列表。
本发明实施例在易发生网络丟包的 VO I P终端侧釆用冗余技术对媒体 帧进行传输, 即釆用在数据包中携带冗余的媒体帧的方式进行传输, 减少 了在互联网中的丟包, 并由网络设备将经过冗余处理的数据包转换为非冗 余的数据包, 使非 VO I P终端可以正确解码。 从而在非 VO I P终端不支持冗 余技术的情况下, 提高了话音质量。 而且, 网络设备在将经过冗余处理的 数据包转换为非冗余的数据包时, 无需将所有媒体帧緩存下来再转换, 而 是通过记录下已发送的媒体帧的序号, 对每个数据包进行实时判断并转 换, 实现了即到即转。 因此, 本发明实施例提供的方案在转换时增加的延 时也非常小。
图 8和图 9所示实施例中的各单元的功能的具体实现可参考方法实施 例部分, 这里不再赘述。
另外, 网络设备作为实现数据包重组功能的装置, 也可以实现将非冗 余数据包重组为冗余数据包, 如图 1 0所示, 图 1 0为本发明实施例提供的 实现数据包重组的装置 1 0的结构示意图, 本实施例中数据包重组为将非 冗余数据包重组为冗余数据包, 该装置 1 0可以包括:
创建单元 1001 , 用于在 VOIP终端和非 VOIP终端间建立用于传输 RTP 数据包的媒体通道。 其中, VOIP终端为通过 VOIP客户端来进行通话的终 端。
接收单元 1002 ,接收非 V0IP终端通过创建单元 1001创建的媒体通道 向 V0IP终端发送的未经冗余处理的 RTP数据包。
解析单元 1003 , 用于获取接收单元 1002接收到的 RTP数据包中的媒 体帧和该媒体帧的序号, 提供给重组单元 1004。
重组单元 1004 , 用于根据解析单元 1003解析出的媒体帧的序号从緩 存区中读取该媒体帧的序号之前预设数量的媒体帧, 其中, 该緩存区与所 述媒体通道对应的, 并保存有历史接收到的媒体帧; 将从解析单元 1003 中获取的媒体帧与从緩存区中读取的媒体帧打包为一个 RTP数据包, 通过 发送单元 1005发送给所述非 V0IP终端, 并在緩存区中緩存从解析单元 1003中获取的媒体帧。
发送单元 1005 , 用于将重组单元 1004打包后的 RTP数据包发送给所 述 V0IP客户端。
其中, 创建单元 1001在建立媒体通道时可以分别建立从 V0IP终端到 非 V0IP终端方向的媒体通道和从非 V0IP终端到 V0IP终端方向的媒体通 道。 图 10所示实施例为了方便对非 V0IP终端向 V0IP终端发送数据包进 行说明, 因此, 是以建立非 V0IP终端到 V0IP终端方向的媒体通道为例进 行说明的。
创建单元 1001在建立媒体通道时, 还可以创建与该媒体通道对应的 緩存区用于緩存待进行冗余处理的媒体帧。
本发明实施例中, 网络设备将非 V0IP终端发送的非冗余的数据包转 换为经过冗余处理的数据包, 然后通过互联网发送给 V0IP终端, 使得在 非 V0IP终端不支持冗余技术的情况下, 仍可釆用冗余技术来提高话音质 量。
下面对重组单元 1004的具体结构进行进一步的说明。 如图 11所示, 在本发明另一实施例所示的进行数据包重组的装置 10的结构示意图 11 中, 重组单元 1004具体可包括:
确定子单元 10041,用于根据从解析单元 1003获取的媒体帧的序号和 预先设置的冗余倍数确定该媒体帧的序号之前预设数量的的媒体帧的序 号。
读取子单元 10042, 用于以确定子单元 10041确定出的预设数量的媒 体帧的序号从緩存区中读取对应的媒体帧;
打包子单元 10043,用于将从解析单元 1003获取的媒体帧与从緩存区 中读取的媒体帧打包为一个 RTP数据包;
緩存子单元 10044,用于在緩存区中緩存从解析单元 1003获取的媒体 帧。
其中, 读取子单元 10042在在从緩存区中读取对应的媒体帧的过程中 可以忽略读取失败的媒体帧。
为了提高从緩存区读取需要进行冗余处理的媒体帧的效率, 在本发明 的一个实施例中, 创建单元 1001还用于创建与緩存区对应的列表用于记 录该緩存区中緩存的媒体帧的序号。 其中, 緩存区中緩存的媒体帧的位置 与该列表中记录的媒体帧的序号的位置相对应。 在此情况下, 读取子单元 10042具体用于在列表中查找确定出的预设数量的媒体帧的序号, 确定查 找到的序号的位置, 并从緩存区的对应位置读取该序号对应的媒体帧。 其 中, 读取子单元 10042在查找过程中可以忽略未查找到的序号。
由于数据包到达网络设备的时间有先后, 有可能会存在序号在前的媒 体帧后到达装置 10的情况, 因此, 读取子单元 10042在緩存区中无法找 到该媒体帧, 导致读取失败。 在此情况下, 读取子单元 10042可以继续执 行后续操作, 忽略读取失败的媒体帧。
上述实施例中, 查找到的序号的位置是指该序号相对列表起始处的偏
移位置。 緩存区中緩存的媒体帧的位置与列表中记录的该媒体帧的序号的 位置相对应是指该媒体帧在緩存区中相对该緩存区起始位置的偏移位置 与该媒体帧的序号在列表中的偏移位置相同。
在本发明另一实施例中, 装置 10还可以查找列表中已过期的媒体帧 的序号以及緩存区中已过期的媒体帧, 将已过期的媒体帧序号和媒体帧删 除, 从而节约网络设备的存储资源。 因此, 如图 11所示, 装置 10还可以 包括: 删除单元 1006, 用于根据列表的长度和列表中记录的最新的媒体帧 的序号确定过期的媒体帧的序号, 将列表中已过期的媒体帧的序号以及緩 存区中已过期的媒体帧删除。
删除单元 1006可以通过算法实时确定过期媒体帧的序号。 举例说明, 假设该算法为 M-N+1, 其中, N为用于记录緩存区中緩存的媒体帧的序号 的列表的长度, M为列表中记录的最新的媒体帧的序号, 则删除单元 1006 将序号小于或等于 M-N+1的媒体帧确定为过期媒体帧。 删除单元 1006确 定出过期媒体帧的序号后, 从列表中查找过期媒体帧的序号, 并根据查找 到的序号找到緩存区中对应的媒体帧, 删除列表中的该序号和緩存区中对 应的媒体帧。
需要说明的是, 用于存储媒体帧的緩存区和记录已发送的媒体帧的序 号的列表可以位于装置 10内部, 也可以装置 800外部。 当该緩存区和列 表位于装置 10内部时, 如图 11所示, 装置 10还可包括: 存储单元 1007。 创建单元 1001将緩存区和列表创建在存储单元 1007中。
图 10和图 11所示实施例中的各单元的功能的具体实现可参考方法实 施例部分, 这里不再赘述。
需要说明的是, 本发明实施例中的网络设备可基于计算机系统的硬件 结构来实现, 如图 12所述, 网络设备的硬件结构可以包括存储器 1201、 通信接口 1202, 处理器 1203和总线 1204。
其中, 处理器 1203、 存储器 1201和通信接口 1202通过总线 1204通
信连接。
存储器 1201可以是只读存储器 (Read Only Memory, ROM) , 静态存 储设备,动态存储设备或者随机存取存储器( Random Access Memory, RAM )。 存储器 1201可以存储操作系统和其他应用程序的指令以及应用数据。 存 储器 1201中存储的指令由处理器 1203来运行执行。
通信接口 1202用来实现网络设备与其他设备或通信网络 (例如但不 限于 PLMN/PSTN, 互联网等) 之间的通信。
处理器 1203可以釆用通用的中央处理器( Central Processing Unit, CPU) , 处理器, 应用专用集成电路(Application Specific Integrated Circuit, ASIC) , 或者一个或多个集成电路, 用于执行相关程序。
本发明实施例中, 处理器 1203用于执行存储器 1201中的指令。
总线 1204可包括一通路, 在各个部件 (例如处理器 1203、 存储器 1201和通信接口 1202 ) 之间传送信息。
其中, 当网络设备用在将冗余数据包重组为非冗余数据包的实施例中 时,图 12所示的网络设备中的处理器 1203、存储器 1201和通信接口 1202 的具体实现如下:
通信接口 1202, 用于在处理器 1203的控制下在 V0IP终端和非 V0IP 终端间建立用于传输 RTP数据包的媒体通道; 接收 V0IP终端通过该媒体 通道向非 V0IP终端发送的经过冗余处理的 RTP数据包。
处理器 1203, 用于通过通信接口 1202建立 V0IP终端和非 V0IP终端 间的媒体通道; 获取通信接口 1202接收到的 RTP数据包中的媒体帧以及 该媒体帧的序号; 根据历史上记录的所述媒体通道中已发送过的媒体帧的 序号, 从获取的媒体帧中区分出已发送过的媒体帧和未发送过的媒体帧; 将未发送过的媒体帧分别打包为独立的 RTP数据包,并通过通信接口 1202 将打包后的 RTP数据包发送给非 V0IP终端, 以及在存储器 1201中记录下 发送的媒体帧的序号。
通信接口 1202 ,还用于将处理器 1 203打包的 RTP数据包发送给非 VO IP 终端。
其中, 通信接口 1 202接收到 RTP数据包之后, 将该 RTP数据包发送 到处理器 1203进行解析。 处理器 1203解析出 RTP数据包中携带的媒体帧 以及该媒体帧的序号, 然后进行数据包重组。
处理器 1 203进行数据包重组即是将 RTP数据包从冗余数据包重组为 非冗余数据包。 具体的, 处理器 1203解析出的媒体帧和媒体帧的序号后, 将解析出的媒体帧的序号与历史记录的该媒体通道中已发送过的媒体帧 的序号进行匹配, 若匹配到相同的序号, 则表明该媒体帧已发送过; 若未 匹配到相同的序号, 则表明该媒体帧没有发送过。 处理器 1203将已发送 过的媒体帧丟弃, 将未发送过的媒体帧分别打包为独立的 RTP数据包, 并 将打包后的 RTP数据包通过通信接口 1 202发送给非 VO I P终端, 以及在存 储器 1 201 中记录下发送的媒体帧的序号。
处理器 1203可以在存储器 1 201中创建与该媒体通道对应的列表用于 记录已发送过的媒体帧的序号。 处理器 1 203可以从该列表中获取历史上 记录的该媒体通道中已发送过的媒体帧的序号。 而且, 在发送媒体帧时, 处理器 1 203可以在列表中记录下发送的媒体帧的序号, 以便下次接收到 RTP数据包时对 RTP数据包中的冗余媒体帧进行区分。 本发明实施例中的 列表并不特指表结构, 还可以包括队列或堆栈等数据结构的线性表, 可以 通过数组或链表来实现。
存储器 1 201用于存储处理器 1203创建的列表。
进一步的, 为了节约资源, 处理器 1203还可以根据列表的长度和列 表中记录的最新的媒体帧的序号确定过期的媒体帧的序号, 将列表中已过 期的媒体帧的序号删除。
上述实施例是网络设备将冗余数据包重组为非冗余数据包的实施例。 在本发明另一实施例中, 网络设备还可以实现将非冗余数据包重组为冗余
数据包,本实施例中,图 12所示的网络设备中的处理器 1203、存储器 1201 和通信接口 1202的具体实现如下:
通信接口 1202 , 用于在处理器 1203的控制下在 VO IP终端和非 VOIP 终端间建立用于传输 RTP数据包的媒体通道; 接收非 VOIP终端通过该媒 体通道向 VO IP终端发送的未经冗余处理的 RTP数据包。
处理器 1203 , 用于通过通信接口 1202建立 V0IP终端和非 V0IP终端 间的媒体通道; 用于获取通信接口 1202接收到的 RTP数据包中的媒体帧 和该媒体帧的序号; 根据获取的媒体帧的序号从緩存区中读取该媒体帧的 序号之前预设数量的媒体帧, 其中, 该緩存区与所述媒体通道对应, 并保 存有历史接收到的媒体帧; 将获取的媒体帧与从緩存区中读取的媒体帧打 包为一个 RTP数据包, 通过通信接口 1202发送给所述非 V0 IP终端, 并在 緩存区中緩存从通信接口 1202获取 RTP数据包中的媒体帧。
通信接口 1202 , 还用于将处理器 1203打包的 RTP数据包发送给 V0 IP 终端。
其中, 处理器 1203根据获取的媒体帧的序号从緩存区中读取该媒体 帧的序号之前预设数量的媒体帧的具体实现如下:
处理器 1203根据获取的媒体帧的序号和预先设置的冗余倍数确定该 媒体帧的序号之前预设数量的的媒体帧的序号; 以确定出的预设数量的媒 体帧的序号从緩存区中读取对应的媒体帧; 将获取的媒体帧与从緩存区中 读取的媒体帧打包为一个 RTP数据包; 并在緩存区中緩存获取的媒体帧。
其中, 处理器 1203在从緩存区中读取对应的媒体帧的过程中可以忽 略读取失败的媒体帧。
为了提高从緩存区读取需要进行冗余处理的媒体帧的效率, 在本发明 的一个实施例中, 处理器 1203还用于创建与緩存区对应的列表用于记录 该緩存区中緩存的媒体帧的序号。 其中, 緩存区中緩存的媒体帧的位置与 该列表中记录的媒体帧的序号的位置相对应。 在此情况下, 处理器 1203
以确定出的预设数量的媒体帧的序号从緩存区中读取对应的媒体帧的具 体实现如下: 处理器 1 203可在列表中查找确定出的预设数量的媒体帧的 序号, 确定查找到的序号的位置, 并从緩存区的对应位置读取该序号对应 的媒体帧。 其中, 处理器 1203在查找过程中可以忽略未查找到的序号。
由于数据包到达网络设备的时间有先后, 有可能会存在序号在前的媒 体帧后到达的情况, 因此, 处理器 1 203在緩存区中无法找到该媒体帧, 导致读取失败。 在此情况下, 处理器 1 203可以继续执行后续操作, 忽略 读取失败的媒体帧。
上述实施例中, 查找到的序号的位置是指该序号相对列表起始处的偏 移位置。 緩存区中緩存的媒体帧的位置与列表中记录的该媒体帧的序号的 位置相对应是指该媒体帧在緩存区中相对该緩存区起始位置的偏移位置 与该媒体帧的序号在列表中的偏移位置相同。
在本发明另一实施例中, 为了节约存储资源, 处理器 1203还可以根 据列表的长度和列表中记录的最新的媒体帧的序号确定过期的媒体帧的 序号, 将列表中已过期的媒体帧的序号以及緩存区中已过期的媒体帧删 除。
需要说明的是, 处理器 1 203创建的列表以及緩存区都可位于存储器 1201中。
通过以上的实施例的描述, 本领域普通技术人员可以理解: 实现上述 实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完 成,所述的程序可以存储于一计算机可读取存储介质中,该程序在执行时, 包括如上述方法实施例的步骤, 所述的存储介质, 如: R0M/RAM、 磁碟、 光盘等。 以上所述, 仅为本发明的具体实施例, 但本发明的保护范围并不局限 于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻 易想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的
保护范围应以权利要求的保护范围为准
Claims
1、 一种数据包重组的方法, 其特征在于, 包括:
网络设备在 VOIP终端和非 VOIP终端间建立用于传输 RTP数据包的媒 体通道;
接收所述 VOIP终端通过所述媒体通道向所述非 VOIP终端发送的经过 冗余处理的 RTP数据包;
获取所述 RTP数据包中的媒体帧以及所述媒体帧的序号; 的媒体帧中区分出已发送过的媒体帧和未发送过的媒体帧;
将未发送过的媒体帧分别打包为 RTP数据包, 并将打包后的 RTP数据 包发送给所述非 VOIP终端, 记录下所述发送的媒体帧的序号。
2、 如权利要求 1所述的方法, 其特征在于, 所述将所述打包后的 RTP 数据包发送给所述非 VOIP终端具体包括:将所述打包后的 RTP数据包按 照所述 RTP数据包中的媒体帧的序号由低到高顺序发送给所述非 VOIP终 端。
3、 如权利要求 1或 2任一项所述的方法, 其特征在于, 所述方法还包 括: 创建与所述媒体通道对应的列表用于记录所述媒体通道中已发送过的 媒体帧的序号;
所述记录下所述发送的媒体帧的序号具体包括: 将所述发送的媒体帧 的序号记录在所述列表中。
4、 如权利要求 3所述的方法, 其特征在于, 所述方法还包括: 根据所述列表的长度和所述列表中记录的最新的媒体帧的序号确定过 期的媒体帧的序号, 将所述列表中已过期的媒体帧的序号删除。
5、 一种数据包重组的方法, 其特征在于, 包括:
网络设备在 VOIP终端和非 VOIP终端间建立用于传输 RTP数据包的媒 体通道;
接收所述非 VOIP终端通过所述媒体通道向所述 VOIP终端发送的未经 冗余处理的 RTP数据包;
获取所述 RTP数据包中的媒体帧以及所述媒体帧的序号, 并从緩存区 中读取所述媒体帧的序号之前预设数量的媒体帧; 所述緩存区与所述媒体
通道对应, 并保存有历史接收到的媒体帧;
将从所述 RTP数据包中获取的媒体帧与从所述緩存区中读取的媒体帧 打包为一个 RTP数据包, 并将打包后的 RTP数据包发送给所述 VOIP终 端;
在所述緩存区中緩存从所述 RTP数据包中获取的媒体帧。
6、 如权利要求 5所述的方法, 其特征在于, 所述从所述緩存区中读取 所述媒体帧的序号之前预设数量的媒体帧包括:
根据所述媒体帧的序号和预先设置的冗余倍数确定所述媒体帧的序号 之前预设数量的媒体帧的序号;
以确定出的预设数量的媒体帧的序号从所述緩存区中读取对应的媒体 帧。
7、 如权利要求 6所述的方法, 其特征在于, 所述方法还包括: 在从所 述緩存区中读取对应的媒体帧的过程中忽略读取失败的媒体帧。
8、 如权利要求 7所述的方法, 其特征在于, 所述方法还包括: 创建与所述緩存区对应的列表用于记录所述緩存区中緩存的媒体帧的 序号, 所述緩存区中緩存的媒体帧的位置与所述列表中记录的所述媒体帧 的序号的位置相对应;
所述以确定出的预定数量的媒体帧的序号从所述緩存区中读取对应的 媒体帧具体包括:
在所述列表中查找所述确定出的预定数量的媒体帧的序号, 确定查找 到的所述序号的位置, 并从緩存区的对应位置读取所述序号对应的媒体 帧。
9、 如权利要求 8所述的方法, 其特征在于, 所述方法还包括: 根据所述列表的长度和所述列表中记录的最新的媒体帧的序号确定过 期的媒体帧的序号, 将所述列表中已过期的媒体帧的序号删除, 并对应删 除所述緩存区中已过期的媒体帧。
10、 一种实现数据包重组的装置, 其特征在于, 包括:
创建单元,用于在 VOIP终端和非 VOIP终端间建立用于传输 RTP数据 包的媒体通道;
接收单元, 用于接收所述 VOIP终端通过所述媒体通道向所述非 VOIP
终端发送的经过冗余处理的 RTP数据包;
解析单元, 用于获取所述接收单元接收到的 RTP数据包中的媒体帧以 及所述媒体帧的序号, 并提供给重组单元;
所述重组单元, 用于根据历史上记录的所述媒体通道中已发送过的媒 体帧的序号, 从获取的媒体帧中区分出已发送过的媒体帧和未发送过的媒 体帧; 将未发送过的媒体帧分别打包为 RTP数据包,通过发送单元发送给 所述非 VOIP终端, 并记录下所述发送的媒体帧的序号;
所述发送单元, 用于将打包后的所述 RTP数据包发送给所述非 VOIP 终端。
11、 如权利要求 10所述的装置, 其特征在于, 所述发送单元具体用于 将所述打包后的 RTP数据包按照所述 RTP数据包中的媒体帧的序号由低 到高顺序发送给所述非 VOIP终端。
12、 如权利要求 10或 11所述的装置, 其特征在于, 所述创建单元还 用于在创建与所述媒体通道对应的列表用于记录所述媒体通道中已发送 过的媒体帧的序号;
所述重组单元在记录所述发送的媒体帧的序号时, 将所述发送的媒体 帧的序号在所述列表中。
13、 如权利要求 10-12任一项所述的装置, 其特征在于, 所述装置还包 括:
删除单元, 用于根据所述列表的长度和所述列表中记录的最新的媒体 帧的序号确定过期的媒体帧的序号, 将所述列表中已过期的媒体帧的序号 删除。
14、 一种实现数据包重组的装置, 其特征在于, 包括:
创建单元,用于在 VOIP终端和非 VOIP终端间建立用于传输 RTP数据 包的媒体通道;
接收单元, 接收所述非 VOIP终端通过所述媒体通道向所述 VOIP终端 发送的未经冗余处理的 RTP数据包;
解析单元, 用于获取所述接收单元接收到的 RTP数据包中的媒体帧以 及所述媒体帧的序号, 并提供给重组单元;
所述重组单元, 用于根据从所述解析单元获取的媒体帧的序号从緩存
区中读取所述媒体帧的序号之前预设数量的媒体帧, 所述緩存区与所述媒 体通道对应, 并保存有历史接收到的媒体帧; 将从所述解析单元获取的媒 体帧与从所述緩存区中读取的媒体帧打包为一个 RTP数据包,通过发送单 元发送给所述非 VOIP终端, 并在緩存区中緩存从所述解析单元获取的媒 体帧;
所述发送单元, 用于将所述重组单元打包后的 RTP数据包发送给所述 VOIP客户端。
15、 如权利要求 14所述的装置, 其特征在于, 所述重组单元包括: 确定子单元, 用于根据所述解析单元获取的媒体帧的序号和预先设置 读取子单元, 用于以所述确定子单元确定出的预设数量的媒体帧的序 号从所述緩存区中读取对应的媒体帧;
打包子单元, 用于将从所述解析单元获取的媒体帧与从所述緩存区中 读取的媒体帧打包为一个 RTP数据包;
緩存子单元, 用于在緩存区中緩存从所述解析单元中获取的媒体帧。
16、 如权利要求 15所述的装置, 其特征在于, 所述读取子单元还用于 在从所述緩存区中读取对应的媒体帧的过程中忽略读取失败的媒体帧。
17、 如权利要求 16所述的装置, 其特征在于, 所述创建单元还用于创 建与所述緩存区对应的列表用于记录所述緩存区中緩存的媒体帧的序号, 所述緩存区中緩存的媒体帧的位置与所述列表中记录的所述媒体帧的序 号的位置相对应;
所述读取子单元具体用于在所述列表中查找所述确定子单元确定出的 预定数量的媒体帧的序号, 确定查找到的所述序号的位置, 并从緩存区的 对应位置读取所述序号对应的媒体帧, 其中, 在所述查找过程中忽略未查 找到的序号。
18、 如权利要求 17所述的装置, 其特征在于, 所述装置还包括: 删除单元, 用于根据所述列表的长度和所述列表中记录的最新的媒体 帧的序号确定过期的媒体帧的序号, 将所述列表中已过期的媒体帧的序号 删除, 并对应删除所述緩存区中已过期的媒体帧。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310294052.XA CN104283863B (zh) | 2013-07-12 | 2013-07-12 | 一种实现数据包重组的方法和装置 |
CN201310294052.X | 2013-07-12 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2015003557A1 true WO2015003557A1 (zh) | 2015-01-15 |
Family
ID=52258348
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2014/081036 WO2015003557A1 (zh) | 2013-07-12 | 2014-06-27 | 一种实现数据包重组的方法和装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN104283863B (zh) |
WO (1) | WO2015003557A1 (zh) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104579581A (zh) * | 2015-01-30 | 2015-04-29 | 深圳市云之讯网络技术有限公司 | 基于voip应用端和电信网对接的前向纠错方法及其系统 |
CN107666375A (zh) * | 2016-07-28 | 2018-02-06 | 北京数码视讯科技股份有限公司 | 一种数据传输方法及装置 |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101547144A (zh) * | 2008-12-29 | 2009-09-30 | 华为技术有限公司 | 一种提高数据传输质量的方法、装置和系统 |
JP2010021671A (ja) * | 2008-07-09 | 2010-01-28 | Nec Corp | メディア・ゲートウェイ装置、通信システム及びそれらに用いる冗長方法 |
CN101878628A (zh) * | 2007-12-07 | 2010-11-03 | 中兴通讯股份有限公司 | 冗余传输协商方法 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100364290C (zh) * | 2003-04-28 | 2008-01-23 | 华为技术有限公司 | 一种ip网和帧中继网络之间语音交换的方法 |
US20070086434A1 (en) * | 2005-10-19 | 2007-04-19 | Muthaiah Venkatachalam | Efficient mechanisms for supporting VoIp in a wireless network |
US7787377B2 (en) * | 2006-02-03 | 2010-08-31 | Telefonaktiebolaget Lm Ericsson (Publ) | Selective redundancy for Voice over Internet transmissions |
-
2013
- 2013-07-12 CN CN201310294052.XA patent/CN104283863B/zh active Active
-
2014
- 2014-06-27 WO PCT/CN2014/081036 patent/WO2015003557A1/zh active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101878628A (zh) * | 2007-12-07 | 2010-11-03 | 中兴通讯股份有限公司 | 冗余传输协商方法 |
JP2010021671A (ja) * | 2008-07-09 | 2010-01-28 | Nec Corp | メディア・ゲートウェイ装置、通信システム及びそれらに用いる冗長方法 |
CN101547144A (zh) * | 2008-12-29 | 2009-09-30 | 华为技术有限公司 | 一种提高数据传输质量的方法、装置和系统 |
Also Published As
Publication number | Publication date |
---|---|
CN104283863A (zh) | 2015-01-14 |
CN104283863B (zh) | 2018-08-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3940974B1 (en) | Transmission method and device for data stream | |
US10263918B2 (en) | Local fault tolerance for managing alternative networks for high quality of service communications | |
WO2015053530A1 (en) | Method and apparatus for content delivery | |
US20230083441A1 (en) | Managing subpacket transmission and reception for advanced interactive services | |
US9641588B2 (en) | Packets recovery system and method | |
US9237105B2 (en) | Data communication with compensation for packet loss | |
US20230071243A1 (en) | Conserving network resources during transmission of packets of interactive services | |
US20120005549A1 (en) | Transfer apparatus, transfer program, and transfer method | |
KR101991388B1 (ko) | 이종 네트워크상에서의 컨텐츠 전송 방법 및 이를 위한 장치 | |
CN108696491B (zh) | 音频数据的发送处理方法与装置、接收处理方法与装置 | |
JP2016530796A (ja) | ビデオ電話におけるビデオ中断インジケーション | |
US20130077632A1 (en) | Buffer controller correcting packet order for codec conversion | |
JP2007142786A (ja) | ハンドオーバサーバ及びそれと通信可能な移動通信端末 | |
US9148257B2 (en) | Method and apparatus for reducing delays in a packets switched network | |
WO2015003557A1 (zh) | 一种实现数据包重组的方法和装置 | |
CN112866178B (zh) | 音频数据传输的方法和装置 | |
WO2003069787A2 (en) | System and method for fault tolerant multimedia communication | |
WO2008001580A1 (fr) | Dispositif de communication et procédé | |
JP3934073B2 (ja) | リアルタイム情報の伝達システム、リアルタイム情報の送信装置、リアルタイム情報の伝達方法及びプログラム | |
JP2012039461A (ja) | 通信装置、通信方法、および通信プログラム | |
CN109756498B (zh) | 通信设备上tcp协议的nat alg转换方法及系统 | |
CN102932568B (zh) | 嵌入式VoIP电话系统及实现VoIP电话语音质量管理的方法 | |
WO2022160268A1 (zh) | 一种报文处理的方法以及相关装置 | |
JP2002252647A (ja) | Ipパケット伝送装置、ipパケット伝送方法及びそのプログラムを記録した記録媒体 | |
US20050135346A1 (en) | Transmitting apparatus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 14823097 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 14823097 Country of ref document: EP Kind code of ref document: A1 |