Disclosure of Invention
The application aims to provide a streaming media transmission method, a streaming media transmission device, electronic equipment and a streaming media transmission medium, which are used for reducing the waste of network bandwidth and improving the data access speed.
In order to solve the above technical problem, the present application provides a streaming media transmission method, which is applied to a central node, and the method includes:
acquiring a stream taking signaling;
obtaining a node code according to the stream taking signaling, and judging whether the current equipment is at a local node or a sinking node according to the node code;
if the local node is located, acquiring a streaming media address of the local node and sending the streaming media address to a client corresponding to the streaming signaling;
and if the sink node is located, forwarding the stream-taking signaling to the sink node, so that the sink node can obtain a stream media address according to the received stream-taking signaling and send the stream media address to a client corresponding to the stream-taking signaling.
Preferably, before forwarding the stream fetching signaling to the sink node, the method further includes:
establishing connection with the sinking node according to the node code of the sinking node;
judging whether the sinking node is normal or not through heartbeat keep-alive;
if the signaling is normal, the step of forwarding the flow taking signaling to the sink node is carried out.
Preferably, after determining the node to which the node belongs, the method further includes:
judging whether the node has the watching authority;
if the watching authority is not available, a prompt is sent out.
Preferably, the method further comprises the following steps:
and receiving the synchronization information sent by the sink node.
In order to solve the above technical problem, the present application further provides a streaming media transmission method applied to a sink node, where the method includes:
receiving a flow taking signaling sent by a central node, wherein the flow taking signaling is a signaling forwarded by the central node under the condition that the current equipment is in a local node according to the node code obtained by the flow taking signaling;
and acquiring the streaming media address of the local node and sending the streaming media address to the client corresponding to the streaming signaling.
Preferably, the acquiring the streaming media address comprises:
obtaining available service information in the streaming media cluster through the STDU _ Scheduler;
and selecting the streaming media service from the available services according to a load balancing principle, and acquiring the address of the STDU as a streaming media address according to the streaming media service.
In order to solve the above technical problem, the present application further provides a streaming media transmission apparatus, applied to a central node, including:
the first acquisition module is used for acquiring a stream taking signaling;
the judging module is used for judging whether the current equipment is at a local node or a sinking node according to the node code obtained by the streaming signaling;
the second acquisition module is used for acquiring the streaming media address of the local node when the current equipment is at the local node;
the first sending module is used for sending the streaming media address to the client corresponding to the streaming signaling;
and the second sending module is used for sending the stream-taking signaling to the sinking node when the current equipment is at the sinking node, so that the sinking node can conveniently obtain the stream media address according to the received stream-taking signaling and send the stream media address to the client corresponding to the stream-taking signaling.
In order to solve the above technical problem, the present application further provides a streaming media transmission device, which is applied to a sink node, and includes:
the receiving module is used for receiving a stream taking signaling sent by the central node, wherein the stream taking signaling is a signaling forwarded by the central node under the condition that the current equipment is in a local node according to the judgment of a node code obtained by the stream taking signaling;
a third obtaining module, configured to obtain a streaming media address of a local node;
and the third sending module is used for sending the acquired streaming media address to the client corresponding to the streaming signaling.
In order to solve the above technical problem, the present application further provides an electronic device, including:
a memory for storing a computer program;
and the processor is used for realizing the steps of the streaming media transmission method when executing the computer program.
In order to solve the above technical problem, the present application further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the streaming media transmission method are implemented.
The application provides a stream media transmission method, the method obtains the signaling of getting stream first; then, obtaining a node code according to the stream taking signaling, and judging whether the current equipment is at a local node or a sinking node according to the node code; if the local node is located, acquiring a streaming media address of the local node and sending the streaming media address to a client corresponding to the streaming signaling; and if the sink node is located, forwarding the stream-taking signaling to the sink node so that the sink node can obtain a stream media address according to the received stream-taking signaling and send the stream media address to a client corresponding to the stream-taking signaling. The method obtains the streaming media address and sends the streaming media address to the client so that the client can establish connection with the streaming media address and obtain data stream, when the equipment is at a sink node, the data stream of the sink node does not need to be transmitted to a central node and is provided with service by the central node, but the client directly establishes connection with the sink node so as to obtain the data stream, the waste of network bandwidth is reduced by a near streaming obtaining mode, and the data access speed is improved.
In addition, the streaming media transmission device, the electronic device and the media provided by the application correspond to the streaming media transmission method, and the effects are as above.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without any creative effort belong to the protection scope of the present application.
The core of the application is to provide a streaming media transmission method, which reduces the waste of network bandwidth and improves the data access speed by a nearby streaming mode.
In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings.
Fig. 1 is a flowchart of a streaming media transmission method applied to a central node according to the present application.
As shown in fig. 1, the method includes:
s1: and acquiring a stream taking signaling.
In this embodiment, the stream fetching signaling refers to a stream fetching request of a user, and when the user sends the stream fetching signaling through a client, the central node obtains the stream fetching signaling, so as to execute a corresponding operation according to the stream fetching signaling to obtain a stream media address.
S2: and obtaining a node code according to the stream taking signaling, and judging whether the current equipment is in a local node or a sinking node according to the node code.
And after receiving the stream taking signaling, obtaining the code of each node according to the stream taking signaling, and judging whether the current equipment is in a local node or a sinking node according to the node code and the equipment information. It should be noted that, the local node in this embodiment is a central node, the node code is used to characterize the position of the node, and the current device refers to a device in which the client plays the data stream, and belongs to the front-end camera.
S3: and if the local node is located, acquiring the streaming media address of the local node and sending the streaming media address to the client corresponding to the streaming signaling.
In this embodiment, when the current device is in the local node, the current device issues a streaming signaling to a local streaming media scheduling service (STDU _ Scheduler), and the STDU _ Scheduler obtains available service information in a streaming media cluster of the local node according to a local node code, and further selects an appropriate streaming media service from the available service information according to a load balancing principle to provide a streaming media address. After the local node acquires the streaming media address, the local node sends the streaming media address back to the client corresponding to the streaming signaling, and after the client receives the streaming media address, the client is directly connected with a streaming media transmission distribution module (STDU) of the local node according to the streaming media address to acquire the data Stream. It should be noted that the load balancing principle includes modes such as a minimum connection number, polling, hash, and weight, and in this embodiment, the streaming media service with the minimum connection number is selected by default, and in a specific implementation, the load balancing principle may be selected according to an actual situation.
S4: and if the sink node is located, forwarding the stream-taking signaling to the sink node, so that the sink node can obtain a stream media address according to the received stream-taking signaling and send the stream media address to a client corresponding to the stream-taking signaling.
The embodiment provides a streaming media transmission method, which is applied to a central node and comprises the steps of firstly acquiring a streaming signaling; then, obtaining a node code according to the stream taking signaling, and judging whether the current equipment is at a local node or a sinking node according to the node code; if the local node is located, acquiring a streaming media address of the local node and sending the streaming media address to a client corresponding to the streaming signaling; and if the sink node is located, forwarding the stream-taking signaling to the sink node so that the sink node can obtain a stream media address according to the received stream-taking signaling and send the stream media address to a client corresponding to the stream-taking signaling. When the equipment is at the central node, the method acquires the streaming media address of the central node and sends the streaming media address to the client so that the client establishes connection with the central node according to the streaming media address to acquire data stream; when the equipment is at the sink node, the method does not need to transmit the data stream of the sink node to the central node, the central node provides service, but sends the stream media address to the client, the client is directly connected with the sink node, and then the data stream is obtained, the waste of network bandwidth is reduced by a nearby stream taking mode, and the data access speed is improved.
Before forwarding the flow fetching signaling to the sinking node in the above embodiment, it is necessary to establish a connection relationship between the central node and the sinking node, and determine whether the sinking node is in a normal state. The method comprises the following steps:
establishing connection with the sinking node according to the node code of the sinking node;
judging whether the sinking node is normal or not through heartbeat keep-alive;
if the signaling is normal, the step of forwarding the flow taking signaling to the sink node is carried out.
In this embodiment, the web end adds the attributes of the sink node through node management, including the attribute information such as the node code, the signaling forwarding address, the message synchronization service address, and the data synchronization service address of the sink node. In other words, in the above embodiment, the device information that needs to be sent by the message synchronization service is used to determine whether the device is in the sink node, and the data synchronization service is used to report the device on-line, and synchronize the information of the sink node to the central node. It should be noted that the central node has its default node code, and only the attribute information of each sinking node is added without adding it. After the Node addition is completed, the Node Access Service (NAS) actively establishes connection with a Node Access Client (NAC) of the sinking Node according to the attribute information of the sinking Node, keeps the heart alive, can judge whether the sinking Node is normal through heartbeat notification, and displays the state of the sinking Node at a Client interface, thereby facilitating the user to know.
In this embodiment, a connection is established with the sinking node according to the node code of the sinking node, and the heart is kept alive, and whether the sinking node is normal is determined, so that the stream fetching signaling is forwarded to the sinking node.
After the node to which the device belongs is determined in the above embodiment, the authority of the node needs to be determined. The method comprises the following steps:
judging whether the node has the watching authority;
if the watching authority is not available, a prompt is sent out.
In this embodiment, after determining the node to which the device belongs, the central node issues a stream fetching signaling to a User Authentication Service (UAS), and the UAS determines whether the node has a viewing right, and directly returns a prompt without a right if the node does not have the viewing right. And only after the UAS judges that the node has the watching authority, the UAS sends the stream fetching signaling to the STDU _ Scheduler of the node to obtain the stream media address.
After determining the node to which the device belongs, the embodiment determines whether the node has the watching right, and sends a prompt when the node does not have the watching right, so that the user can know the right and take measures to grant the right to acquire the streaming media address.
In the above embodiment, the attribute information of the sink node includes a data synchronization service address, and the data synchronization service is used for reporting an online device and synchronizing information of the sink node to the central node, so that the central node needs to receive synchronization information sent by the sink node.
The embodiment receives the synchronization information generated by the sinking node, so that the working progress of the sinking node can be known conveniently, and the monitoring and management of the central node on the sinking node can be realized.
Fig. 2 is a flowchart of a streaming media transmission method applied to a sink node according to the present application.
As shown in fig. 2, the method includes:
s5: receiving a flow taking signaling sent by a central node, wherein the flow taking signaling is a signaling forwarded by the central node under the condition that the current equipment is in a local node according to the node code obtained by the flow taking signaling;
s6: and acquiring the streaming media address of the local node and sending the streaming media address to the client corresponding to the streaming signaling.
In this embodiment, after the UAS determines that the sink node has the viewing right, the central node communicates with the NAC of the sink node and forwards the stream fetching signaling to the NAC of the sink node, at this time, the sink node receives the stream fetching signaling and notifies the STDU _ Scheduler of the local node, and the STDU _ Scheduler obtains available service information in the stream media cluster of the local node according to the local node code, selects an appropriate stream media service from the stream media service according to the load balancing principle, provides a stream media address, and sends the stream media address back to the client corresponding to the stream fetching signaling. Since the load balancing principle has been described in the above embodiments, this embodiment is not described in detail. It should be noted that the local node in this embodiment is a sink node.
The embodiment provides a streaming media transmission method, which is applied to a sinking node, and the method receives a streaming media access signaling sent by a central node, then obtains a streaming media address of a local node and sends the streaming media address to a client corresponding to the streaming media access signaling, wherein the streaming media access signaling is a signaling forwarded by the current equipment under the condition of the local node, which is judged by the central node according to a node code obtained by the streaming media access signaling. When the equipment is at a sink node, the method does not need to transmit the data stream of the sink node to the central node, the central node provides service, but sends the stream media address to the client, the client is directly connected with the sink node to further acquire the data stream, the waste of network bandwidth is reduced by a nearby stream taking mode, the data access speed is improved, and the data transmission delay is reduced.
In the above embodiments, it is mentioned that the streaming media address needs to be acquired, so that the client directly connects to the STDU of the corresponding node according to the streaming media address to acquire the data stream. The step of acquiring the streaming media address comprises:
obtaining available service information in the streaming media cluster through the STDU _ Scheduler;
and selecting the streaming media service from the available services according to a load balancing principle, and acquiring the address of the STDU as a streaming media address according to the streaming media service.
In this embodiment, the step of acquiring the streaming media address is described in detail, and the address of the STDU is sent to the client as the streaming media address, so that the client establishes a connection with the STDU according to the streaming media address to acquire the data stream.
In the foregoing embodiments, details of a streaming media transmission method are described, and the present application also provides embodiments corresponding to the streaming media transmission apparatus. It should be noted that the present application describes the embodiments of the apparatus portion from two perspectives, one from the perspective of the function module and the other from the perspective of the hardware.
Fig. 3 is a structural diagram of a streaming media transmission apparatus applied to a central node according to the present application.
The device includes:
a first obtaining module 10, configured to obtain a stream fetching signaling;
the judging module 11 is configured to judge whether the current device is in a local node or a sinking node according to the node code obtained through the streaming signaling;
a second obtaining module 12, configured to obtain a streaming media address of a local node when the current device is in the local node;
a first sending module 13, configured to send a streaming media address to a client corresponding to the streaming signaling;
the second sending module 14 is configured to send the streaming media address to the sink node when the current device is at the sink node, so that the sink node obtains the streaming media address according to the received streaming media address and sends the streaming media address to the client corresponding to the streaming media address.
Since the embodiment of the apparatus portion applied to the central node corresponds to the embodiment of the method portion applied to the central node, please refer to the description of the embodiment of the method portion applied to the central node for the embodiment of the apparatus portion applied to the central node, which is not repeated here.
The streaming media transmission device applied to the central node provided by this embodiment acquires the stream fetching signaling through the first acquisition module; then, judging whether the current equipment is at a local node or a sinking node by a judging module according to a node code obtained by the streaming signaling; if the current equipment is at the local node, the stream media address of the local node is obtained through the second obtaining module, and the stream media address is sent to the client corresponding to the stream taking signaling through the first sending module; and if the current equipment is at the sink node, sending a stream-taking signaling to the sink node through a second sending module so that the sink node can conveniently obtain a stream media address according to the received stream-taking signaling and send the stream media address to a client corresponding to the stream-taking signaling. When the equipment is at the central node, the device acquires the streaming media address of the central node and sends the streaming media address to the client, so that the client establishes connection with the central node according to the streaming media address to acquire data stream; when the device is at the sink node, the device does not need to transmit the data stream of the sink node to the central node, the central node provides service, but sends the stream media address to the client, the client directly establishes connection with the sink node to further acquire the data stream, the waste of network bandwidth is reduced by a nearby stream taking mode, and the data access speed is improved.
Fig. 4 is a structural diagram of a streaming media transmission apparatus applied to a sink node according to the present application.
The device includes:
the receiving module 15 is configured to receive a stream fetching signaling sent by the central node, where the stream fetching signaling is a signaling forwarded by the central node under the condition that the current device is in the local node according to the node code obtained by the stream fetching signaling;
a third obtaining module 16, configured to obtain a streaming media address of the local node;
and a third sending module 17, configured to send the obtained streaming media address to the client corresponding to the streaming signaling.
Since the embodiment of the apparatus portion applied to the sink node corresponds to the embodiment of the method portion applied to the sink node, please refer to the description of the embodiment of the method portion applied to the sink node for the embodiment of the apparatus portion applied to the sink node, which is not repeated here.
The streaming media transmission device applied to the sink node provided by this embodiment receives, by using a receiving module, a stream fetching signaling sent by a central node, where the stream fetching signaling is a signaling forwarded by the central node under the condition that a current device is at a local node, and is determined by the central node according to a node code obtained by the stream fetching signaling; then, a third acquisition module acquires the streaming media address of the local node; and the third sending module sends the acquired streaming media address to the client corresponding to the streaming signaling. When the device is at the sink node, the device does not need to transmit the data stream of the sink node to the central node, the central node provides service, but sends the stream media address to the client, the client directly establishes connection with the sink node to further acquire the data stream, the waste of network bandwidth is reduced by a nearby stream taking mode, the data access speed is improved, and the data transmission delay is reduced.
Fig. 5 is a block diagram of an electronic device according to another embodiment of the present application, and as shown in fig. 5, the electronic device includes:
a memory 20 for storing a computer program;
a processor 21, configured to execute the computer program to implement the steps of the streaming media transmission method as mentioned in the above embodiments.
The electronic device provided by the embodiment may include, but is not limited to, a smart phone, a tablet computer, a notebook computer, or a desktop computer.
The processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The Processor 21 may be implemented in hardware using at least one of a Digital Signal Processor (DSP), a Field-Programmable Gate Array (FPGA), and a Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a Graphics Processing Unit (GPU) which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 21 may further include an Artificial Intelligence (AI) processor for processing computational operations related to machine learning.
The memory 20 may include one or more computer-readable storage media, which may be non-transitory. Memory 20 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used for storing the following computer program 201, wherein after being loaded and executed by the processor 21, the computer program can implement the relevant steps of the streaming media transmission method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202, data 203, and the like, and the storage manner may be a transient storage manner or a permanent storage manner. Operating system 202 may include, among others, Windows, Unix, Linux, and the like. Data 203 may include, but is not limited to, a data stream corresponding to a streaming media address, and the like.
In some embodiments, the electronic device may further include a display 22, an input/output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
Those skilled in the art will appreciate that the configuration shown in fig. 5 is not intended to be limiting of electronic devices and may include more or fewer components than those shown.
The electronic device provided by the embodiment comprises a memory and a processor, and when the processor executes a program stored in the memory, the streaming media transmission method can be implemented, and the effects are as described above.
Finally, the application also provides a corresponding embodiment of the computer readable storage medium. The computer readable storage medium has stored thereon a computer program, which when executed by a processor, implements the steps of the streaming media transmission method described in the above method embodiments (which may be a method corresponding to the center node side, a method corresponding to the sink node side, or a method corresponding to the center node side and the sink node side).
It is to be understood that if the method in the above embodiments is implemented in the form of software functional units and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium and executes all or part of the steps of the methods described in the embodiments of the present application, or all or part of the technical solutions. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiment provides a computer-readable storage medium including the streaming media transmission method mentioned above, and the effects are the same as above.
The streaming media transmission method, the streaming media transmission device, the electronic device, and the media provided by the present application are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.