CN117714421A - Data transmission method, device, electronic equipment, storage medium and program product - Google Patents
Data transmission method, device, electronic equipment, storage medium and program product Download PDFInfo
- Publication number
- CN117714421A CN117714421A CN202211104888.4A CN202211104888A CN117714421A CN 117714421 A CN117714421 A CN 117714421A CN 202211104888 A CN202211104888 A CN 202211104888A CN 117714421 A CN117714421 A CN 117714421A
- Authority
- CN
- China
- Prior art keywords
- data
- index
- attribute
- attribute data
- description protocol
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000005540 biological transmission Effects 0.000 title claims abstract description 96
- 238000000034 method Methods 0.000 title claims abstract description 77
- 238000003860 storage Methods 0.000 title claims abstract description 32
- 238000004891 communication Methods 0.000 claims abstract description 91
- 238000007906 compression Methods 0.000 claims abstract description 30
- 230000006835 compression Effects 0.000 claims abstract description 29
- 238000013507 mapping Methods 0.000 claims description 40
- 230000006837 decompression Effects 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 18
- 238000005516 engineering process Methods 0.000 description 15
- 238000012545 processing Methods 0.000 description 14
- 230000008569 process Effects 0.000 description 11
- 230000006870 function Effects 0.000 description 10
- 230000004044 response Effects 0.000 description 9
- 230000003993 interaction Effects 0.000 description 5
- 238000007726 management method Methods 0.000 description 5
- 238000004364 calculation method Methods 0.000 description 4
- 238000012546 transfer Methods 0.000 description 4
- 238000013144 data compression Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000010354 integration Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
Classifications
-
- 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/1066—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/04—Protocols for data compression, e.g. ROHC
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Business, Economics & Management (AREA)
- General Business, Economics & Management (AREA)
- Multimedia (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the application discloses a data transmission method, a device, electronic equipment, a storage medium and a program product, wherein the method comprises the following steps: acquiring session description protocol data, wherein the session description protocol data comprises first attribute data and second attribute data for describing a communication session; determining a first index corresponding to the first attribute data and a second index corresponding to the second attribute data according to the specification of the session description protocol data; replacing the first attribute data in the session description protocol data with a first index, and replacing the attribute name with a second index to obtain compressed data of the session description protocol data; and transmitting the compressed data of the session description protocol data to the second terminal. According to the embodiment of the application, the first index and the second index can be queried rapidly, the first index and the second index are used for replacing corresponding contents in the original data, the compression speed is high, the volume of the session description protocol data can be effectively reduced, and the transmission of the session description protocol data is facilitated.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data transmission method, a data transmission device, an electronic device, a storage medium, and a program product.
Background
Session description protocol (Session Description Protocol, SDP) is mainly used for media negotiations between entities involved in a session, which may refer to a web phone, a conference call, a video chat, etc.
At present, SDP data is used as a carrier for negotiating session information such as audio and video coding and decoding types, data transmission methods, encryption modes and the like by two communication terminals in the related audio and video application based on Web Real-time communication (Web Real-Time Communication, webRTC). The SDP data has perfect content and high expandability, but has more information redundancy and larger volume, and is unfavorable for the transmission and storage of the SDP data.
Disclosure of Invention
The embodiment of the application provides a data transmission method, a data transmission device, electronic equipment, a storage medium and a program product data transmission method, which can effectively reduce the volume of SDP and facilitate the transmission and storage of SDP data.
The embodiment of the application provides a data transmission method, which is applied to a first terminal, and comprises the following steps:
acquiring session description protocol data, wherein the session description protocol data comprises a plurality of attribute data for describing communication sessions, the plurality of attribute data comprises first attribute data and second attribute data, the first attribute data is unchanged in different communication sessions, and the second attribute data comprises attribute names and attribute values, and the attribute values are changed in different communication sessions;
Determining a first index corresponding to the first attribute data and a second index corresponding to the second attribute data according to the specification of the session description protocol data, wherein the first index represents the first attribute data, and the second index represents the attribute name in the second attribute data;
replacing the first attribute data in the session description protocol data with the first index, and replacing the attribute name with the second index to obtain compressed data of the session description protocol data;
and transmitting compressed data of the session description protocol data to a second terminal so that the first terminal and the second terminal establish a communication session based on the compressed data.
The embodiment of the application provides a data transmission method, which is applied to a second terminal, and comprises the following steps:
receiving compressed data of session description protocol data sent by a first terminal, wherein the compressed data comprises a first index, a second index and attribute values associated with the second index, the first index represents the first attribute data, and the second index represents attribute names in the second attribute data;
determining the first attribute data corresponding to the first index and the attribute name corresponding to the second index according to the specification of the session description protocol data;
And replacing the first index in the compressed data with the first attribute data and replacing the second index with the attribute name to obtain the session description protocol data, so that the first terminal and the second terminal establish a communication session based on the session description protocol data.
The embodiment of the application also provides a data transmission device, which is applied to the first terminal, and the device comprises:
a data acquisition module configured to acquire session description protocol data, the session description protocol data including a plurality of attribute data for describing a communication session, the plurality of attribute data including first attribute data and second attribute data, the first attribute data being unchanged in different communication sessions, the second attribute data including an attribute name and an attribute value, the attribute value being changed in different communication sessions;
the index determining module is used for determining a first index corresponding to the first attribute data and a second index corresponding to the second attribute data according to the specification of the session description protocol data, wherein the first index represents the first attribute data, and the second index represents the attribute name in the second attribute data;
The compression module is used for replacing the first attribute data in the session description protocol data with the first index and replacing the attribute name with the second index to obtain compressed data of the session description protocol data;
and the transmission module is used for transmitting the compressed data of the session description protocol data to the second terminal so that the first terminal and the second terminal establish a communication session based on the compressed data.
In some embodiments, the index determination module further comprises:
an obtaining unit, configured to obtain first standard attribute data and second standard attribute data according to the specification of the session description protocol data;
the storage unit is used for storing the first standard attribute data as a first preset array and storing the standard attribute names in the second standard attribute data as a second preset array;
a first index determining unit, configured to obtain the first index according to the index of the first attribute data in the first preset array;
and a second index determining unit, configured to obtain the second index according to the index of the attribute name in the second attribute data in the second preset array.
In some embodiments, the first index determination unit is further configured to:
acquiring a first number of the first standard attribute data, and establishing an initial array with the first number of elements;
determining the index of the first attribute data in the first preset array to obtain candidate indexes;
and mapping the candidate indexes into the initial array based on an index mapping relation to obtain the first index, wherein the index mapping relation comprises a mapping relation between indexes in the initial array and indexes in a first preset array.
In some embodiments, the compression module further comprises:
the first compression unit is used for replacing the first attribute data by using the first index to obtain first compressed data;
a first compression unit, configured to replace the attribute name in the second attribute data with the second index, to obtain the second compressed data;
and the compressed data determining unit is used for determining the first compressed data and the second compressed data as the compressed data of the session description protocol data.
In some embodiments, the first index is an index in an initial array, and the first compression unit is further configured to:
Setting an element corresponding to the first index as the first state parameter in the initial array;
acquiring other indexes except the first index in the initial array;
setting elements corresponding to the other indexes as the second state parameters to obtain a target array, and taking the target array as the first compressed data.
In some embodiments, the second compression unit is further configured to:
acquiring the length of the attribute value in the second attribute data;
and storing the second index, the attribute value and the length of the attribute value in an associated mode to obtain the second compressed data.
The embodiment of the application also provides a data transmission device, which is applied to a second terminal, and the device comprises:
the compressed data receiving module is used for receiving compressed data of session description protocol data sent by the first terminal, wherein the compressed data comprises a first index, a second index and attribute values associated with the second index, the first index represents first attribute data, and the second index represents attribute names in the second attribute data;
the data determining module is used for determining the first attribute data corresponding to the first index and the attribute name corresponding to the second index according to the specification of the session description protocol data;
And the decompression module is used for replacing the first index in the compressed data with the first attribute data and replacing the second index with the attribute name to obtain the session description protocol data so that the first terminal and the second terminal establish a communication session based on the session description protocol data.
In some embodiments, the data determination module further comprises:
an obtaining unit, configured to obtain first standard attribute data and second standard attribute data according to the specification of the session description protocol data;
the storage unit is used for storing the first standard attribute data as a first preset array and storing the standard attribute names in the second standard attribute data as a second preset array;
a first data determining unit, configured to determine data indicated by the first index in the first preset array, to obtain first attribute data;
and a second data determining unit, configured to determine data indicated by the second index in the second preset array, and obtain the attribute name.
In some embodiments, the compressed data further includes a first state parameter in the target array, the first data determination unit further configured to:
Determining a first index of the first state parameter in the target array;
determining the candidate index corresponding to the first index based on an index mapping relation, wherein the index mapping relation comprises a mapping relation between the index in the target array and the index in a first preset array;
and determining the data indicated by the candidate indexes in the first preset array to obtain the first attribute data.
In some embodiments, the decompression module further comprises:
a first decompression unit, configured to replace the first index with the first attribute data to obtain first attribute data;
the second decompression unit is used for replacing the second index by using the attribute name and splicing the attribute name and the attribute value to obtain the second attribute data;
and a decompressed data determination unit that determines the first attribute data and the second attribute data as the session description protocol data.
The embodiment of the application also provides electronic equipment, which comprises a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to perform steps in any of the data transmission methods provided in the embodiments of the present application.
Embodiments of the present application also provide a computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform steps in any of the data transmission methods provided in the embodiments of the present application.
Embodiments of the present application also provide a computer program product comprising computer programs/instructions which, when executed by a processor, implement steps in any of the data transmission methods provided in the embodiments of the present application.
According to the embodiment of the application, according to the specification of the session description protocol, a first index corresponding to the first attribute data is determined, a second index corresponding to the attribute name in the second attribute data is determined, the first index is used for replacing the first attribute data, the second index is used for replacing the attribute name, compressed data of the SDP data are obtained, and finally the compressed data of the SDP data are sent to the second terminal. Based on the specification of SDP, the first index and the second index can be queried rapidly, the corresponding content in SDP data is replaced by the first index and the second index, the compression speed is high, the volume of the SDP data can be effectively reduced, the compressed data of the SDP data is sent to the second terminal, the volume of data transmission is small, the speed is high, and the transmission of the SDP data is facilitated.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1a is a schematic view of a scenario of a data transmission method provided in an embodiment of the present application;
fig. 1b is a schematic flow chart of a data transmission method according to an embodiment of the present application;
fig. 1c is a schematic diagram of SDP data provided in an embodiment of the present application;
FIG. 1d is a schematic diagram of obtaining first compressed data according to an embodiment of the present application;
FIG. 1e is a schematic diagram of obtaining second compressed data according to an embodiment of the present application;
fig. 2a is a schematic flow chart of a data transmission method according to another embodiment of the present application;
fig. 3a is a schematic diagram of a data transmission method according to an embodiment of the present application applied in a video communication scenario;
fig. 3b is an interaction schematic diagram of compressed SDP data provided in an embodiment of the present application;
fig. 3c is a schematic diagram of SDP data compression provided by an embodiment of the present application;
Fig. 3d is an interaction diagram of the original SDP data provided by the embodiment of the present application;
fig. 4a is a schematic structural diagram of a data transmission device according to an embodiment of the present application;
fig. 4b is a schematic structural diagram of a data transmission device according to another embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
The embodiment of the application provides a data transmission method, a data transmission device, electronic equipment, a storage medium and a program product.
The data transmission device may be integrated in an electronic device, which may be a terminal, a server, or other devices. The terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer (Personal Computer, PC) or the like.
The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms. The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal and the server may be directly or indirectly connected through wired or wireless communication, which is not limited herein.
In some embodiments, the data transmission device may also be integrated in a plurality of electronic devices, for example, the data transmission device may be integrated in a plurality of servers, and the data transmission method of the present application is implemented by the plurality of servers.
In some embodiments, the server may also be implemented in the form of a terminal.
For example, referring to fig. 1a, an application scenario schematic diagram of a data transmission method provided in an embodiment of the present application is shown.
As shown in fig. 1a, the first terminal 101 and the second terminal 102 are located in a wireless network or a wired network, and the first terminal 101 and the second terminal 102 may be communicatively connected.
When the first terminal 101 and the second terminal 102 need to establish a communication session, first the first terminal 101 may generate the requested SDP data, and then the first terminal 101 may compress the requested SDP data and send the compressed SDP data to the second terminal 102. In the compression process, SDP data may be acquired, where the SDP data may include a plurality of attribute data, and the plurality of attribute data may include first attribute data and second attribute data; determining a first index corresponding to the first attribute data and a second index corresponding to the second attribute data according to the specification of the SDP, wherein the first index represents the first attribute data, and the second index represents the attribute name in the second attribute data; then, replacing the first attribute data in the SDP data with the first index and replacing the attribute name with the second index to obtain compressed data of the SDP data.
The first terminal 101 then transmits the compressed data to the second terminal 102. The protocol used for transmission may be a transmission protocol based on user datagram protocol (User Datagram Protocol, UDP), such as UDP, NAT session traversal application protocol (Session Traversal Utilities for NAT, STUN), real-time transmission control protocol (Real-time Transport Control Protocol, RTCP), real-time transmission protocol (Real-time Transport Protocol, RTP), secure Real-time transmission protocol (Secure Real-time Transport Protocol, SRTP), secure Real-time transmission control protocol (Secure Real Time Controle Protocol, SRTCP). But also transmission control protocol (Transmission Control Protocol, TCP), hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP), hypertext transfer security protocol (Hyper Text Transfer Protocol over Secure Socket Layer, HTTPs), QUIC, webSocket, dataChannel.
After receiving the compressed data, the second terminal 102 may obtain the compressed data, where the compressed data includes a first index, a second index, and an attribute value associated with the second index, the first index represents the first attribute data, the second index represents an attribute name in the second attribute data, and the second attribute data includes an attribute value corresponding to the attribute name; determining first attribute data corresponding to a first index and attribute names corresponding to a second index according to the specification of the SDP data; replacing the second index in the compressed data with the first attribute data, and replacing the second index with the attribute name to obtain SDP data.
After decompressing the compressed data to obtain SDP data, the second terminal 102 may configure a communication environment based on the SDP data, then generate reply SDP data, compress the reply SDP data using the same compression method, and send the compressed data of the compressed reply SDP data to the first terminal 101. The first terminal 101 decompresses using the same decompression scheme to obtain corresponding reply SDP data. Thus, the first terminal 101 and the second terminal 102 can establish a communication session connection.
Cloud technology (Cloud technology) refers to a hosting technology for integrating hardware, software, network and other series resources in a wide area network or a local area network to realize calculation, storage, processing and sharing of data.
Cloud technology (Cloud technology) is based on the general terms of network technology, information technology, integration technology, management platform technology, application technology and the like applied by Cloud computing business models, and can form a resource pool, so that the Cloud computing business model is flexible and convenient as required. Cloud computing technology will become an important support. Background services of technical networking systems require a large amount of computing, storage resources, such as video websites, picture-like websites, and more portals. Along with the high development and application of the internet industry, each article possibly has an own identification mark in the future, the identification mark needs to be transmitted to a background system for logic processing, data with different levels can be processed separately, and various industry data needs strong system rear shield support and can be realized only through cloud computing.
Cloud conferencing is an efficient, convenient, low-cost form of conferencing based on cloud computing technology. The user can rapidly and efficiently share voice, data files and videos with all groups and clients in the world synchronously by simply and easily operating through an internet interface, and the user is helped by a cloud conference service provider to operate through complex technologies such as data transmission, processing and the like in the conference.
At present, domestic cloud conference mainly focuses on service contents mainly in a SaaS (Software as a Service ) mode, including service forms of telephone, network, video and the like, and video conference based on cloud computing is called as a cloud conference.
In the cloud conference era, the transmission, processing and storage of data are all processed by the computer resources of video conference factories, and users can carry out efficient remote conferences without purchasing expensive hardware and installing complicated software.
The cloud conference system supports the dynamic cluster deployment of multiple servers, provides multiple high-performance servers, and greatly improves conference stability, safety and usability. In recent years, video conferences have been widely used in various fields because of their ability to greatly improve communication efficiency, continuously reduce communication costs, and bring about an upgrade in the level of internal management. Undoubtedly, the video conference has stronger attraction in convenience, rapidness and usability after the cloud computing is applied, and the video conference application is required to be stimulated.
The method provided by the embodiment of the application can also be applied to cloud conferences and cloud videos, and in the communication session establishment stage, the volume of SDP data can be rapidly and effectively reduced, and the transmission efficiency of the SDP data is improved. The following will describe in detail.
In this embodiment, a data transmission method is provided and may be applied to a first terminal, as shown in fig. 1b, where a specific flow of the data transmission method may include the following steps: s110 to S140.
S110, acquiring session description protocol data, where the session description protocol data includes a plurality of attribute data for describing a communication session, and the plurality of attribute data includes first attribute data and second attribute data.
Session description protocol (Session Description Protocol, SDP) data is primarily used for media negotiations between entities involved in a communication session. The entity participating in the communication session may refer to a terminal used when the user participates in the communication session, where the terminals may include a mobile phone, a tablet computer, a smart bluetooth device, an in-vehicle terminal, and the like, and the entity participating in the communication session may be at least two.
The communication session may refer to a web phone, a conference call, a video chat, etc., and the session description protocol data may include a plurality of attribute data, each of which may record related data of the communication session, such as an encoder used by the session, a transmission control session name, a session intention, a session duration, media constituting the session, information of received media, etc.
The plurality of attribute data may include first attribute data and second attribute data. For example, referring to fig. 1c, a schematic diagram of SDP data is shown, wherein each line is one attribute data, wherein each attribute data may be distinguished as either first attribute data or second attribute data.
Wherein the first attribute data refers to attribute data that remains unchanged in different communication sessions. Such as codec name, transmission control parameters, RTP extension, etc. That is, the first attribute data is the same in different communication sessions.
The second attribute data may include an attribute name and an attribute value that varies across different communication sessions, such as session identification, session identity information, encryption information, transport address information, and the like. That is, the second attribute data changes from one communication session to another, i.e., in different communication sessions, the second attribute data changes.
In some embodiments, after the session description protocol data is acquired, a classification process may be performed on a plurality of attribute data in the session description protocol data to obtain the first attribute data and the second attribute data.
As an embodiment, a first attribute table including information of the first attribute data recorded in advance and a second attribute table including information of the second attribute data recorded in advance may be set in advance. When the classification processing is performed, the plurality of attribute data can be traversed, and whether the attribute data exists in the first attribute table or the second attribute table is determined; if the attribute data exists in the first attribute table, the attribute data can be determined to be the first attribute data; if the attribute data exists in the second attribute table, the attribute data may be determined to be the second attribute data.
As an embodiment, attribute data that remains unchanged in different communication sessions may also be recorded as classification reference data in advance. When the classification processing is performed, the method can traverse a plurality of attribute data to determine whether the attribute data is the same as the classification reference data; if the attribute data are the same as the classification reference data, determining the attribute data as first attribute data; and if the attribute data and the classification reference data are different, determining the attribute data as second attribute data.
S120, according to the specification of the session description protocol data, determining a first index corresponding to the first attribute data and a second index corresponding to the second attribute data.
All attribute data that can be contained in the session description protocol data are specified in the specification of the session description protocol data, and for convenience of description, the attribute data specified in the specification of the session description protocol will be referred to as standard attribute data hereinafter. Wherein the first index may characterize the first attribute data and the second index may characterize the attribute names in the second data.
In some embodiments, determining the first index corresponding to the first attribute data and the second index corresponding to the second attribute data according to the specification of the session description protocol data may be obtaining the first standard attribute data and the second standard attribute data according to the specification of the session description protocol data; storing the first standard attribute data as a first preset array, and storing the standard attribute names in the second standard attribute data as a second preset array; obtaining a first index according to the index of the first attribute data in the first preset array; and obtaining the second index according to the index of the attribute name in the second attribute data in the second preset array.
The standard attribute data may be classified into first standard attribute data and second standard attribute data based on a similar classification process as described above. Wherein the first standard attribute data refers to standard attribute data which is kept unchanged in different communication sessions, the second standard attribute data refers to standard attribute data which is changed in different communication sessions, and the second standard attribute data can comprise standard attribute names. Thus, according to the specification of the session description protocol data, the first standard attribute data and the second standard attribute data can be acquired.
In some embodiments, after the first standard attribute data and the second standard attribute data are acquired, the first standard attribute data may be stored as a first preset array, and the standard attribute name in the second standard attribute data may be stored as a second preset array. Then, according to the index of the first attribute data in the first preset array, a first index is obtained; and obtaining a second index according to the index of the attribute name in the second attribute data in the second preset array.
Note that, the standard attribute data refers to attribute data that may appear in the session description protocol data, and then the first attribute data may be included in the first standard attribute data, and the standard attribute name in the second standard attribute data may include an attribute name.
After the first standard attribute data are stored as the first preset array, each first standard attribute data has a corresponding index in the first preset array, and because the first standard attribute data can comprise the first attribute data, each first attribute data corresponds to one index in the first preset array.
The second attribute data changes in different data to be described, which means that the attribute value in the second attribute data changes, but the attribute name does not change. Therefore, after the standard attribute names in the second standard attribute data are stored as the second preset array, as the attribute names can be included in the standard attribute names, each attribute name has a corresponding index in the second preset array.
In some embodiments, the standard attribute data may be stored as an array, that is, the standard attribute names in the first standard attribute data and the second standard attribute data are stored in the same array. For example, the first standard attribute data and the standard attribute name are stored in a specified array, and the first standard attribute data and the standard attribute name each have a corresponding index in the specified array. In determining the first index and the second index, it may be that the first index corresponds to the first attribute data and the second index corresponds to the attribute name in the second attribute data are determined based on the specified array.
The first preset array and the second preset array will be described in detail below.
In one embodiment, when the first index is obtained according to the index of the first attribute data in the first preset array, the index of the first attribute data in the first preset array may be directly used as the first index.
As an implementation manner, when the first index is obtained according to the index of the first attribute data in the first preset array, the first number of the first standard attribute data may be obtained, and an initial array with the first number of elements is established; determining the index of the first attribute data in the first preset array to obtain candidate indexes; and mapping the candidate indexes into the initial array based on an index mapping relation to obtain the first index, wherein the index mapping relation comprises a mapping relation between indexes in the initial array and indexes in a first preset array.
The first number refers to the total number of the first standard attribute data, and after the total number of the first standard attribute data is acquired, an initial array having a first number of elements may be established. For example, the first number is 10, which means that the number of the first standard attribute data is 10, and then the initial data is an array having 10 elements.
The index mapping relationship refers to a mapping relationship between an index in the initial array and an index in the first preset array, and the index mapping relationship may be preset and stored. For example, the index mapping relationship may specifically be that the index i in the initial array corresponds to the index i in the first preset array, and for example, the index mapping relationship may also be that the index i in the initial array corresponds to the index i-1 in the first preset array. Specifically, the index mapping relationship may be set according to actual needs, which is not specifically limited herein.
Based on the index mapping relationship, any index in the first preset array can be mapped to the initial array. Based on the first attribute data in the SDP data, an index of the first attribute data in the first preset array may be determined, and for convenience of description, the index of the first attribute data in the first preset array is referred to as a candidate index. Then, based on the index mapping relation, the candidate index can be mapped into the initial array to obtain a first index. The candidate index and the first index are both indicated by the same data.
In one embodiment, when the second index is obtained according to the index of the attribute name in the second attribute data in the second preset array, the index of the attribute name in the second attribute data in the first preset array may be directly used as the second index.
The index may be represented in the form of a specific character or number, or may be a position in an array. For example, when the first index is an index in the first preset array, the first index may be a specific number or character; the first index, when the index is in the initial array, may be represented as a position in the initial array; the second index may be a specific number or character.
S130, replacing the first attribute data in the session description protocol data with the first index, and replacing the attribute name with the second index to obtain compressed data of the session description protocol data.
Wherein the first index may characterize the first attribute data and the second index may characterize the attribute names in the second attribute data. Therefore, the first index can be used for replacing the first attribute data in the SDP data, and the second index can be used for replacing the attribute name in the second attribute data in the SDP data, so that the compressed data corresponding to the SDP data is obtained.
In some embodiments, the first index may be used to replace the first attribute data to obtain first compressed data; replacing the attribute names in the second attribute data by using the second index to obtain the second compressed data; and determining the first compressed data and the second compressed data as the compressed data of the session description protocol data.
The first index may characterize the first attribute data, whereby the first index may be used to replace the first attribute data, with the replaced first attribute data as the first compressed data. The second index may characterize an attribute name in the second attribute data, and thus, the index name in the second attribute data may be replaced with the second index, and the replaced second attribute data may be regarded as second compressed data.
That is, after replacing the first attribute data with the first index, the first attribute data may be converted into first indices, each of which is a first compressed data. After replacing the attribute names in the second attribute data with the second indices, the attribute names in each of the second attribute data may be converted into the second indices, and then a second index and attribute value form a second compressed data. It follows that the first compressed data corresponds to the first attribute data and the second compressed data corresponds to the second attribute data, and thus the first compressed data and the second compressed data constitute compressed data of the SDP data.
In one embodiment, if the first index is an index in the first preset array, the first index may be directly used to replace the first attribute data to obtain the first compressed data. For example, the first attribute data in the SDP data are A, B, C, where a first index corresponding to a is marked as 2, and indicates the 2 nd element in the first preset array; the first index corresponding to B is marked as 4 and indicates the 4 th element in the first preset array; the first index corresponding to C is marked as 1, indicating the 1 st element in the first preset array. Thus, the first compressed data corresponding to a is 5, the first compressed data corresponding to b is 4, the first compressed data corresponding to c is 8, and the first compressed data corresponding to d is 10.
In some embodiments, the first index is an index in the initial array, so that in order to make the first compressed data have a smaller volume and achieve a better compression effect, the elements in the initial array may be set to obtain the first compressed data. For example, in the initial array, setting an element corresponding to the first index as the first state parameter; acquiring other indexes except the first index in the initial array; setting elements corresponding to the other indexes as the second state parameters to obtain a target array, and taking the target array as the first compressed data.
The initial array is an array established based on the number of the first standard attribute data, and the number of the elements which can be accommodated is the same as the number of the first standard attribute data. When setting elements in the initial array, the elements corresponding to the first index and the elements corresponding to the other indexes can be set to different state parameters so as to distinguish the elements corresponding to the first index and the other indexes.
For example, in the initial array, the element corresponding to the first index is set as a first state parameter, and the elements corresponding to the other indexes are set as a second state parameter. Since the first index may indicate the first attribute data, the first state parameter may thus indicate that the first attribute data indicated by the first index is present in the SDP data, and the second state parameter may indicate that the first attribute data indicated by the other index is not present in the SDP data.
After setting the elements in the initial array as the first state parameter or the second state parameter, the target array can be obtained. Wherein the first state parameter may be 1 and the second state parameter may be 0. For example, referring to FIG. 1d, a schematic diagram of obtaining first compressed data is shown. The arrows in front of the first preset array and the target array represent the index mapping relationship, that is, the indexes in the first preset array are in one-to-one correspondence with the indexes in the target array, wherein the sequence of the lattices occupied by the elements is the index. If the first attribute data is rtcp-fb:127nack, the candidate index of the first attribute data in the first preset array is the position of the dashed frame in the first preset array, so that the element corresponding to the corresponding first index, that is, the element at the position of the dashed frame in the target array, may be set to "1", and the target array includes all the first compressed data.
In one embodiment, when the initial array is created, if the initial array is a null array, the element corresponding to the target index may be set as a first state parameter, and the elements corresponding to the other indexes may be set as a second state parameter, so that an array composed of the first state parameter and the second state parameter may be obtained, that is, the target array. For example, the initial data is { null, null, null, null, null }, the first state parameter is "1", the second state parameter is 0, 5 elements may be included in the initial array, the target indexes are 2 and 4, and represent the 2 nd element and the 4 th element in the initial array, then after the first state parameter is set, the initial array may be changed to { null,1, null }, after the elements corresponding to the other indexes are set to the second state parameter, the obtained target array is {0,1,0,1,0}, and the target array contains all the first compressed data.
In one embodiment, when the initial array is created, if each element in the initial array is the first state parameter, the elements corresponding to the target index may be kept unchanged, and the elements corresponding to the other indexes are set as the second state parameters, so as to obtain the target array. As previously mentioned, the initial array may be {1, 1}, leaving the elements of the target indices 2 and 4 unchanged, setting the elements corresponding to the other indices as the second state parameter, and the resulting target array is {0,1,0,1,0}.
In one embodiment, when the initial array is created, if each element in the initial array is the second state parameter, the element corresponding to the target index may be set as the first state parameter, and the elements corresponding to the other indexes are kept unchanged, so as to obtain the target array. As previously mentioned, the initial array may be {0, 0}, with the elements of the target indices 2 and 4 set as the first state parameter, leaving the elements corresponding to the other indices unchanged, resulting in a target array of {0,1,0,1,0}.
And replacing the attribute names in the second attribute data by using the second index to obtain second compressed data, wherein each second attribute data can be split into the attribute names and the corresponding attribute values. As an embodiment, a preset character in the second attribute data may be detected; and splitting the second attribute data into attribute names and attribute values based on the preset characters.
For example, the preset characters are ": the second attribute data is "a=ice-ufrag: abcdefg", where "ice-ufrag" is the attribute name and "abcdefg" is the attribute value.
And then replaces the attribute name with the second index, the second compressed data may be obtained. In the foregoing example, if the second index corresponding to the attribute name is i, the second index i and the attribute value "abcdefg" may be stored in association to obtain the second compressed data.
In some embodiments, in order to further obtain a better compression effect, a second index is used to replace an attribute name in second attribute data, and when the second compressed data is obtained, the length of the attribute value in the second attribute data may also be obtained; and storing the second index, the attribute value and the length of the attribute value in an associated mode to obtain the second compressed data. The attribute value refers to a binary format attribute value, and the length of the attribute value may be obtained based on the attribute value, for example, in the foregoing example, the attribute value is "abcdefg", and the length is 7, so that the second index, the length of the attribute value, and the attribute value may be stored together in an associated manner, to obtain the second compressed data.
For example, referring to FIG. 1e, a schematic diagram of obtaining second compressed data is shown. The arrow between the second preset array and the second compressed data represents the data in the second preset array indicated by the second index. The second index, the length of the attribute value and the attribute value are stored in a dynamic key value table in an associated mode, namely id is the second index, len is the length of the attribute value, and data is the binary representation of the attribute value. If the second attribute data is ice-ufrag:xxxx, the second index i indicates the attribute name ice-ufrag, l i The length of the attribute value corresponding to the ice-urfag is represented, xxxx represents the attribute value corresponding to the ice-urfag, and the dynamic key value table contains all second compressed data.
In the actual processing, the plurality of attribute data may be divided into first attribute data and second attribute data, and the first attribute data is compressed by using a corresponding first index, and the second attribute data is compressed by using a corresponding second index, so as to compress all the attribute data.
And S140, transmitting the compressed data of the session description protocol data to a second terminal so that the first terminal and the second terminal establish a communication session based on the compressed data.
The second terminal is an opposite terminal which needs to establish a communication session with the first terminal, and the first terminal is based on the first compressed data and the second compressed data obtained in the mode, which are compressed data corresponding to SDP data. The SDP data describes basic information, data transmission method, audio/video coding/decoding information, encryption/decryption method and other information of the communication session in a character string-based mode, and generally, the communication double-end can contain various types of audio/video coding/decoding methods and has corresponding additional transmission control mode information, so that the content in the SDP data is relatively lengthy, generally more than 6KB can be achieved, the maximum transmission unit (Maximum Transmission Unit, MTU) in a UDP link is exceeded, the SDP data cannot be directly transmitted through UDP, and the transmission is limited.
By adopting the data transmission method of the embodiment of the application, the SDP data is compressed based on the index, a large amount of calculation is not needed, the compression speed is high, the effect is good, and the size of the compressed SDP data is usually smaller than 1KB. Thus, the compressed SDP data may interact through various UDP-based transport protocols, including: UDP, STUN, RTP, RTCP, SRTP, SRTCP, etc., and may also improve transmission efficiency in other transmission protocols, such as TCP, HTTP, HTTPS, QUIC, webSocket, dataChannel, etc., due to the smaller size of the compressed SDP data. So that the second terminal can perform corresponding processing according to the received compressed data of the SDP data in order to establish a communication session with the first terminal.
The data transmission scheme provided by the embodiment of the application can be applied to various scenes for transmitting SDP data. For example, taking live video and video communication as an example, the scheme provided by the embodiment of the application is adopted, the SDP data is divided into the first attribute data and the second attribute data based on the grammar of the SDP data, and the compression of the SDP data is rapidly and effectively realized based on the index, so that the volume of the SDP data is greatly reduced, the start-up delay can be reduced in the field of live video cloud, and the time length for establishing video communication can be reduced in video communication.
According to the method provided by the embodiment of the application, according to the specification of the session description protocol, a first index corresponding to the first attribute data is determined, a second index corresponding to the second attribute data is determined, wherein the first index represents the first attribute data, the second index represents the attribute name in the second attribute data, the first index is used for replacing the first attribute data, and the second index is used for replacing the attribute name, so that the compressed data of the SDP data are obtained. Based on the specification of SDP, the first index and the second index can be quickly queried, the corresponding content in SDP data is directly replaced by the first index and the second index, and quick and effective compression of SDP data can be realized without a large amount of computation, so that the volume of SDP data can be effectively reduced, and the transmission of SDP data is facilitated.
In this embodiment, a data transmission method is provided and may be applied to a second terminal, as shown in fig. 2a, where a specific flow of the data transmission method may include the following steps: s210 to S230.
S210, receiving compressed data of session description protocol data sent by a first terminal, wherein the compressed data comprises a first index, a second index and an attribute value associated with the second index.
As described in the foregoing embodiments, the compressed data of the session description protocol data refers to data obtained by compressing the session description protocol data. After the first terminal compresses the session description protocol data, compressed data of the session description protocol data is obtained, and then the compressed data is sent to the second terminal, so that the second terminal can receive the compressed data of the session description protocol.
Since the first terminal replaces the first attribute data with the first index and replaces the attribute name in the second attribute data with the second index when compressing the session protocol description data, the compressed data may include the first index, the second index and the attribute value associated with the second index. Wherein the first index may characterize the first attribute data and the second index characterizes the attribute names in the second attribute data.
S220, determining the first attribute data corresponding to the first index and the attribute name corresponding to the second index according to the specification of the session description protocol data.
As described in the foregoing embodiment, based on the specification of the session description protocol data, the first index corresponding to the first attribute data and the second index corresponding to the second attribute data may be determined. Similarly, the first attribute data corresponding to the first index and the attribute name corresponding to the second index may also be determined based on the specification of the session description protocol data.
In some embodiments, the process may include the steps of: acquiring first standard attribute data and second standard attribute data according to the specification of the session description protocol data; storing the first standard attribute data as a first preset array, and storing the standard attribute names in the second standard attribute data as a second preset array; determining data indicated by the first index in the first preset array to obtain first attribute data; and determining the data indicated by the second index in the second preset array to obtain the attribute name.
Similarly to the above compressed data, a first preset array and a second preset array are also required to be acquired, where the first preset array stores the first standard attribute data, and the second preset array stores the attribute names in the second standard attribute data. The first preset array and the second preset array are the same as those used in the compression.
In one embodiment, if the first index is an index in the first preset array, the data indicated by the first index in the first preset array may be directly determined, so as to obtain the first attribute data.
As one implementation manner, the compressed data further includes a first state parameter in a target array, and when determining the first attribute data corresponding to the first index, determining the first index of the first state parameter in the target array may be; determining the candidate index corresponding to the first index based on an index mapping relation, wherein the index mapping relation comprises a mapping relation between the index in the target array and the index in a first preset array; and determining the data indicated by the candidate indexes in the first preset array to obtain the first attribute data.
The compressed data comprises a first state parameter in the target array, so that the index of the first state parameter in the target array can be obtained to obtain a first index; and then mapping the first index into a first preset array based on the index mapping relation to obtain a candidate index corresponding to the first index, and determining first standard attribute data indicated in the first preset array of the candidate index as corresponding first attribute data.
For example, referring to fig. 1d, the element indicated by the dashed box of the target array is "1", which indicates that the first standard attribute data indicated by the first index exists in the SDP data, so that, based on the index mapping relationship, the candidate index corresponding to the first index, that is, the position indicated by the dashed box in the first preset array, can be determined, and then the first standard data "rtcp-fb:127nack" indicated by the candidate index is determined as the first attribute data. Based on this approach, all of the first attribute data may be restored.
As an implementation manner, the second index is an index in the second preset array, and data indicated by the second index in the second preset array can be directly determined to obtain an attribute name in the second attribute data.
S230, replacing the first index in the compressed data with the first attribute data, and replacing the second index with the attribute name, so as to obtain the session description protocol data.
In order to restore the data before compression, the first index in the compressed data may be replaced with the corresponding first attribute data, and the second index in the compressed data may be replaced with the corresponding attribute name, so as to restore the corresponding second attribute data.
In some embodiments, the process may include: replacing the first index with the first attribute data to obtain first attribute data; replacing the second index with the attribute name, and splicing the attribute name and the attribute value to obtain the second attribute data; and determining the first attribute data and the second attribute data as the session description protocol data.
In some embodiments, when the first attribute data is obtained by replacing the first index with the first attribute data, the first attribute data indicated by the first index may be restored by directly replacing the first index with the first attribute data.
In some embodiments, the attribute name is used to replace the second index, and the attribute name and the attribute value are spliced to obtain the second attribute data, which may be that the attribute name and the attribute value indicated by the second index are spliced together to restore the second attribute data.
In some embodiments, the compressed data may further include a length of the attribute value and an attribute value expressed in binary, where when the second attribute data is obtained, the original attribute value may be restored based on the length of the attribute value and the attribute value expressed in binary, and then the restored attribute value and the corresponding attribute name are spliced to obtain the second attribute data.
For example, referring to fig. 1e, all the second compressed data are stored in the dynamic key value table, when restoring the second attribute data corresponding to the dashed line frame in the dynamic key value table, the corresponding attribute name in the second preset array may be determined based on the second index i, that is, the content "ice-ufrag" indicated by the dashed line frame in the second preset array, and then the length "l" of the attribute value is combined i And splicing the sum attribute value xxxxxx to obtain second attribute data of 'ice-ufrag: xxxx'. In this way, all the second attribute data can be restored.
And after decompressing the compressed data of the session protocol description data, the second terminal can obtain the session protocol description data. The second terminal can draw data according to the session protocol and perform corresponding setting, then the second terminal can also generate session protocol description data, compress the generated session protocol description data in the same way, and then retransmit the compressed data to the first terminal so that the first terminal decompresses the received compressed data, restores the session protocol description data generated by the second terminal, and performs corresponding setting, thereby establishing a communication session between the first terminal and the second terminal.
The embodiment of the application provides a data transmission method, which can acquire compressed data of session protocol description data, wherein the compressed data comprises a first index, a second index and an attribute value associated with the second index; determining attribute names corresponding to first attribute data corresponding to a first index and a second index based on specifications of session protocol description data; and then, replacing the first index with the first attribute data, and replacing the second index with the attribute name to realize decompression of the compressed data and restore the session protocol description data before compression. The corresponding content is directly inquired by utilizing the first index and the second index, and the corresponding first index and second index in the compressed data are replaced, so that the decompression of the compressed data is realized, a large amount of calculation is not needed, the quick and efficient decompression can be realized, the compressed data sent by the first terminal is received, the compressed data is smaller in volume and quick to transmit, and the establishment speed of the communication session can be further accelerated.
The method described in the above embodiments will be described in further detail below.
WebRTC is a real-time communication technology that allows web applications or sites to establish point-to-point connections between browsers without the aid of intermediaries, enabling the transmission of video streams, audio streams, or any other data. In WebRTC, the communicating parties typically negotiate SDP data for use in subsequent transmissions during the connection phase. In this embodiment, a method of the embodiment of the present application will be described in detail taking an example of setting up a communication session connection using SDP in WebRTC.
As shown in fig. 3a, a specific flow of a data transmission method is as follows:
s310, the first terminal generates request session protocol description data, where the request session protocol description data includes a plurality of attribute data for describing a communication session, and the plurality of attribute data includes first attribute data and second attribute data.
S320, the first terminal determines a first index corresponding to the first attribute data and a second index corresponding to the second attribute data according to the specification of the session description protocol data.
S330, the first terminal replaces the first attribute data in the request session description protocol data with the first index and replaces the attribute name with the second index to obtain compressed data of the request session description protocol data, and sends the compressed data of the request session description protocol data to the second terminal.
S340, the second terminal obtains the compressed data of the request session description protocol data, wherein the compressed data comprises a first index, a second index and an attribute value associated with the second index.
S350, the second terminal determines the first attribute data corresponding to the first index and the attribute name corresponding to the second index according to the specification of the session description protocol data.
S360, the second terminal replaces the first index in the compressed data with the first attribute data and replaces the second index with the attribute name, so as to obtain the request session description protocol data and set.
And S370, the second terminal generates and compresses the response session description protocol data and sends the compressed data of the response session description protocol data to the first terminal.
S380, the first terminal acquires the compressed data of the response session description protocol data, and decompresses and restores the compressed data to the response session description protocol data.
The contents of S310 to S380 may refer to the description in the foregoing embodiments, and also refer to fig. 3b, which shows an interaction diagram of the compressed SDP data, and a detailed description of the solution of the embodiment of the present application will be provided below with reference to fig. 3 b.
For example, when the first terminal and the second terminal perform video communication, a video communication link needs to be established. And generating the request SDP data by the first terminal, and compressing the request SDP data to obtain compressed request SDP data. For example, referring to fig. 3c, a schematic diagram of compression of SDP data is shown, where the compressed SDP data may be obtained by compressing the SDP data in the format shown in fig. 3 c.
The compression processing process specifically may include determining a first index corresponding to the first attribute user number and a second index corresponding to the second attribute data based on a specification of the SDP data; and then using the first index to replace the first attribute data, and using the second index to replace the attribute name in the second attribute data to obtain the compressed data of the request SDP data.
The first terminal then sends compressed data requesting SDP data to the second terminal. Since the compressed data of the requested SDP data is transmitted, the data volume is effectively reduced and the MTU of the link is not exceeded, and thus, various transmission methods, for example, TCP, HTTP, QUIC, UDP, STUN, RTCP, can be used when transmitting the compressed data of the requested SDP data.
The second terminal, upon receiving the compressed data of the requested SDP data, needs to restore it to the requested SDP data in order to process based on the requested SDP data and configure the communication environment. When the second terminal restores the SDP data, the attribute names in the first attribute data corresponding to the first index and the second attribute data corresponding to the second index can be determined based on the specification of the SDP data; and then restoring the first index into first attribute data and restoring the second index into attribute names to realize decompression of the compressed data so as to obtain the request SDP data.
After the second terminal processes the request SDP data, it can generate the response SDP data, and uses the same data compression mode to compress the response SDP data, and uses the same transmission mode to send the compressed data of the response SDP data to the first terminal.
After receiving the compressed data of the response SDP data, the first terminal adopts the same decompression method to restore the response SDP data, and carries out corresponding processing to establish video communication connection between the first terminal and the second terminal.
Referring to fig. 3d, an interaction diagram of original SDP data is shown, in the original SDP data interaction, the SDP data is not compressed, so that the transmitted SDP still has a larger size, and the transmission of the SDP data cannot be limited in a transmission manner based on UDP.
In the embodiment of the application, in the process of establishing a communication session between two communication parties, the data transmission method is used for compressing SDP data and transmitting the compressed data to the opposite end, the opposite end can decompress the compressed data to restore the data after receiving the compressed data and correspondingly process the compressed data based on the restored data, and the compressed SDP data has smaller volume and can be suitable for various transmission modes, such as a transmission mode based on UDP, and can also improve the data transmission efficiency, thereby further reducing the time consumption of the communication session establishment stage and effectively reducing the first frame multicast delay in the fields of video communication and video live broadcast.
In order to better implement the above method, the embodiment of the application also provides a data transmission device, which can be specifically integrated in an electronic device, and the electronic device can be a terminal, a server or the like. The terminal can be a mobile phone, a tablet personal computer, an intelligent Bluetooth device, a notebook computer, a personal computer and other devices; the server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms. The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal and the server may be directly or indirectly connected through wired or wireless communication, which is not limited herein.
For example, in the present embodiment, a method of the embodiment of the present application will be described in detail by taking a specific integration of a data transmission device in a terminal as an example.
For example, as shown in fig. 4a, the data transmission apparatus 400 may include a data acquisition module 410, an index determination module 420, and a compression module 430.
A data acquisition module 410 configured to acquire session description protocol data, where the session description protocol data includes a plurality of attribute data for describing a communication session, the plurality of attribute data including first attribute data and second attribute data, the first attribute data being unchanged in different communication sessions, the second attribute data including an attribute name and an attribute value, the attribute value being changed in different communication sessions;
an index determining module 420, configured to determine, according to a specification of the session description protocol data, a first index corresponding to the first attribute data and a second index corresponding to the second attribute data, where the first index characterizes the first attribute data, and the second index characterizes the attribute name in the second attribute data;
a compression module 430, configured to replace the first attribute data in the session description protocol data with the first index, and replace the attribute name with the second index, so as to obtain compressed data of the session description protocol data;
And a transmission module 440, configured to send compressed data of the session description protocol data to a second terminal, so that the first terminal and the second terminal establish a communication session based on the compressed data.
In some embodiments, the index determination module 420 further includes:
an obtaining unit, configured to obtain first standard attribute data and second standard attribute data according to the specification of the session description protocol data;
the storage unit is used for storing the first standard attribute data as a first preset array and storing the standard attribute names in the second standard attribute data as a second preset array;
a first index determining unit, configured to obtain the first index according to the index of the first attribute data in the first preset array;
and a second index determining unit, configured to obtain the second index according to the index of the attribute name in the second attribute data in the second preset array.
In some embodiments, the first index determination unit is further configured to:
acquiring a first number of the first standard attribute data, and establishing an initial array with the first number of elements;
determining the index of the first attribute data in the first preset array to obtain candidate indexes;
And mapping the candidate indexes into the initial array based on an index mapping relation to obtain the first index, wherein the index mapping relation comprises a mapping relation between indexes in the initial array and indexes in a first preset array.
In some embodiments, compression module 430 further includes:
the first compression unit is used for replacing the first attribute data by using the first index to obtain first compressed data;
a first compression unit, configured to replace the attribute name in the second attribute data with the second index, to obtain the second compressed data;
and the compressed data determining unit is used for determining the first compressed data and the second compressed data as the compressed data of the session description protocol data.
In some embodiments, the first index is an index in an initial array, and the first compression unit is further configured to:
setting an element corresponding to the first index as the first state parameter in the initial array;
acquiring other indexes except the first index in the initial array;
setting elements corresponding to the other indexes as the second state parameters to obtain a target array, and taking the target array as the first compressed data.
In some embodiments, the second compression unit is further configured to:
acquiring the length of the attribute value in the second attribute data;
and storing the second index, the attribute value and the length of the attribute value in an associated mode to obtain the second compressed data.
In the implementation, each module or unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiments and will not be described herein.
As can be seen from the above, the data transmission device of this embodiment may determine, according to the specification of the session description protocol, a first index corresponding to the first attribute data, and determine a second index corresponding to the second attribute data, where the first index characterizes the first attribute data, the second index characterizes an attribute name in the second attribute data, and then replace the first attribute data with the first index, and replace the attribute name with the second index, so as to obtain compressed data of the SDP data. Based on the specification of SDP, the first index and the second index can be quickly queried, the corresponding content in SDP data is directly replaced by the first index and the second index, and quick and effective compression of SDP data can be realized without a large amount of computation, so that the volume of SDP data can be effectively reduced, and the transmission of SDP data is facilitated.
In order to better implement the above method, the embodiment of the application also provides a data transmission device, which can be specifically integrated in an electronic device, and the electronic device can be a terminal, a server or the like. The terminal can be a mobile phone, a tablet personal computer, an intelligent Bluetooth device, a notebook computer, a personal computer and other devices; the server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms. The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal and the server may be directly or indirectly connected through wired or wireless communication, which is not limited herein.
For example, in the present embodiment, a method of the embodiment of the present application will be described in detail by taking a specific integration of a data transmission device in a terminal as an example.
For example, as shown in fig. 4b, the data transmission apparatus 500 may include a compressed data receiving module 510, a data determining module 520, and a decompressing module 530.
A compressed data receiving module 510, configured to receive compressed data of session description protocol data sent by a first terminal, where the compressed data includes a first index, a second index, and an attribute value associated with the second index, the first index represents first attribute data, and the second index represents an attribute name in the second attribute data;
a data determining module 520, configured to determine, according to the specification of the session description protocol data, the first attribute data corresponding to the first index and the attribute name corresponding to the second index;
a decompression module 530, configured to replace the first index in the compressed data with the first attribute data and replace the second index with the attribute name, so as to obtain the session description protocol data, so that the first terminal and the second terminal establish a communication session based on the session description protocol data.
In some embodiments, the data determination module 520 further comprises:
an obtaining unit, configured to obtain first standard attribute data and second standard attribute data according to the specification of the session description protocol data;
The storage unit is used for storing the first standard attribute data as a first preset array and storing the standard attribute names in the second standard attribute data as a second preset array;
a first data determining unit, configured to determine data indicated by the first index in the first preset array, to obtain first attribute data;
and a second data determining unit, configured to determine data indicated by the second index in the second preset array, and obtain the attribute name.
In some embodiments, the compressed data further includes a first state parameter in the target array, the first data determination unit further configured to:
determining a first index of the first state parameter in the target array;
determining the candidate index corresponding to the first index based on an index mapping relation, wherein the index mapping relation comprises a mapping relation between the index in the target array and the index in a first preset array;
and determining the data indicated by the candidate indexes in the first preset array to obtain the first attribute data.
In some embodiments, decompression module 530 further comprises:
a first decompression unit, configured to replace the first index with the first attribute data to obtain first attribute data;
The second decompression unit is used for replacing the second index by using the attribute name and splicing the attribute name and the attribute value to obtain the second attribute data;
and a decompressed data determination unit that determines the first attribute data and the second attribute data as the session description protocol data.
In the implementation, each module or unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiments and will not be described herein.
As can be seen from the above, the data transmission device of the present embodiment may obtain compressed data of the session protocol description data, where the compressed data includes a first index, a second index, and an attribute value associated with the second index; determining attribute names corresponding to first attribute data corresponding to a first index and a second index based on specifications of session protocol description data; and then, replacing the first index with the first attribute data, and replacing the second index with the attribute name to realize decompression of the compressed data and restore the session protocol description data before compression. The corresponding content is directly inquired by utilizing the first index and the second index, and the corresponding first index and second index in the compressed data are replaced, so that the compressed data can be decompressed, and the rapid and efficient decompression can be realized without performing a large amount of computation.
The embodiment of the application also provides electronic equipment which can be a terminal, a server and other equipment. The terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer and the like; the server may be a single server, a server cluster composed of a plurality of servers, or the like.
In this embodiment, a detailed description will be given taking an example in which the electronic device of this embodiment is a terminal or a server, for example, as shown in fig. 5, which shows a schematic structural diagram of the electronic device according to the embodiment of the present application, specifically:
the electronic device may include one or more processing cores 'processors 601, one or more computer-readable storage media's memory 602, a power supply 603, an input module 604, and a communication module 605, among other components. It will be appreciated by those skilled in the art that the electronic device structure shown in fig. 5 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components. Wherein:
the processor 601 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 602, and invoking data stored in the memory 602. In some embodiments, processor 601 may include one or more processing cores; in some embodiments, processor 601 may integrate an application processor that primarily handles operating systems, user interfaces, applications, and the like, with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 601.
The memory 602 may be used to store software programs and modules, and the processor 601 may execute various functional applications and data processing by executing the software programs and modules stored in the memory 602. The memory 602 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the electronic device, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide access to the memory 602 by the processor 601.
The electronic device also includes a power supply 603 that powers the various components, and in some embodiments, the power supply 603 may be logically connected to the processor 601 through a power management system, so as to perform functions of managing charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more of any components, such as a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The electronic device may also include an input module 604, which input module 604 may be used to receive entered numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
The electronic device may also include a communication module 605, and in some embodiments the communication module 605 may include a wireless module, through which the electronic device may wirelessly transmit over short distances, thereby providing wireless broadband internet access to the user. For example, the communication module 605 may be used to assist a user in e-mail, browsing web pages, accessing streaming media, and the like.
Although not shown, the electronic device may further include a display unit or the like, which is not described herein. In particular, in this embodiment, the processor 601 in the electronic device loads executable files corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and the processor 601 executes the application programs stored in the memory 602, so as to implement various functions as follows:
acquiring session description protocol data, wherein the session description protocol data comprises a plurality of attribute data for describing communication sessions, the plurality of attribute data comprises first attribute data and second attribute data, the first attribute data is unchanged in different communication sessions, and the second attribute data comprises attribute names and attribute values, and the attribute values are changed in different communication sessions;
Determining a first index corresponding to the first attribute data and a second index corresponding to the second attribute data according to the specification of the session description protocol data, wherein the first index represents the first attribute data, and the second index represents the attribute name in the second attribute data;
replacing the first attribute data in the session description protocol data with the first index, and replacing the attribute name with the second index to obtain compressed data of the session description protocol data;
and transmitting compressed data of the session description protocol data to a second terminal so that the first terminal and the second terminal establish a communication session based on the compressed data.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
From the above, the electronic device may obtain the specification according to the session description protocol, determine the first index corresponding to the first attribute data, determine the second index corresponding to the attribute name in the second attribute data, replace the first attribute data with the first index, and replace the attribute name with the second index to obtain the compressed data of the SDP data. Based on the specification of SDP, the first index and the second index can be quickly queried, the corresponding content in SDP data is directly replaced by the first index and the second index, the SDP data can be quickly and effectively compressed without a large amount of calculation, the volume of the SDP data can be quickly and effectively reduced, and the transmission of the SDP data is facilitated.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer readable storage medium having stored therein a plurality of instructions capable of being loaded by a processor to perform steps in any of the data transmission methods provided by the embodiments of the present application. For example, the instructions may perform the steps of:
acquiring session description protocol data, wherein the session description protocol data comprises a plurality of attribute data for describing communication sessions, the plurality of attribute data comprises first attribute data and second attribute data, the first attribute data is unchanged in different communication sessions, and the second attribute data comprises attribute names and attribute values, and the attribute values are changed in different communication sessions;
determining a first index corresponding to the first attribute data and a second index corresponding to the second attribute data according to the specification of the session description protocol data, wherein the first index represents the first attribute data, and the second index represents the attribute name in the second attribute data;
Replacing the first attribute data in the session description protocol data with the first index, and replacing the attribute name with the second index to obtain compressed data of the session description protocol data;
and transmitting compressed data of the session description protocol data to a second terminal so that the first terminal and the second terminal establish a communication session based on the compressed data.
Wherein the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the methods provided in various alternative implementations of the data compression aspect or the data decompression aspect provided in the above-described embodiments.
The steps in any data transmission method provided in the embodiments of the present application may be executed by the instructions stored in the storage medium, so that the beneficial effects that any data transmission method provided in the embodiments of the present application may be achieved are detailed in the previous embodiments, and are not repeated herein.
The foregoing has described in detail a data transmission method, apparatus, electronic device, storage medium and program product provided in the embodiments of the present application, and specific examples have been applied to illustrate the principles and embodiments of the present application, where the foregoing description of the embodiments is only for aiding in understanding the method and core idea of the present application; meanwhile, those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present application, and the present description should not be construed as limiting the present application in view of the above.
Claims (15)
1. A data transmission method, applied to a first terminal, the method comprising:
acquiring session description protocol data, wherein the session description protocol data comprises a plurality of attribute data for describing communication sessions, the plurality of attribute data comprises first attribute data and second attribute data, the first attribute data is unchanged in different communication sessions, and the second attribute data comprises attribute names and attribute values, and the attribute values are changed in different communication sessions;
determining a first index corresponding to the first attribute data and a second index corresponding to the second attribute data according to the specification of the session description protocol data, wherein the first index represents the first attribute data, and the second index represents the attribute name in the second attribute data;
Replacing the first attribute data in the session description protocol data with the first index, and replacing the attribute name with the second index to obtain compressed data of the session description protocol data;
and transmitting compressed data of the session description protocol data to a second terminal so that the first terminal and the second terminal establish a communication session based on the compressed data.
2. The method according to claim 1, wherein determining a first index corresponding to the first attribute data and a second index corresponding to the second attribute data according to the specification of the session description protocol data comprises:
acquiring first standard attribute data and second standard attribute data according to the specification of the session description protocol data;
storing the first standard attribute data as a first preset array, and storing the standard attribute names in the second standard attribute data as a second preset array;
obtaining a first index according to the index of the first attribute data in the first preset array;
and obtaining the second index according to the index of the attribute name in the second attribute data in the second preset array.
3. The method according to claim 2, wherein the obtaining the first index according to the index of the first attribute data in the first preset array includes:
acquiring a first number of the first standard attribute data, and establishing an initial array with the first number of elements;
determining the index of the first attribute data in the first preset array to obtain candidate indexes;
and mapping the candidate indexes into the initial array based on an index mapping relation to obtain the first index, wherein the index mapping relation comprises a mapping relation between indexes in the initial array and indexes in a first preset array.
4. The method of claim 1, wherein replacing the first attribute data in the session description protocol data with the first index and replacing the attribute name with the second index results in compressed data of the session description protocol data, comprising:
replacing the first attribute data with the first index to obtain first compressed data;
replacing the attribute names in the second attribute data by using the second index to obtain the second compressed data;
And determining the first compressed data and the second compressed data as the compressed data of the session description protocol data.
5. The method of claim 4, wherein the first index is an index in an initial array, and wherein replacing the first attribute data with the first index results in first compressed data, comprising:
setting an element corresponding to the first index as the first state parameter in the initial array;
acquiring other indexes except the first index in the initial array;
setting elements corresponding to the other indexes as the second state parameters to obtain a target array, and taking the target array as the first compressed data.
6. The method of claim 4, wherein said replacing the attribute name in the second attribute data with the second index results in the second compressed data, comprising:
acquiring the length of the attribute value in the second attribute data;
and storing the second index, the attribute value and the length of the attribute value in an associated mode to obtain the second compressed data.
7. A data de-transmission method, applied to a second terminal, comprising:
Receiving compressed data of session description protocol data sent by a first terminal, wherein the compressed data comprises a first index, a second index and attribute values associated with the second index, the first index represents the first attribute data, and the second index represents attribute names in the second attribute data;
determining the first attribute data corresponding to the first index and the attribute name corresponding to the second index according to the specification of the session description protocol data;
and replacing the first index in the compressed data with the first attribute data and replacing the second index with the attribute name to obtain the session description protocol data, so that the first terminal and the second terminal establish a communication session based on the session description protocol data.
8. The method of claim 7, wherein determining the first attribute data corresponding to the first index and the attribute name corresponding to the second index according to the specification of the session description protocol data comprises:
acquiring first standard attribute data and second standard attribute data according to the specification of the session description protocol data;
Storing the first standard attribute data as a first preset array, and storing the standard attribute names in the second standard attribute data as a second preset array;
determining data indicated by the first index in the first preset array to obtain first attribute data;
and determining the data indicated by the second index in the second preset array to obtain the attribute name.
9. The method of claim 8, wherein the compressed data further includes a first state parameter in a target array, and wherein the determining the data indicated by the first index in the first preset array, to obtain the first attribute data, includes:
determining a first index of the first state parameter in the target array;
determining candidate indexes corresponding to the first indexes based on index mapping relations, wherein the index mapping relations comprise mapping relations between indexes in the target array and indexes in a first preset array;
and determining the data indicated by the candidate indexes in the first preset array to obtain the first attribute data.
10. The method of claim 7, wherein replacing the first index in the compressed data with the first attribute data and replacing the second index with the attribute name results in the session description protocol data, comprising:
Replacing the first index with the first attribute data to obtain first attribute data;
replacing the second index with the attribute name, and splicing the attribute name and the attribute value to obtain the second attribute data;
and determining the first attribute data and the second attribute data as the session description protocol data.
11. A data transmission apparatus for use with a first terminal, the apparatus comprising:
a data acquisition module configured to acquire session description protocol data, the session description protocol data including a plurality of attribute data for describing a communication session, the plurality of attribute data including first attribute data and second attribute data, the first attribute data being unchanged in different communication sessions, the second attribute data including an attribute name and an attribute value, the attribute value being changed in different communication sessions;
the index determining module is used for determining a first index corresponding to the first attribute data and a second index corresponding to the second attribute data according to the specification of the session description protocol data, wherein the first index represents the first attribute data, and the second index represents the attribute name in the second attribute data;
The compression module is used for replacing the first attribute data in the session description protocol data with the first index and replacing the attribute name with the second index to obtain compressed data of the session description protocol data;
and the transmission module is used for transmitting the compressed data of the session description protocol data to the second terminal so that the first terminal and the second terminal establish a communication session based on the compressed data.
12. A data transmission apparatus for use with a second terminal, the apparatus comprising:
the compressed data receiving module is used for receiving compressed data of session description protocol data sent by the first terminal, wherein the compressed data comprises a first index, a second index and attribute values associated with the second index, the first index represents first attribute data, and the second index represents attribute names in the second attribute data;
the data determining module is used for determining the first attribute data corresponding to the first index and the attribute name corresponding to the second index according to the specification of the session description protocol data;
and the decompression module is used for replacing the first index in the compressed data with the first attribute data and replacing the second index with the attribute name to obtain the session description protocol data so that the first terminal and the second terminal establish a communication session based on the session description protocol data.
13. An electronic device comprising a processor and a memory, the memory storing a plurality of instructions; the processor loads instructions from the memory to perform the steps in the data transmission method according to any one of claims 1 to 10.
14. A computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps of the data transmission method of any one of claims 1 to 10.
15. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the data transmission method of any of claims 1 to 10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211104888.4A CN117714421A (en) | 2022-09-09 | 2022-09-09 | Data transmission method, device, electronic equipment, storage medium and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211104888.4A CN117714421A (en) | 2022-09-09 | 2022-09-09 | Data transmission method, device, electronic equipment, storage medium and program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117714421A true CN117714421A (en) | 2024-03-15 |
Family
ID=90161209
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211104888.4A Pending CN117714421A (en) | 2022-09-09 | 2022-09-09 | Data transmission method, device, electronic equipment, storage medium and program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117714421A (en) |
-
2022
- 2022-09-09 CN CN202211104888.4A patent/CN117714421A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9467650B2 (en) | Method and apparatus for transmitting media stream in video conference | |
JP6258312B2 (en) | System and method for a single KVM client supporting multiple different video compression techniques | |
EP3598716A1 (en) | Methods for uploading and downloading streaming media resource, distribution system, and streaming media server | |
US20130117659A1 (en) | Dynamic Server-Side Image Sizing For Fidelity Improvements | |
US9736194B1 (en) | System for establishing communication between devices | |
CN103491179A (en) | Multi-screen interaction method and system based on Web | |
JP2023509868A (en) | SERVER-SIDE PROCESSING METHOD AND SERVER FOR ACTIVELY PROPOSING START OF DIALOGUE, AND VOICE INTERACTION SYSTEM FOR POSITIVELY PROPOSING START OF DIALOGUE | |
WO2017114190A1 (en) | File uploading processing method and device | |
CN104980482A (en) | File transmitting method and device, file receiving method and device | |
Kovachev et al. | Building mobile multimedia services: a hybrid cloud computing approach | |
EP3576371A1 (en) | Method and system for transmitting streaming media resource | |
CN111787026B (en) | Method, device and equipment for transmitting media data and storage medium | |
CN114296675A (en) | Screen projection state determination method, device, equipment and computer readable storage medium | |
CN105763424B (en) | A kind of literal information processing method and device | |
CN104980481B (en) | Method and system, the electric terminal of data are transmitted between electric terminal | |
US10504277B1 (en) | Communicating within a VR environment | |
US20070220161A1 (en) | Broadcasting a presentation over a messaging network | |
US20200186580A1 (en) | Dynamic rotation of streaming protocols | |
CN117714421A (en) | Data transmission method, device, electronic equipment, storage medium and program product | |
CN117412167A (en) | Video transmission method, video transmission device, electronic equipment and computer storage medium | |
CN114679436B (en) | Session management method, server and computer readable storage medium | |
CN115802007A (en) | Monitoring system control method and device based on RTSP (real time streaming protocol) and readable storage medium | |
CN111478951B (en) | File issuing method and device | |
EP4183115A1 (en) | Enabling vertical application layer server for peer-to-peer media parameter negotiation | |
CN110198326A (en) | A kind of view networking conference reservation information push method, apparatus and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |