CN117812436A - Media information negotiation method, device, equipment and storage medium - Google Patents
Media information negotiation method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN117812436A CN117812436A CN202311676849.6A CN202311676849A CN117812436A CN 117812436 A CN117812436 A CN 117812436A CN 202311676849 A CN202311676849 A CN 202311676849A CN 117812436 A CN117812436 A CN 117812436A
- Authority
- CN
- China
- Prior art keywords
- identifier
- stun
- media
- media information
- target
- 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
- 238000000034 method Methods 0.000 title claims abstract description 55
- 230000004044 response Effects 0.000 claims abstract description 58
- 238000004590 computer program Methods 0.000 claims description 12
- 230000006835 compression Effects 0.000 claims description 8
- 238000007906 compression Methods 0.000 claims description 8
- 238000004891 communication Methods 0.000 abstract description 20
- 238000005516 engineering process Methods 0.000 abstract description 6
- 230000008569 process Effects 0.000 abstract description 5
- 238000010586 diagram Methods 0.000 description 7
- 230000003993 interaction Effects 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 6
- 230000005540 biological transmission Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 108700023290 Stanford University protocol Proteins 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 2
- 230000002452 interceptive effect Effects 0.000 description 2
- 238000005070 sampling Methods 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/60—Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client
- H04N21/63—Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
- H04N21/64—Addressing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/256—NAT traversal
- H04L61/2575—NAT traversal using address mapping retrieval, e.g. simple traversal of user datagram protocol through session traversal utilities for NAT [STUN]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/21—Server components or server architectures
- H04N21/218—Source of audio or video content, e.g. local disk arrays
- H04N21/2187—Live feed
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/47—End-user applications
- H04N21/472—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
- H04N21/47202—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for requesting content on demand, e.g. video on demand
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/85—Assembly of content; Generation of multimedia applications
- H04N21/858—Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot
Landscapes
- Engineering & Computer Science (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Databases & Information Systems (AREA)
- Computer Networks & Wireless Communication (AREA)
- Human Computer Interaction (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The present disclosure provides a negotiation method of media information, and relates to the field of computer technology, in particular to a live broadcast technology and a communication technology. The specific implementation scheme is as follows: responding to an access request of a target living broadcast room, and generating a STUN request according to a link address and a first identifier of the target living broadcast room; the first identifier is used for indicating media information supported by the client; sending a STUN request to a server; acquiring STUN response sent by a server; wherein the STUN response is obtained according to the STUN request; and determining the media information of the target live broadcasting room according to the second identifier contained in the STUN response. The method and the device can accelerate the media negotiation process and reduce the playing starting time.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to live broadcast technologies and communication technologies.
Background
When the client starts to acquire media data, the client needs to perform media negotiation with the server to determine parameters such as coding format, transmission protocol, bandwidth and the like to be used by both communication parties, so that both communication parties can agree on commonly supported media parameters, and the media data is transmitted and received under the same media parameters, thereby realizing effective and stable audio and video communication.
Disclosure of Invention
The disclosure provides a media information negotiation method, a device, equipment and a storage medium.
According to an aspect of the present disclosure, there is provided a negotiation method of media information, applied to a client, including:
responding to an access request of a target living broadcast room, and generating a STUN request according to a link address and a first identifier of the target living broadcast room; the first identifier is used for indicating media information supported by the client;
sending a STUN request to a server;
acquiring STUN response sent by a server; wherein the STUN response is obtained according to the STUN request; and
and determining the media information of the target live broadcasting room according to the second identification contained in the STUN response.
According to another aspect of the present disclosure, there is provided a negotiation method of media information, applied to a server, including:
responding to a STUN request acquired from a client, and determining a target media stream supported by the client according to a link address and a first identifier of a target live broadcasting room contained in the STUN request;
generating a second identifier according to the media information of the target media stream; and
and sending the STUN response containing the second identifier to the client.
According to another aspect of the present disclosure, there is provided a negotiation apparatus of media information, including:
the first generation module is used for responding to the access request of the target living broadcast room and generating a STUN request according to the link address and the first identifier of the target living broadcast room; the first identifier is used for indicating media information supported by the client;
the first acquisition module is used for sending a STUN request to the server;
the first sending module is used for obtaining STUN response sent by the server; wherein the STUN response is obtained according to the STUN request; and
and the first determining module is used for determining the media information of the target live broadcasting room according to the second identifier contained in the STUN response.
According to another aspect of the present disclosure, there is provided another negotiation apparatus of media information, including:
the second determining module is used for responding to the STUN request acquired from the client and determining a target media stream supported by the client according to the link address and the first identifier of the target live broadcasting room contained in the STUN request;
the second generation module is used for generating a second identifier according to the media information of the target media stream; and
and the second sending module is used for sending the STUN response containing the second identifier to the client.
According to another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the embodiments of the present disclosure.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform a method according to any one of the embodiments of the present disclosure.
According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements a method according to any of the embodiments of the present disclosure.
The method and the device can accelerate the media negotiation process and reduce the playing time of the media data.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is an application scenario diagram in which embodiments of the present disclosure may be implemented;
FIG. 2 is a flow chart of a method of negotiating media information according to one embodiment of the present disclosure;
FIG. 3 is a flow chart of a method of negotiating media information according to another embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a negotiation apparatus of media information according to an embodiment of the present disclosure;
fig. 5 is a schematic structural view of a negotiation apparatus of media information according to another embodiment of the present disclosure;
fig. 6 is a block diagram of an electronic device used to implement an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the related art, hypertext transfer protocol (Hypertext Transfer Protocol, HTTP) is used
The media negotiation needs to firstly send an http request to the server, and the server returns relevant information such as protocols supported by the server to the client. This scheme increases Round-Trip Time (RTT) and results in a longer start Time.
To at least partially solve one or more of the above problems and other potential problems, embodiments of the present disclosure provide a media information negotiation method, by which a media negotiation process can be accelerated and a play-starting time can be reduced.
The method can be applied to a client and/or a server, the client can be deployed in a terminal, and the server can be deployed in a server or other processing equipment to realize negotiation of media information. For example, the method may be applied to the application scenario shown in fig. 1, where the application scenario may include a terminal 110 and a media server 120, and a user may send a request for accessing a target live broadcast room to the media server 120 through the terminal 110, where the media server 120 may obtain audio and video data corresponding to the request from a self-memory in which a media stream of the target live broadcast room is cached, or may pull a stream from a third party server 130 corresponding to a streaming media source of the target live broadcast room, so as to obtain the audio and video data corresponding to the request. Before sending the audio and video data of the target live broadcasting room to the terminal 110, media negotiation is required to ensure that the communication parties can agree on commonly supported media parameters, so that the communication parties can transmit and receive the audio and video data in a consistent manner, and communication problems caused by inconsistent parameters are avoided.
The terminal 110 is connected to the media server 120 through a wireless network or a wired network. Alternatively, the terminal 110 is a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart watch, a vehicle-mounted terminal, or the like, but is not limited thereto. The terminal 110 installs and runs an application supporting a negotiation method of media information as a client.
The media server 120 and the third party server 130 may be independent servers, or a server cluster or a distributed system, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, and basic cloud computing services such as big data and artificial intelligence platforms.
Fig. 2 is a flowchart of a method for negotiating media information according to an embodiment of the present disclosure. The method is applied to the client, as shown in fig. 2, and at least comprises the following steps:
s210, responding to the access request to the target living broadcast room, and generating a STUN request according to the link address and the first identification of the target living broadcast room. Wherein the first identifier is used for indicating media information supported by the client.
In the embodiment of the disclosure, the access request to the target live broadcast room may be generated based on a click operation of the user on the client, for example, the user clicks a pattern, title or picture of a certain live broadcast room on an interactive interface of the client. The link address of the target live room is typically the web address of the live room, i.e., a uniform resource locator. The website information of the live broadcasting room is usually stored in the client side, and can also be contained in the interaction control.
STUN (Session Traversal Utilities for NAT) is a protocol for traversing NAT (Network Address Translation) devices in a network. The STUN request (request) is a message in the STUN protocol for acquiring a public IP address and a port number of a client or a server in order to establish a peer-to-peer connection or direct communication.
The link address and the first identification may be attribute parameters of STUN reqeust. The first identification is used to indicate media information supported by the client. The media information supported by the client may depend on the capabilities of the terminal, the decoding capabilities, settings on the client with respect to the media content, and the user's selections. The media information supported by the client includes at least a media format. For example, the first identification may indicate whether the client supports a bitstream structure for H265 high efficiency video coding (Hight Efficiency Video Coding, HEVC). As another example, the first identification may indicate whether the client supports advanced audio coding (Advanced Audio Coding, AAC) format or epsi codec (Opus Interactive Audio Codec, opus).
S220, a STUN request is sent to the server.
In one implementation, STUN reqeut is sent to the server via a user datagram protocol (User Datagram Protocol, UDP) packet.
S230, obtaining the STUN response sent by the server.
The STUN response is obtained by the server according to the STUN request.
And S240, determining media information of the target live broadcasting room according to the second identifier contained in the STUN response.
In the embodiment of the disclosure, the second identifier includes media information of the target live broadcast room, and the media information of the target live broadcast room can be obtained by analyzing the second representation, where the media information may also be called media description information, and is used for describing a media stream (such as audio or video). The following information may be contained in particular:
media type: representing the type of media stream such as audio or video.
The port: the port number used by the media stream is specified.
Transmission protocol: a protocol for transmitting the medium is specified, such as RTP (Real-time Transport Protocol).
Media format: the encoding format of the media is described, such as an audio encoding format (e.g., PCM, AAC) or a video encoding format (e.g., h.264).
Bandwidth information: the bandwidth requirements of the media stream are specified.
Media direction: the direction of the media stream is specified, such as "sendonly", "recvon ly", or "sendrecv".
And (3) media control: including information that controls the media flow, such as RTCP (RTP Control Protocol) addresses and ports.
According to the scheme of the embodiment of the disclosure, the media information supported by the client and the server is compressed in the STUN request and the response, so that negotiation of the media information is realized through the STUN request and the response, one RTT interaction during live broadcasting is reduced from the interaction principle, the broadcasting starting time is shortened, and the live broadcasting delay condition is shortened.
In one possible implementation, S210 generates, in response to an access request to the target living room, a STUN request according to a link address and a first identifier of the target living room, and further includes the steps of:
s211, responding to the access request to the target living broadcast room, and determining a first attribute parameter of the STUN request according to the link address of the target living broadcast room.
S212, generating a first identifier as a second attribute parameter according to a preset identifier format and media information supported by the client.
S213, generating a STUN request according to the first attribute parameter and the second attribute parameter.
In the embodiment of the disclosure, the link address and the media information supported by the client may be embedded in some extension fields of the STUN message, and the specific steps include:
1. custom STUN attribute: two STUN attributes are customized to carry additional information. For example, a first attribute named "url_address" may be defined for carrying web ADDRESS information, and a second attribute named "bd_BINARY_SDP for carrying media information.
2. Encoding and compression: the web address and media information are encoded and compressed to reduce the size of the data. Common compression algorithms include Base64 coding, and the like.
3. Added to STUN request: the encoded and compressed information is added to the custom STUN attributes and these attributes are included in the STUN request message.
It should be understood that, in order for the server to correctly identify the additional information carried in the STUN message, the server needs to know in advance the encoding mode of the client on the first identifier, so that the attribute parameter is decoded by adopting a corresponding decoding mode to obtain the link address and the media information supported by the client. The website information may be encoded using Base 64. The media information may be encoded in a preset identification format.
In one example, the first identifier may be composed of a plurality of identifiers in a fixed order, each identifier setting a corresponding meaning, and specifically includes:
a first identifier for identifying a video encoding format.
And a second identifier for identifying whether the bi-predictive inter-frame compression algorithm is supported.
And a third identifier for identifying whether the video data is contained.
And a fourth identifier for identifying whether the audio data is contained.
And a fifth identifier for identifying the audio data encoding format.
And a sixth identifier for identifying the audio data sampling rate.
According to the scheme of the embodiment of the disclosure, the additional information is contained in the STUN message, so that information transmission can be simplified, and the complexity of communication is reduced. The STUN protocol is extended by adopting a preset identification format, so that the client and the server can send the supported media information to the other party through STUN information.
In one possible implementation, S230 determines media information of the target live room according to the second identifier included in the STUN response, including:
and analyzing a second identifier contained in the STUN response according to a preset identifier format to obtain the media information of the target live broadcasting room.
In the embodiment of the disclosure, the server performs streaming according to the link address of the target live broadcast room, where the target live broadcast room may include a plurality of media streams (for example, streams with different resolutions or bit rates), and the server selects an appropriate media stream from the plurality of media streams according to the first identifier, then encodes the media information of the media stream into the second identifier, and sends the second identifier to the client through the STUN response. And the client analyzes the second identifier contained in the STUN response according to the preset identifier format, and the media information of the target live broadcasting room can be obtained.
According to the scheme of the embodiment of the disclosure, the client obtains the media information of the target live broadcasting room according to the second identifier contained in the STUN response, and completes negotiation of the media information.
In one possible implementation, the first identifier is in binary format, the first identifier comprising a plurality of first bits for indicating media information supported by the client.
In the embodiment of the disclosure, the first identifier is a binary identification protocol, the length may be 4 bytes, and the plurality of first bits are used as identifiers to set corresponding meanings, and other bits in the first identifier may be reserved and also used as identifiers for indicating other information. In one example, specifically includes:
bit 1 (bit 0) for identifying the hevc format: 1 represents h265 and 0 represents h264.
Bit 2 (bit 1) for identifying whether the bi-predictive inter compression algorithm bframe is supported: 1 indicates support, and 0 indicates no support.
A 3 rd bit (bit 2) for identifying whether the video data has_video is contained: 1 indicates that there is video, and 0 indicates that there is no video.
Bit 4 (bit 3) for identifying whether audio data has_audio is contained: 1 indicates audio, and 0 indicates no audio.
Bit 5 (bit 4) for identifying the audio data encoding format is_aac:1 represents aac, and 0 represents opus.
Bit 6 (bit 5) for identifying the audio data sample rate:1 indicates that the sampling rate is 44100, otherwise 48000 is defaulted.
Other unused bits may be set to 0.
According to the scheme of the embodiment of the disclosure, various media information of audio and video can be identified by using binary identifications of a plurality of bytes, so that the method is simple and efficient and is convenient to expand.
In one possible implementation, the method further comprises the steps of:
and under the condition that the STUN response is not acquired within the preset time threshold, resending the STUN request to the server.
In the embodiment of the disclosure, a timeout retransmission mechanism may be adopted, where the client may send the STUN request message again if the STUN response is not obtained within a preset time threshold after the STUN request message is sent. The preset time threshold may be estimated according to the RTT in the conventional case, and is generally set to be slightly greater than one RTT. For example, one RTT is 300ms, and the preset time threshold may be set to 320ms.
According to the scheme of the embodiment of the disclosure, the STUN request can be automatically retransmitted, and the waiting time is reduced.
Fig. 3 is a flowchart illustrating a method for negotiating media information according to another embodiment of the present disclosure. The method is applied to the server, as shown in fig. 3, and at least comprises the following steps:
s310, responding to the STUN request acquired from the client, and determining a target media stream supported by the client according to the link address and the first identification of the target live broadcasting room contained in the STUN request.
S320, generating a second mark according to the media information of the target media stream.
S330, a STUN response containing the second identifier is sent to the client.
In the embodiment of the disclosure, after receiving the STUN request message, the server analyzes the additional information in the STUN request message to obtain the link address of the target live broadcast room and the media information supported by the client. Triggering to pull the media stream of the target live broadcasting room, and further determining the target media stream supported by the client according to the media information supported by the client, thereby obtaining commonly supported media parameters. Then, the server encodes the media information of the target media stream into a second identifier, writes the second identifier into the STUN response message, and sends the second identifier to the client, so that the media parameters supported together are agreed, and the negotiation of the media information is completed.
According to the scheme of the embodiment of the disclosure, the media information supported by the client and the server is transmitted through the STUN message, so that negotiation of the media information is realized, one RTT interaction during live broadcasting is reduced from the interaction principle, the broadcasting starting time is shortened, and the live broadcasting delay condition is shortened.
In one possible implementation, S310, in response to a STUN request obtained from a client, determines a target media stream supported by the client according to a link address and a first identifier of a target live room included in the STUN request, including the steps of:
s311, responding to the STUN request acquired from the client, and pulling the corresponding media streams according to the link address of the target live broadcasting room contained in the STUN request.
S312, analyzing the media information of the plurality of media streams. Wherein the media information includes a media format.
S313, determining a target media stream supported by the client from the plurality of media streams according to the first identification and the media information of the plurality of media streams contained in the STUN request.
In the embodiment of the present disclosure, the server pulls and parses a plurality of corresponding media streams according to a link address of a target live broadcast room included in a STUN request, where the process generally includes:
establishing connection: the server (media server) establishes a connection with a streaming media source (third party server) of the target live broadcast room. May involve establishing a communication channel using a protocol (e.g., RTMP, HLS, DASH, etc.).
Acquiring media information: once the connection is established, the server starts to acquire a media stream (live stream) from the streaming media source, and parses media information of the media stream, wherein the media information comprises information about coding format, resolution, frame rate and the like of the media stream.
Selecting an appropriate media stream: the target live room may include a plurality of media streams (e.g., streams of different resolutions or bit rates), and the server selects an appropriate media stream according to media credits of the plurality of media streams and media information supported by the client, and determines the target media stream.
According to the scheme of the embodiment of the disclosure, the server side selects a proper media stream according to the live stream of the live broadcasting room and the media information supported by the client side, and determines a target media stream.
In a possible implementation manner, S320 generates a second identifier according to media information of the target media stream, including the steps of:
and under the condition of successfully determining the target media stream, generating a second identifier according to the media information of the target media stream and the preset identifier format.
In the embodiment of the disclosure, after the server side selects a suitable media stream, media information of the target media stream needs to be sent to the client side, so that the client side can receive and decode audio and video data in a correct manner.
According to the scheme of the embodiment of the disclosure, the server encodes the media information of the target media stream to generate a second identifier so as to write in the STUN response and send the STUN response to the client.
In a possible implementation manner, S320 generates a second identifier according to media information of the target media stream, including the steps of:
and under the condition that the media stream is not pulled normally or is not parsed normally, generating a second identifier containing a failure state parameter according to a preset identifier format.
In the embodiment of the disclosure, if the media stream is not pulled normally or is not parsed normally, for example, the live broadcasting room is stopped and closed, the preset identifier format modifies the status parameter to be in a failure status in the second identifier. In one example, the 7 th bit 6 in the second identifier may be set as a state parameter, and is set to 0 by default, and if the media stream is not pulled normally or parsed normally, it is changed from 0 to 1, so as to indicate that the media stream is not pulled normally or parsed normally.
According to the scheme of the embodiment of the disclosure, the client can obtain the result of whether to pull the media stream normally or parse the media stream from the STUN response.
In one possible implementation, the second identifier is in binary format. The second identifier comprises:
a plurality of second bits for indicating media information of a target media stream, wherein the media information of the target media stream includes: whether audio data is contained, an audio encoding format is contained, whether video data is contained, a video encoding format, a compression algorithm, a code rate.
And a third bit for use as a status parameter indicating success or failure of pull stream parsing.
According to the scheme of the embodiment of the disclosure, various media information and state parameters of the audio and video can be identified by using binary identifications of a plurality of bytes, so that the method is simple, efficient and convenient to expand.
In one possible implementation manner, the negotiation method of the media information of the embodiment of the disclosure includes the following steps:
when the client needs to watch the live broadcast room, the client needs to send the udp packet of the stun request to the server. In the udp packet of stun reqeut, add attribute: url_address and bd_BINARY_SDP.
Url_address is URL of the live room to be requested, bd_binary_sdp is BINARY identification protocol, and is 4 bytes in length.
After receiving the stun reuqest udp packet of the client, the server triggers streaming and analyzes media information of the live stream.
After the parsing is completed, the media information is written in a stun response udp packet according to a format defined in bd_BINARY_SDP, and the stun response packet is returned to the client.
After receiving the stun response packet, the client analyzes according to the format defined in BD_BINARY_SDP, and the analysis is completed to obtain the media information of the current live broadcasting room.
And when the client side does not receive the stun response after sending the first stun request packet, continuously sending the stun request packet to the server side until receiving the stun response packet.
After the client end analyzes the media information, the negotiation of the media information is completed, and after the client end receives the media stream, decoding and playing operations are carried out to present the audio or video content.
Fig. 4 is a schematic structural diagram of a negotiation apparatus for media information according to an embodiment of the present disclosure. As shown in fig. 4, the apparatus includes:
a first generation module 401, configured to generate a STUN request according to a link address and a first identifier of a target live room in response to an access request to the target live room. Wherein the first identifier is used for indicating media information supported by the client.
A first sending module 402, configured to send a STUN request to a server.
A first obtaining module 403, configured to obtain a STUN response sent by the server. Wherein the STUN response is derived from the STUN request.
A first determining module 404, configured to determine media information of the target live room according to the second identifier included in the STUN response.
In one possible implementation, the first generating module 401 is configured to:
and responding to the access request of the target living broadcast room, and determining a first attribute parameter of the STUN request according to the link address of the target living broadcast room.
And generating a first identifier serving as a second attribute parameter according to the preset identifier format and the media information supported by the client.
And generating a STUN request according to the first attribute parameter and the second attribute parameter.
In one possible implementation, the first determining module 404 is configured to:
and analyzing a second identifier contained in the STUN response according to a preset identifier format to obtain the media information of the target live broadcasting room.
In one possible implementation, the first identifier is in a binary format, and the first identifier includes a plurality of first bits for indicating media information supported by the client.
In one possible implementation, the apparatus further includes:
and the retransmission module is used for retransmitting the STUN request to the server under the condition that the STUN response is not acquired within the preset time threshold.
For descriptions of specific functions and examples of each module and sub-module of the apparatus in the embodiments of the present disclosure, reference may be made to the related descriptions of corresponding steps in the foregoing method embodiments, which are not repeated herein.
Fig. 5 is a schematic structural diagram of another negotiation apparatus for media information according to an embodiment of the present disclosure. As shown in fig. 5, the apparatus includes at least:
a second determining module 501, configured to determine, in response to a STUN request obtained from the client, a target media stream supported by the client according to a link address and a first identifier of a target live room included in the STUN request.
The second generating module 502 is configured to generate a second identifier according to media information of the target media stream.
And
A second sending module 503, configured to send a STUN response including the second identifier to the client.
In one possible implementation, the second determining module 501 is configured to:
and responding to the STUN request acquired from the client, and pulling the corresponding plurality of media streams according to the link address of the target live broadcasting room contained in the STUN request.
And analyzing the media information of the plurality of media streams. Wherein the media information includes a media format.
And determining a target media stream supported by the client from the plurality of media streams according to the first identification and the media information of the plurality of media streams contained in the STUN request.
In one possible implementation, the second generating module 502 is configured to:
and under the condition of successfully determining the target media stream, generating a second identifier according to the media information of the target media stream and the preset identifier format.
In one possible implementation, the second generating module 502 is configured to:
and under the condition that the media stream is not pulled normally or is not parsed normally, generating a second identifier containing a failure state parameter according to a preset identifier format.
In one possible implementation, the second identifier is in binary format. The second identifier comprises:
a plurality of second bits for indicating media information of a target media stream, wherein the media information of the target media stream includes: whether audio data is contained, an audio encoding format is contained, whether video data is contained, a video encoding format, a compression algorithm, a code rate.
And a third bit for use as a status parameter indicating success or failure of pull stream parsing.
For descriptions of specific functions and examples of each module and sub-module of the apparatus in the embodiments of the present disclosure, reference may be made to the related descriptions of corresponding steps in the foregoing method embodiments, which are not repeated herein.
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the related user personal information all conform to the regulations of related laws and regulations, and the public sequence is not violated.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 6 illustrates a schematic block diagram of an example electronic device 600 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile apparatuses, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing apparatuses. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the apparatus 600 includes a computing unit 601 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 602 or a computer program loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 may also be stored. The computing unit 601, ROM 602, and RAM 603 are connected to each other by a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Various components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, mouse, etc.; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the respective methods and processes described above, for example, a negotiation method of media information. For example, in some embodiments, the method of negotiating media information may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM 602 and/or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the negotiation method of media information described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the negotiation method of media information in any other suitable way (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel, sequentially, or in a different order, provided that the desired results of the disclosed aspects are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions, improvements, etc. that are within the principles of the present disclosure are intended to be included within the scope of the present disclosure.
Claims (23)
1. A negotiation method of media information is applied to a client, and comprises the following steps:
responding to an access request of a target living broadcast room, and generating a STUN request according to a link address and a first identifier of the target living broadcast room; wherein, the first identifier is used for indicating media information supported by the client;
sending the STUN request to a server;
acquiring a STUN response sent by the server; wherein the STUN response is obtained according to the STUN request; and
and determining the media information of the target live broadcasting room according to the second identifier contained in the STUN response.
2. The method of claim 1, wherein generating the STUN request in response to the access request to the target live room from the link address and the first identification of the target live room comprises:
responding to an access request to a target living broadcast room, and determining a first attribute parameter of a STUN request according to a link address of the target living broadcast room;
generating a first identifier as a second attribute parameter according to a preset identifier format and media information supported by a client;
and generating a STUN request according to the first attribute parameter and the second attribute parameter.
3. The method of claim 1, wherein determining media information of the target live room based on the second identification contained in the STUN response comprises:
and analyzing a second identifier contained in the STUN response according to a preset identifier format to obtain the media information of the target live broadcasting room.
4. A method according to any of claims 1 to 3, wherein the first identity is in binary format, the first identity comprising a plurality of first bits for indicating media information supported by the client.
5. The method of claim 1, further comprising:
and under the condition that the STUN response is not acquired within the preset time threshold, the STUN request is sent to the server again.
6. A negotiation method of media information is applied to a server and comprises the following steps:
responding to a STUN request acquired from a client, and determining a target media stream supported by the client according to a link address and a first identifier of a target live broadcast room contained in the STUN request;
generating a second identifier according to the media information of the target media stream; and
and sending a STUN response containing the second identifier to the client.
7. The method of claim 6, wherein in response to a STUN request obtained from a client, determining a target media stream supported by the client based on a link address and a first identification of a target live room contained in the STUN request, comprises:
responding to a STUN request acquired from a client, and pulling a plurality of corresponding media streams according to a link address of a target live broadcasting room contained in the STUN request;
analyzing the media information of the plurality of media streams; wherein the media information includes a media format;
and determining a target media stream supported by the client from the plurality of media streams according to the first identification contained in the STUN request and the media information of the plurality of media streams.
8. The method of claim 7, wherein generating a second identification from media information of the target media stream comprises:
and under the condition that the target media stream is successfully determined, generating a second identifier according to the media information of the target media stream and the preset identifier format.
9. The method of claim 7, wherein generating a second identification from media information of the target media stream comprises:
and under the condition that the media stream is not pulled normally or is not parsed normally, generating a second identifier containing a failure state parameter according to a preset identifier format.
10. The method of any of claims 6 to 9, wherein the second identity is in binary format; the second identifier includes:
a plurality of second bits for indicating media information of the target media stream, wherein the media information of the target media stream includes: whether or not to contain at least one of audio data, audio coding format, whether or not to contain video data, video coding format, compression algorithm, code rate;
and a third bit for use as a status parameter indicating success or failure of pull stream parsing.
11. A negotiation apparatus of media information, comprising:
the first generation module is used for responding to an access request to a target living broadcast room and generating a STUN request according to a link address and a first identifier of the target living broadcast room; wherein, the first identifier is used for indicating media information supported by the client;
the first acquisition module is used for sending the STUN request to a server;
a first sending module, configured to obtain a STUN response sent by the server; wherein the STUN response is obtained according to the STUN request; and
and the first determining module is used for determining the media information of the target live broadcasting room according to the second identifier contained in the STUN response.
12. The apparatus of claim 11, wherein the first generation module is to:
responding to an access request to a target living broadcast room, and determining a first attribute parameter of a STUN request according to a link address of the target living broadcast room;
generating a first identifier as a second attribute parameter according to a preset identifier format and media information supported by a client;
and generating a STUN request according to the first attribute parameter and the second attribute parameter.
13. The apparatus of claim 11, wherein the first determining module is configured to:
and analyzing a second identifier contained in the STUN response according to a preset identifier format to obtain the media information of the target live broadcasting room.
14. The apparatus of any of claims 11 to 13, wherein the first identification is in a binary format, the first identification comprising a plurality of first bits for indicating media information supported by the client.
15. The apparatus of claim 11, further comprising:
and the retransmission module is used for retransmitting the STUN request to the server under the condition that the STUN response is not acquired within the preset time threshold.
16. A negotiation apparatus of media information, comprising:
the second determining module is used for responding to the STUN request acquired from the client and determining a target media stream supported by the client according to a link address and a first identifier of a target live broadcast room contained in the STUN request;
the second generation module is used for generating a second identifier according to the media information of the target media stream; and
and the second sending module is used for sending the STUN response containing the second identifier to the client.
17. The apparatus of claim 16, wherein the second determination module is configured to:
responding to a STUN request acquired from a client, and pulling a plurality of corresponding media streams according to a link address of a target live broadcasting room contained in the STUN request;
analyzing the media information of the plurality of media streams; wherein the media information includes a media format;
and determining a target media stream supported by the client from the plurality of media streams according to the first identification contained in the STUN request and the media information of the plurality of media streams.
18. The apparatus of claim 17, wherein the second generation module is configured to:
and under the condition that the target media stream is successfully determined, generating a second identifier according to the media information of the target media stream and the preset identifier format.
19. The apparatus of claim 17, wherein the second generation module is configured to:
and under the condition that the media stream is not pulled normally or is not parsed normally, generating a second identifier containing a failure state parameter according to a preset identifier format.
20. The apparatus of any of claims 16 to 19, wherein the second identifier is in a binary format; the second identifier includes:
a plurality of second bits for indicating media information of the target media stream, wherein the media information of the target media stream includes: whether or not to contain at least one of audio data, audio coding format, whether or not to contain video data, video coding format, compression algorithm, code rate;
and a third bit for use as a status parameter indicating success or failure of pull stream parsing.
21. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-10.
22. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-10.
23. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311676849.6A CN117812436A (en) | 2023-12-07 | 2023-12-07 | Media information negotiation method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311676849.6A CN117812436A (en) | 2023-12-07 | 2023-12-07 | Media information negotiation method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117812436A true CN117812436A (en) | 2024-04-02 |
Family
ID=90424365
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311676849.6A Pending CN117812436A (en) | 2023-12-07 | 2023-12-07 | Media information negotiation method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117812436A (en) |
-
2023
- 2023-12-07 CN CN202311676849.6A patent/CN117812436A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10412130B2 (en) | Method and apparatus for playing media stream on web browser | |
CN112738644B (en) | Video stream transmission method and device based on WebRTC | |
US11792130B2 (en) | Audio/video communication method, terminal, server, computer device, and storage medium | |
CN112653700B (en) | Website video communication method based on WEBRTC | |
US10194180B2 (en) | Systems and methods for transmitting video data over a network | |
CN112738140B (en) | Video stream transmission method, device, storage medium and equipment based on WebRTC | |
WO2015134649A1 (en) | Systems and methods for media format substitution | |
CN103348657B (en) | Flow media playing method, equipment and system | |
CN108696899B (en) | SIP message transmitting and receiving method and transmitting and receiving device | |
CN112261421B (en) | Virtual reality display method and device, electronic equipment and storage medium | |
CN111787026B (en) | Method, device and equipment for transmitting media data and storage medium | |
WO2023160361A1 (en) | Rtc data processing method and apparatus | |
CN114221909B (en) | Data transmission method, device, terminal and storage medium | |
WO2015085873A1 (en) | Video code stream obtaining method and apparatus | |
CN106209942B (en) | Data compression transmission method and system, terminal and server thereof | |
CN110113298A (en) | Data transmission method, device, signal server and computer-readable medium | |
WO2019007027A1 (en) | Video playing method and system, electronic device and readable storage medium | |
CN117812436A (en) | Media information negotiation method, device, equipment and storage medium | |
CN115714874A (en) | Video stream screen display method, device and system, stream pulling equipment and storage medium | |
CN113473158B (en) | Live broadcast data processing method, device, electronic equipment and medium | |
CN115208864A (en) | Data transmission method, device, equipment, vehicle and storage medium | |
CN115022725A (en) | Video playing method and device | |
EP4042690A1 (en) | Av1 codec for real-time video communication | |
CN117579679B (en) | Signaling interaction method and device, electronic equipment and storage medium | |
CN112492358B (en) | Screen projection method and device, computer equipment and storage medium |
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 |