Media stream transmission method and system and electronic equipment

By sending empty messages between NAT devices to establish a mapping relationship, the media stream packet loss problem caused by NAT devices not supporting Full cone NAT is solved, which realizes accurate transmission of media streams and reduces call delay.

CN119520470APending Publication Date: 2025-02-25XINYI INFORMATION TECH(SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411772250.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

When the sending end sends media stream to the receiver through the NAT device, the receiving end does not support Full cone NAT, resulting in the media stream being discarded or the ICMP packet with unreachable ports being replied, and the media stream cannot be successfully transmitted.

Method used

Before transmitting the media stream between the calling party device and the called party device, a mapping relationship between the NAT devices is established by sending an empty message, thereby ensuring that the media stream can be correctly mapped to the receiving end.

Benefits of technology

By sending empty messages in advance for holes, the delay at the start of the call and the loss of packets of media streams is avoided, and the media stream can be accurately transmitted to the receiver.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520470A_ABST
    Figure CN119520470A_ABST
Patent Text Reader

Abstract

The invention provides a media stream transmission method and system and electronic equipment, which are applied to calling party equipment, before the calling party equipment sends a media stream to called party equipment, the called party equipment sends at least one empty message to the calling party equipment, so that second NAT (Network Address Translation) equipment establishes a first mapping relationship; the first mapping relation is a mapping relation between a first external address of the calling party equipment and a second mapping relation, and the second mapping relation is a mapping relation between a second internal address of the called party equipment and a second external address; the first NAT device has established a third mapping relationship, and the third mapping relationship is a mapping relationship from the first internal address to the first external address of the calling party device; and after the calling party device sends the media stream to the called party device, the second NAT device maps the media stream to the called party device according to the first external address and the first mapping relation. According to the invention, the media stream can be accurately sent to the opposite terminal equipment below the NAT equipment, and effective transmission of the media stream is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information transmission technology, and in particular to a media stream transmission method, system and electronic equipment. Background Art

[0002] When the sender sends a media stream to the public IP address and port of the receiver after NAT (Network Address Translation), if the NAT device on the receiver does not support Full cone NAT, the NAT device on the receiver will discard the media stream sent by the sender or reply with an ICMP (Internet Control Message Protocol) packet that the port is unreachable. Because the receiver has not sent any messages to the sender's IP address and port before, the NAT device on the receiver will regard the media streams sent to the sender's IP address and port after NAT as packets sent to itself, and the NAT device on the receiver is likely to not open the service for the IP address and port after NAT conversion, which causes the receiver to lose packets or reply with an ICMP packet that the port is unreachable.

[0003] If the receiving end does not have a NAT device or the receiving end is a Full cone NAT, then the media stream sent by the sending end can reach the receiving end, and the receiving end can play the audio or video by decoding. But in fact, most SIP (Session Initiation Protocol) terminals are protected by NAT devices, and the NAT devices are not Full cone NAT. When the sending end sends the media stream to the IP address and port of the NAT device on the receiving end, the NAT device on the receiving end will discard the media stream instead of mapping it to the receiving end. Therefore, the packet loss problem of NAT devices is a technical problem that needs to be solved urgently. Summary of the invention

[0004] The object of the present invention is to provide a media stream transmission method, system and electronic device capable of accurately sending media stream data to terminal devices under a NAT device network.

[0005] Technical solution: The present invention provides a media stream transmission method, which is applied to a calling party device, wherein the calling party device communicates with a called party device via a first NAT device and a second NAT device; the method comprises: Before the calling party device sends the media stream to the called party device, the called party device sends at least one empty message to the calling party device, so that the second NAT device establishes a first mapping relationship, the first mapping relationship is a mapping relationship between a first external address of the calling party device and a second mapping relationship, and the second mapping relationship is a mapping relationship between a second internal address of the called party device and a second external address; The calling party device sends a media stream to the called party device; wherein, before the calling party device sends the media stream to the called party device, the first NAT device has established a third mapping relationship, and the third mapping relationship is a mapping relationship from a first internal address of the calling party device to a first external address; after the calling party device sends the media stream to the called party device, the second NAT device maps the media stream to the called party device according to the first external address and the first mapping relationship.

[0006] Furthermore, before the called party device sends at least one empty message to the calling party device, the process includes: The called party device receives and parses first session description protocol information in the session establishment request sent by the calling party device, where the first session description protocol information includes transmission parameters of a media stream of the calling party device.

[0007] Further, after the called party device receives and parses the first session description protocol information in the session establishment request sent by the calling party device, the method further includes: The called party device periodically sends a null message to the first external address of the calling party device.

[0008] Furthermore, the periodic time for the called party device to send the null message is one third of the mapping information keep-alive time of the first mapping relationship.

[0009] A media stream transmission method is applied to a called party device, wherein the called party device communicates with a calling party device via a second NAT device and a first NAT device, comprising the following steps: Before the called party device sends the media stream to the calling party device, the calling party device sends at least one empty message to the called party device, so that the first NAT device establishes a fourth mapping relationship, the fourth mapping relationship is a mapping relationship between the second external address of the called party device and the third mapping relationship, and the third mapping relationship is a mapping relationship between the first internal address of the calling party device and the first external address; The called party device sends a media stream to the calling party device; wherein, before the called party device sends the media stream to the calling party device, the second NAT device has established a second mapping relationship, and the second mapping relationship is a mapping relationship from a second internal address of the called party device to a second external address; after the called party device sends the media stream to the calling party device, the first NAT device maps the media stream to the calling party device according to the second external address and the fourth mapping relationship.

[0010] Furthermore, before the calling party device sends at least one empty message to the called party device, the method further includes: The calling party device establishes SDP negotiation with the called party device.

[0011] Furthermore, the calling party device and the called party device establish SDP negotiation, including: The calling party device sends a session establishment request to the called party device, wherein the session establishment request includes first session description protocol information, and the first session description protocol information includes transmission parameters of the media stream of the calling party device; The calling party device receives a feedback message returned by the called party device, where the feedback message includes second session description protocol information, and the second session description protocol information includes transmission parameters of a media stream of the called party device; The calling party device compares the transmission parameters of the media stream of the calling party device with the transmission parameters of the media stream of the called party device, selects media configuration according to the comparison result, establishes a session, and sends confirmation information of the session establishment to the called party device.

[0012] Furthermore, after the calling party device receives the feedback message returned by the called party device, the method further includes: The calling party device periodically sends a null message to the second external address of the called party device.

[0013] Furthermore, the cycle time of sending the null message by the calling party device is one third of the mapping information keep-alive time of the fourth mapping relationship.

[0014] An electronic device, characterized in that it is applied to a calling party device, the calling party device communicates with a called party device via a first NAT device and a second NAT device; Before sending the media stream to the called party device, the calling party device receives at least one empty message sent by the called party device, so that the second NAT device establishes a first mapping relationship, wherein the first mapping relationship is a mapping relationship between a first external address of the calling party device and a second mapping relationship, and the second mapping relationship is a mapping relationship between a second internal address of the called party device and a second external address; The calling party device sends a media stream to the called party device; wherein, before the calling party device sends the media stream to the called party device, the first NAT device has established a third mapping relationship, and the third mapping relationship is a mapping relationship from a first internal address of the calling party device to a first external address; after the calling party device sends the media stream to the called party device, the second NAT device maps the media stream to the called party device according to the first external address and the first mapping relationship.

[0015] An electronic device, applied to a called party device, wherein the called party device communicates with a calling party device via a second NAT device and a first NAT device; Before the called party device sends the media stream to the calling party device, the called party device receives at least one empty message sent by the calling party device, so that the first NAT device establishes a fourth mapping relationship, the fourth mapping relationship is a mapping relationship between the second external address of the called party device and the third mapping relationship, and the third mapping relationship is a mapping relationship between the first internal address of the calling party device and the first external address; The called party device sends a media stream to the calling party device; wherein, before the called party device sends the media stream to the calling party device, the second NAT device has established a second mapping relationship, and the second mapping relationship is a mapping relationship from a second internal address of the called party device to a second external address; after the called party device sends the media stream to the calling party device, the first NAT device maps the media stream to the calling party device according to the second external address and the fourth mapping relationship.

[0016] A streaming media transmission system comprises a calling party device, a called party device, a first NAT device and a second NAT device; The called party device sends at least one empty message to the calling party device before the calling party device sends the media stream to the called party device; The second NAT device establishes a first mapping relationship after the called party device sends at least one empty message to the calling party device, wherein the first mapping relationship is a mapping relationship between a first external address of the calling party device and a second mapping relationship, and the second mapping relationship is a mapping relationship between a second internal address of the called party device and a second external address; The first NAT device has established a third mapping relationship before the calling party device sends the media stream to the called party device, and the third mapping relationship is a mapping relationship from the first internal address of the calling party device to the first external address; The calling party device sends a media stream to the called party device, and the first NAT device maps the media stream to the called party device according to the third mapping relationship, and the second NAT device maps the media stream to the called party device according to the first external address and the first mapping relationship.

[0017] A streaming media transmission system includes a calling party device, a called party device, a first NAT device and a second NAT device. Before the called party device sends the media stream to the calling party device, the calling party device sends at least one empty message to the called party device; The first NAT device establishes a fourth mapping relationship after the calling party device sends at least one empty message to the called party device, wherein the fourth mapping relationship is a mapping relationship between the second external address of the called party device and the third mapping relationship, and the third mapping relationship is a mapping relationship between the first internal address of the calling party device and the first external address; Before the called party device sends the media stream to the calling party device, the second NAT device has established a second mapping relationship, where the second mapping relationship is a mapping relationship from a second internal address of the called party device to a second external address; The called party device sends a media stream to the calling party device, and the second NAT device maps the media stream to the calling party device according to the second mapping relationship, and the first NAT device maps the media stream to the calling party device according to the second external address and the fourth mapping relationship.

[0018] Technical effect: Before the media stream transmission call is established, the present invention sends an empty message in advance to make a hole, thereby avoiding the delay at the beginning of the call and the media stream packet loss. It is suitable for most application scenarios and can significantly improve the competitiveness of the product. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a flow chart of a method in which an embodiment is applied to a calling party device; Figure 2 is a flow chart of a method in which an embodiment is applied to a called party device; Figure 3 It is a structural diagram of a streaming media transmission system according to an embodiment. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein should be understood by people with general skills in the field to which the present invention belongs. "Including" and similar words used in this article mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects.

[0021] like Figure 1 As shown, an embodiment of the present invention provides a media stream transmission method, which is applied to a calling party device, and the calling party device communicates with the called party device via a first NAT device and a second NAT device; the method includes: S1: before the calling party device sends a media stream to the called party device, the called party device sends at least one empty message to the calling party device, so that the second NAT device establishes a first mapping relationship, the first mapping relationship is a mapping relationship between a first external address of the calling party device and a second mapping relationship, and the second mapping relationship is a mapping relationship between a second internal address of the called party device and a second external address; These empty messages may be discarded by the first NAT device or reply with an ICMP packet of port unreachable, but the second NAT device has recorded the mapping relationship used to send to the second external address. In this way, when the media stream sent by the calling device reaches the second NAT device, the second NAT device will think that these streaming media messages are the return packets of the empty messages sent by the called device to make holes, and then will map these streaming media to the called device, and the called device will perform the next step of decoding and playback through these media streams. Before the media stream transmission call is established, the delay at the beginning of the call and the loss of media stream packets are avoided by sending empty messages in advance to make holes.

[0022] As another implementation of this embodiment, before the called party device sends at least one empty message to the calling party device, it includes: the called party device receives and parses the first session description protocol information in the session establishment request sent by the calling party device, and the first session description protocol information includes the transmission parameters of the media stream of the calling party device.

[0023] After the second NAT device is penetrated, in order to prevent the second NAT device mapping entry from being deleted due to timeout, after the called party device receives and parses the first session description protocol information in the session establishment request sent by the calling party device, the called party device periodically sends empty messages to the first external address of the calling party device to maintain the validity of the mapping relationship established by the second NAT device. Because NAT devices usually delete mapping entries that have no data flowing through after a certain period of time (such as 60 seconds). If the called party device is off-hook for too long, the second NAT device may delete the previously established mapping entry, resulting in the media stream sent by the calling party device failing to reach the called party device.

[0024] As a preferred mode of this embodiment, the cycle time of the called party device sending the empty message is one third of the mapping information keep-alive time of the first mapping relationship. If the default mapping information keep-alive time of the first mapping relationship is 60 seconds, then the cycle time of sending the empty message should be 20 seconds. In this way, it can be ensured that three empty messages are sent within a valid cycle, which greatly reduces the hole punching failure caused by packet loss, and sending an empty message every 20 seconds will not cause too much waste of network resources.

[0025] Whether it is the calling party device or the called party device, the number of empty messages sent each time should not be too many or too few, and the best number is 3 to 4. Too many will waste bandwidth resources, and too few may cause packet loss, because RTP (Real-time Transport Protocol) is based on UDP (User Datagram Protocol), which is an unreliable transmission. If only one empty message is sent, once the packet is lost, the purpose of punching a hole cannot be achieved. Sending 3 to 4 empty messages in succession can greatly reduce the risk of packet loss.

[0026] S2: The calling party device sends a media stream to the called party device; before the calling party device sends the media stream to the called party device, the first NAT device has established a third mapping relationship, and the third mapping relationship is a mapping relationship from the first internal address of the calling party device to the first external address; after the calling party device sends the media stream to the called party device, the second NAT device maps the media stream to the called party device according to the first external address and the first mapping relationship.

[0027] The present invention sends an empty message in advance to perform hole punching before a media stream transmission call is established, thereby avoiding a time delay at the start of a call and a media stream packet loss phenomenon. The present invention is suitable for most application scenarios and can significantly improve product competitiveness.

[0028] like Figure 2As shown, another embodiment provides a media stream transmission method, which is applied to a called party device, where the called party device communicates with the calling party device via a second NAT device and a first NAT device, and includes the following steps: S3: before the called party device sends the media stream to the calling party device, the calling party device sends at least one empty message to the called party device, so that the first NAT device establishes a fourth mapping relationship, the fourth mapping relationship is a mapping relationship between the second external address of the called party device and the third mapping relationship, and the third mapping relationship is a mapping relationship between the first internal address of the calling party device and the first external address; These empty messages may be discarded by the first NAT device or reply with an ICMP packet of port unreachable, but the second NAT device has recorded the mapping relationship used to send to the second external address. In this way, when the media stream sent by the calling device reaches the second NAT device, the second NAT device will think that these streaming media messages are the return packets of the empty messages sent by the called device to make holes, and then will map these streaming media to the called device, and the called device will perform the next step of decoding and playback through these media streams. Before the media stream transmission call is established, the delay at the beginning of the call and the loss of media stream packets are avoided by sending empty messages in advance to make holes.

[0029] As another implementation manner of this embodiment, before the calling party device sends at least one empty message to the called party device, it includes: the calling party device and the called party device establish SDP negotiation.

[0030] As another implementation of this embodiment, the calling party device and the called party device establish SDP negotiation, including: the calling party device sends a session establishment request to the called party device, the session establishment request includes first session description protocol information, and the first session description protocol information includes transmission parameters of the media stream of the calling party device; The calling party device receives a feedback message returned by the called party device, where the feedback message includes the second session description protocol information, and the second session description protocol information includes a transmission parameter of a media stream of the called party device; The calling party device compares the transmission parameters of the media stream of the calling party device with the transmission parameters of the media stream of the called party device, selects a media configuration according to the comparison result, establishes a session, and sends confirmation information of the session establishment to the called party device.

[0031] After the first NAT device is penetrated, in order to prevent the mapping entry of the first NAT device from being deleted due to timeout, after the calling party device receives the feedback message returned by the called party device, the calling party device periodically sends an empty message to the second external address of the called party device to maintain the validity of the mapping relationship established by the first NAT device. Because the NAT device usually deletes the mapping entry without data flow after a certain period of time (such as 60 seconds). If the called party device is off-hook for too long, the first NAT device may delete the previously established mapping entry, resulting in the media stream sent by the calling party device failing to reach the called party device.

[0032] As a preferred mode of this embodiment, the cycle time of the calling party device sending the empty message is one third of the mapping information keep-alive time of the fourth mapping relationship. If the mapping information keep-alive time of the fourth mapping relationship is 60 seconds by default, the cycle time of sending the empty message should be 20 seconds. In this way, it can be ensured that three empty messages are sent within a valid cycle, which greatly reduces the hole punching failure caused by packet loss, and sending an empty message every 20 seconds will not cause too much waste of network resources.

[0033] Whether it is the calling party device or the called party device, the number of empty messages sent each time should not be too many or too few, and the best number is 3 to 4. Too many will waste bandwidth resources, and too few may cause packet loss, because RTP (Real-time Transport Protocol) is based on UDP (User Datagram Protocol), which is an unreliable transmission. If only one empty message is sent, once the packet is lost, the purpose of punching a hole cannot be achieved. Sending 3 to 4 empty messages in succession can greatly reduce the risk of packet loss.

[0034] S4: The called party device sends a media stream to the calling party device; wherein, before the called party device sends the media stream to the calling party device, the second NAT device has established a second mapping relationship, and the second mapping relationship is a mapping relationship from the second internal address of the called party device to the second external address; after the called party device sends the media stream to the calling party device, the first NAT device maps the media stream to the calling party device according to the second external address and the fourth mapping relationship.

[0035] The present invention sends an empty message in advance to perform hole punching before a media stream transmission call is established, thereby avoiding a time delay at the start of a call and a media stream packet loss phenomenon. The present invention is suitable for most application scenarios and can significantly improve product competitiveness.

[0036] Another embodiment provides an electronic device, in which a calling party device communicates with a called party device via a first NAT device and a second NAT device; Before sending the media stream to the called party device, the calling party device receives at least one empty message sent by the called party device, so that the second NAT device establishes a first mapping relationship, the first mapping relationship is a mapping relationship between the first external address of the calling party device and the second mapping relationship, and the second mapping relationship is a mapping relationship between the second internal address of the called party device and the second external address; Before receiving at least one empty message sent by the called party device, the calling party device sends the first session description protocol information in the session establishment request to the called party device, and the first session description protocol information includes the transmission parameters of the media stream of the calling party device. After the calling party device sends the first session description protocol information in the session establishment request to the called party device, the first external address of the calling party device receives the empty message periodically sent from the called party device. The periodic time of the called party device sending the empty message is one third of the mapping information keep-alive time of the first mapping relationship.

[0037] The calling party device sends a media stream to the called party device; before the calling party device sends the media stream to the called party device, the first NAT device has established a third mapping relationship, and the third mapping relationship is a mapping relationship from the first internal address of the calling party device to the first external address; after the calling party device sends the media stream to the called party device, the second NAT device maps the media stream to the called party device according to the first external address and the first mapping relationship.

[0038] Another embodiment provides an electronic device, applied to a called party device, wherein the called party device communicates with a calling party device via a second NAT device and a first NAT device; Before the called party device sends the media stream to the calling party device, the called party device receives at least one empty message sent by the calling party device, so that the first NAT device establishes a fourth mapping relationship, the fourth mapping relationship is a mapping relationship between the second external address of the called party device and the third mapping relationship, and the third mapping relationship is a mapping relationship between the first internal address of the calling party device and the first external address; Before the called party device receives at least one empty message sent by the calling party device, the called party device establishes SDP negotiation with the calling party device. The called party device receives a session establishment request sent by the calling party device, the session establishment request includes first session description protocol information, and the first session description protocol information includes transmission parameters of the media stream of the calling party device; The called party device returns a feedback message to the calling party device, where the feedback message includes the second session description protocol information, and the second session description protocol information includes a transmission parameter of a media stream of the called party device; The transmission parameters of the media stream of the called party device are compared with the transmission parameters of the media stream of the calling party device in the calling party device. The called party device receives the media configuration selected by the calling party device according to the comparison result, establishes a session, and sends confirmation information of the session establishment.

[0039] After the called party device returns the feedback message to the calling party device, the second external address of the called party device receives the empty message periodically sent from the calling party device. The periodic time of the calling party device sending the empty message is one third of the mapping information keep alive time of the fourth mapping relationship.

[0040] The called party device sends a media stream to the calling party device; before the called party device sends the media stream to the calling party device, the second NAT device has established a second mapping relationship, and the second mapping relationship is a mapping relationship from the second internal address of the called party device to the second external address; after the called party device sends the media stream to the calling party device, the first NAT device maps the media stream to the calling party device according to the second external address and the fourth mapping relationship.

[0041] like Figure 3 As shown, another embodiment provides a streaming media transmission system, including a calling party device, a called party device, a first NAT device and a second NAT device, Before the calling party device sends the media stream to the called party device, the called party device sends at least one empty message to the calling party device; After the called party device sends at least one empty message to the calling party device, the second NAT device establishes a first mapping relationship, the first mapping relationship is a mapping relationship between the first external address of the calling party device and the second mapping relationship, and the second mapping relationship is a mapping relationship between the second internal address of the called party device and the second external address; Before the calling party device sends the media stream to the called party device, the first NAT device has established a third mapping relationship, where the third mapping relationship is a mapping relationship from the first internal address of the calling party device to the first external address; The calling party device sends a media stream to the called party device, and the first NAT device maps the media stream to the called party device according to the third mapping relationship, and the second NAT device maps the media stream to the called party device according to the first external address and the first mapping relationship.

[0042] like Figure 3 As shown, another embodiment provides a streaming media transmission system, including a calling party device, a called party device, a first NAT device and a second NAT device, Before the called party device sends the media stream to the calling party device, the calling party device sends at least one empty message to the called party device; After the calling party device sends at least one empty message to the called party device, the first NAT device establishes a fourth mapping relationship, the fourth mapping relationship being a mapping relationship between the second external address of the called party device and the third mapping relationship, the third mapping relationship being a mapping relationship between the first internal address of the calling party device and the first external address; Before the called party device sends the media stream to the calling party device, the second NAT device has established a second mapping relationship, where the second mapping relationship is a mapping relationship from the second internal address of the called party device to the second external address; The called party device sends the media stream to the calling party device, and the second NAT device maps the media stream to the calling party device according to the second mapping relationship and the first NAT device maps the media stream to the calling party device according to the second external address and the fourth mapping relationship.

[0043] In all the above embodiments, the first NAT device is the NAT device of the calling party device, the second NAT device is the NAT device of the called party device, the first external address is the public IP address and port of the calling party device, the first internal address is the private IP address and port of the calling party device, the second external address is the public IP address and port of the called party device, and the second internal address is the private IP address and port of the called party device.

[0044] NAT (Network Address Translation) is a wide area network access technology that converts private addresses into legal public IP addresses. It can perfectly solve the problem of insufficient IP addresses, and can also effectively avoid attacks from external networks, hiding and protecting computers within the network.

[0045] SDP (SESSIONDESCRIPTIONPROTOCOL) provides multimedia session descriptions for purposes such as session notification, session invitation, and other forms of multimedia session initiation. The session directory is used to assist in the announcement of multimedia conferences and to convey relevant setup information to session participants.

[0046] RTP (Real-time Transport Protocol) is a network transmission protocol that provides end-to-end transmission services with real-time characteristics for data, such as interactive video, audio or analog data under multicast or unicast network services.

[0047] Although the embodiments of the present invention are described in detail above, it is obvious to those skilled in the art that various modifications and variations can be made to these embodiments. However, it should be understood that such modifications and variations are within the scope and spirit of the present invention as described in the claims. Moreover, the present invention described herein may have other embodiments and may be implemented or realized in a variety of ways.

Claims

1. A media stream transmission method, characterized in that: Applied to a calling party device, the calling party device communicates with the called party device via a first NAT device and a second NAT device; the method comprises: Before the calling party device sends the media stream to the called party device, the called party device sends at least one empty message to the calling party device, so that the second NAT device establishes a first mapping relationship, the first mapping relationship is a mapping relationship between a first external address of the calling party device and a second mapping relationship, and the second mapping relationship is a mapping relationship between a second internal address of the called party device and a second external address; The calling party device sends a media stream to the called party device; wherein, before the calling party device sends the media stream to the called party device, the first NAT device has established a third mapping relationship, and the third mapping relationship is a mapping relationship from a first internal address of the calling party device to a first external address; after the calling party device sends the media stream to the called party device, the second NAT device maps the media stream to the called party device according to the first external address and the first mapping relationship.

2. The method according to claim 1, characterized in that Before the called party device sends at least one empty message to the calling party device, the method includes: The called party device receives and parses first session description protocol information in the session establishment request sent by the calling party device, where the first session description protocol information includes transmission parameters of a media stream of the calling party device.

3. The method according to claim 2, characterized in that After the called party device receives and parses the first session description protocol information in the session establishment request sent by the calling party device, the method includes: The called party device periodically sends a null message to the first external address of the calling party device.

4. The method according to claim 3, characterized in that The periodic time for the called party device to send the null message is one third of the mapping information keep-alive time of the first mapping relationship.

5. A media stream transmission method, characterized in that: Applied to a called party device, the called party device communicates with the calling party device via a second NAT device and a first NAT device, comprising: Before the called party device sends the media stream to the calling party device, the calling party device sends at least one empty message to the called party device, so that the first NAT device establishes a fourth mapping relationship, the fourth mapping relationship is a mapping relationship between the second external address of the called party device and the third mapping relationship, and the third mapping relationship is a mapping relationship between the first internal address of the calling party device and the first external address; The called party device sends a media stream to the calling party device; wherein, before the called party device sends the media stream to the calling party device, the second NAT device has established a second mapping relationship, and the second mapping relationship is a mapping relationship from a second internal address of the called party device to a second external address; after the called party device sends the media stream to the calling party device, the first NAT device maps the media stream to the calling party device according to the second external address and the fourth mapping relationship.

6. The method according to claim 5, characterized in that Before the calling party device sends at least one empty message to the called party device, the method includes: The calling party device establishes SDP negotiation with the called party device.

7. The method according to claim 6, characterized in that The calling party device and the called party device establish SDP negotiation, including: The calling party device sends a session establishment request to the called party device, wherein the session establishment request includes first session description protocol information, and the first session description protocol information includes transmission parameters of the media stream of the calling party device; The calling party device receives a feedback message returned by the called party device, where the feedback message includes second session description protocol information, and the second session description protocol information includes transmission parameters of a media stream of the called party device; The calling party device compares the transmission parameters of the media stream of the calling party device with the transmission parameters of the media stream of the called party device, selects media configuration according to the comparison result, establishes a session, and sends confirmation information of the session establishment to the called party device.

8. The method according to claim 7, characterized in that After the calling party device receives the feedback message returned by the called party device, the method includes: The calling party device periodically sends a null message to the second external address of the called party device.

9. The method according to claim 8, characterized in that The periodic time for the calling party device to send the null message is one third of the mapping information keep-alive time of the fourth mapping relationship.

10. An electronic device, characterized in that: Applied to a calling party device, the calling party device communicates with a called party device via a first NAT device and a second NAT device; Before sending the media stream to the called party device, the calling party device receives at least one empty message sent by the called party device, so that the second NAT device establishes a first mapping relationship, wherein the first mapping relationship is a mapping relationship between a first external address of the calling party device and a second mapping relationship, and the second mapping relationship is a mapping relationship between a second internal address of the called party device and a second external address; The calling party device sends a media stream to the called party device; wherein, before the calling party device sends the media stream to the called party device, the first NAT device has established a third mapping relationship, and the third mapping relationship is a mapping relationship from the first internal address of the calling party device to the first external address; After the calling party device sends the media stream to the called party device, the second NAT device maps the media stream to the called party device according to the first external address and the first mapping relationship.

11. An electronic device, characterized in that: Applied to a called party device, the called party device communicates with the calling party device via the second NAT device and the first NAT device; Before the called party device sends the media stream to the calling party device, the called party device receives at least one empty message sent by the calling party device, so that the first NAT device establishes a fourth mapping relationship, the fourth mapping relationship is a mapping relationship between the second external address of the called party device and the third mapping relationship, and the third mapping relationship is a mapping relationship between the first internal address of the calling party device and the first external address; The called party device sends a media stream to the calling party device; wherein, before the called party device sends the media stream to the calling party device, the second NAT device has established a second mapping relationship, and the second mapping relationship is a mapping relationship from a second internal address of the called party device to a second external address; after the called party device sends the media stream to the calling party device, the first NAT device maps the media stream to the calling party device according to the second external address and the fourth mapping relationship.

12. A streaming media transmission system, characterized in that: including a calling party device, a called party device, a first NAT device and a second NAT device; The called party device sends at least one empty message to the calling party device before the calling party device sends the media stream to the called party device; The second NAT device establishes a first mapping relationship after the called party device sends at least one empty message to the calling party device, wherein the first mapping relationship is a mapping relationship between a first external address of the calling party device and a second mapping relationship, and the second mapping relationship is a mapping relationship between a second internal address of the called party device and a second external address; The first NAT device has established a third mapping relationship before the calling party device sends the media stream to the called party device, and the third mapping relationship is a mapping relationship from the first internal address of the calling party device to the first external address; The calling party device sends a media stream to the called party device, and the first NAT device maps the media stream to the called party device according to the third mapping relationship, and the second NAT device maps the media stream to the called party device according to the first external address and the first mapping relationship.

13. A streaming media transmission system, characterized in that: including a calling party device, a called party device, a first NAT device and a second NAT device; Before the called party device sends the media stream to the calling party device, the calling party device sends at least one empty message to the called party device; The first NAT device establishes a fourth mapping relationship after the calling party device sends at least one empty message to the called party device, wherein the fourth mapping relationship is a mapping relationship between the second external address of the called party device and the third mapping relationship, and the third mapping relationship is a mapping relationship between the first internal address of the calling party device and the first external address; Before the called party device sends the media stream to the calling party device, the second NAT device has established a second mapping relationship, where the second mapping relationship is a mapping relationship from a second internal address of the called party device to a second external address; The called party device sends a media stream to the calling party device, and the second NAT device maps the media stream to the calling party device according to the second mapping relationship, and the first NAT device maps the media stream to the calling party device according to the second external address and the fourth mapping relationship.