Disclosure of Invention
The purpose of the application is to provide a streaming media transmission method, a streaming media transmission device, electronic equipment and a streaming media medium, which are used for reducing waste of network bandwidth and improving data access speed.
In order to solve the above technical problems, the present application provides a streaming media transmission method, applied to a central node, the method includes:
acquiring a streaming signal;
obtaining node codes according to the stream fetching signaling, and judging whether the current equipment is a local node or a sinking node according to the node codes;
if the local node is in the local node, the streaming media address of the local node is obtained and sent to the client corresponding to the streaming signaling;
if the sink node is in the sink node, forwarding the stream fetching signaling to the sink node, so that the sink node can acquire the stream media address according to the received stream fetching signaling and send the stream media address to the client corresponding to the stream fetching signaling.
Preferably, before forwarding the stream fetching signaling to the sink node, the method further comprises:
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 stream fetching signaling to the sink node is entered.
Preferably, after determining the node to which the node belongs, the method further comprises:
judging whether the node has the watching authority;
and if the viewing authority is not available, a prompt is sent out.
Preferably, the method further comprises:
and receiving the synchronous 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 stream taking signaling sent by a central node, wherein the stream taking signaling is a signaling forwarded by the central node under the condition of a local node according to node coding judgment obtained by the stream taking signaling;
and obtaining the streaming media address of the local node and sending the streaming media address to the client corresponding to the streaming signaling.
Preferably, the obtaining the streaming media address includes:
obtaining available service information in a streaming media cluster through an STDU_scheduler;
and selecting streaming media service from available services according to a load balancing principle, and acquiring an 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 device, which is applied to a central node, and includes:
the first acquisition module is used for acquiring streaming 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 through 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 sink node when the current equipment is at the sink node, so that the sink node can 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, including:
the receiving module is used for receiving the stream taking signaling sent by the central node, wherein the stream taking signaling is the signaling forwarded by the central node under the condition of the local node according to the node code judgment obtained by the stream taking signaling;
the third acquisition module is used for acquiring the streaming media address of the local node;
and the third sending module is used for sending the obtained 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 on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the streaming media transmission method are implemented.
The application provides a streaming media transmission method, which comprises the steps of firstly obtaining streaming taking signaling; then, obtaining node codes according to the streaming taking signaling, and judging whether the current equipment is a local node or a sinking node according to the node codes; if the local node is in the local node, the streaming media address of the local node is obtained and sent to the client corresponding to the streaming signaling; if the sink node is in the sink node, forwarding the stream fetching signaling to the sink node, so that the sink node can acquire the stream media address according to the received stream fetching signaling and send the stream media address to the client corresponding to the stream fetching signaling. The method acquires the streaming media address and sends the streaming media address to the client so that the client establishes connection with the streaming media address and acquires the data stream, when the equipment is at the sink node, the data stream of the sink node is not required to be transmitted to the center node, the center node provides service, the client directly establishes connection with the sink node, the data stream is acquired, the waste of network bandwidth is reduced in a nearby stream acquisition mode, and the data access speed is improved.
In addition, the streaming media transmission device, the electronic equipment and the media provided by the application correspond to the streaming media transmission method, and the effects are as above.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments herein without making any inventive effort are intended to fall within the 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 adopting a nearby streaming mode.
In order to provide a better understanding of the present application, those skilled in the art will now make further details of the present application with reference to the drawings and detailed description.
Fig. 1 is a flowchart of a streaming media transmission method applied to a central node.
As shown in fig. 1, the method includes:
s1: and obtaining stream fetching signaling.
In this embodiment, the streaming media address is obtained by performing a corresponding operation according to the streaming media access command by the central node when the streaming media access command is sent by the user through the client.
S2: and obtaining node codes according to the stream fetching signaling, and judging whether the current equipment is at a local node or a sinking node according to the node codes.
After receiving the stream fetching signaling, obtaining codes of all nodes according to the stream fetching signaling, and judging whether the current equipment is a local node or a sinking node according to the node codes and the equipment information. It should be noted that, in this embodiment, the local node is a central node, the node code is used to characterize the position of the node, and the current device refers to the device that the client plays the path of the data stream, and belongs to the front-end camera.
S3: if the local node is in the local node, the streaming media address of the local node is obtained and sent to the client corresponding to the streaming signaling.
In this embodiment, when the current device is at the local node, the current device issues a stream fetching signaling to a local stream media scheduling service (stdu_scheduler), and the stdu_scheduler obtains available service information in a stream media cluster of the local node according to local node coding, and further selects a suitable stream media service from the available service information according to a load balancing principle to provide a stream media address. After the local node obtains the stream media address, the stream media address is sent back to the client corresponding to the stream fetching signaling, and after the client receives the stream media address, the stream media transmission and distribution module (Stream Transfer Dispatch Unit, STDU) directly connected with the local node according to the stream media address obtains the data stream. It should be noted that, the load balancing principle includes modes such as minimum connection number, polling, hash, weight, etc., in this embodiment, the streaming media service with the minimum connection number is selected by default, and in specific implementation, the load balancing principle may be selected according to actual situations.
S4: if the sink node is in the sink node, forwarding the stream fetching signaling to the sink node, so that the sink node can acquire the stream media address according to the received stream fetching signaling and send the stream media address to the client corresponding to the stream fetching signaling.
The embodiment provides a streaming media transmission method, which is applied to a central node, and the method comprises the steps of firstly acquiring streaming acquisition signaling; then, obtaining node codes according to the streaming taking signaling, and judging whether the current equipment is a local node or a sinking node according to the node codes; if the local node is in the local node, the streaming media address of the local node is obtained and sent to the client corresponding to the streaming signaling; if the sink node is in the sink node, forwarding the stream fetching signaling to the sink node, so that the sink node can acquire the stream media address according to the received stream fetching signaling and send the stream media address to the client corresponding to the stream fetching signaling. When the equipment is in the center node, the method acquires the stream media address of the center node and sends the stream media address to the client so that the client establishes connection with the center node according to the stream media address to acquire a 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 center node, the center node provides service, the stream media address is sent to the client, the client directly establishes connection with the sink node, and further, the data stream is acquired, the waste of network bandwidth is reduced in a nearby stream acquisition mode, and the data access speed is improved.
Before forwarding the stream fetching signaling to the sink node in the above embodiment, it is necessary to establish a connection relationship between the center node and the sink node, and determine whether the sink 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 stream fetching signaling to the sink node is entered.
In this embodiment, the web end adds the attribute of the sink node through node management, including the node code, the signaling forwarding address, the message synchronization service address, the data synchronization service address and other attribute information of the sink node. The node code of the sink node is used for representing the position of the sink node, so that the center node and the sink node are convenient to establish connection, the signaling forwarding address is an address of the sink node for receiving the streaming signaling forwarded by the center node, the message synchronization service is used for issuing equipment information to the sink node so as to judge whether the equipment is in the sink node, in other words, in the embodiment, the equipment information which needs to be sent through the message synchronization service judges whether the equipment is in the sink node, the data synchronization service is used for reporting the equipment on line, and the information of the sink node is synchronized to the center node. The central node has default node codes, and only attribute information of each sinking node is added without adding. After the node addition is completed, the central node scheduling service (Node Access Service, NAS) actively establishes connection with the signaling receiving client (Node Access Client, NAC) of the sink node according to the attribute information of the sink node, keeps the heart alive, can judge whether the sink node is normal or not through heartbeat notification, displays the state of the sink node at the interface of the client, and is convenient for a user to know.
In this embodiment, connection is established with the sink node according to the node code of the sink node, keep the heart alive, and determine whether the sink node is normal, so as to forward the streaming signaling to the sink node.
After determining the node to which the device belongs 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;
and if the viewing authority is not available, a prompt is sent out.
In this embodiment, after determining the node to which the device belongs, the central node will issue a streaming signaling to the user authentication service (User Authentication Service, UAS), and the UAS will determine whether the node has viewing authority, and if not, will directly return to prompt for no authority. And only after the UAS judges that the node has the viewing authority, the streaming signaling is issued to the STDU_scheduler of the node to acquire the streaming media address.
In the embodiment, after the node to which the device belongs is determined, whether the node has the viewing authority is judged, and when the node does not have the viewing authority, a prompt is sent, so that a user can know and take measures to grant the authority conveniently, and the streaming media address is acquired.
The above embodiment mentions that the attribute information of the sink node includes a data synchronization service address, where the data synchronization service is used for reporting on-line to the device, and synchronizes the information of the sink node to the central node, so that the central node needs to receive the synchronization information sent by the sink node.
The embodiment receives the synchronous information generated by the sink node so as to be convenient for knowing the working progress of the sink node and realize the monitoring and management of the sink node by the central node.
Fig. 2 is a flowchart of a streaming media transmission method applied to a sink node.
As shown in fig. 2, the method includes:
s5: receiving a stream taking signaling sent by a central node, wherein the stream taking signaling is a signaling forwarded by the central node under the condition of a local node according to node coding judgment obtained by the stream taking signaling;
s6: and obtaining 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 authority, the central node communicates with the NAC of the sink node and forwards the streaming signaling to the NAC of the sink node, where the sink node receives the streaming signaling and notifies the stdu_scheduler of the local node, where the stdu_scheduler obtains the available service information in the streaming media cluster of the local node according to the local node code, selects an appropriate streaming media service from the streaming media address according to the load balancing principle, and sends the streaming media address back to the client corresponding to the streaming signaling. Since the load balancing principle has been described in the above embodiments, the description of this embodiment is omitted. Note that, in this embodiment, the local node is a sink node.
The embodiment provides a streaming media transmission method, which is applied to a sink node, and the method comprises the steps of firstly receiving streaming media access signaling sent by a central node, then obtaining a streaming media address of a local node and sending the streaming media address to a client corresponding to the streaming media access signaling, wherein the streaming media access signaling is the signaling forwarded by the current device under the condition of the local node according to node coding judgment obtained by the streaming media access signaling by the central node. When the equipment is at the sink node, the method does not need to transmit the data stream of the sink node to the center node, the center node provides service, the stream media address is sent to the client, the client directly establishes connection with the sink node, and further, the data stream is acquired, the waste of network bandwidth is reduced in a nearby stream taking mode, the data access speed is improved, and the delay of data transmission is reduced.
In the above embodiment, it is mentioned that a streaming media address needs to be acquired, so that a client can directly connect to an STDU of a corresponding node according to the streaming media address to acquire a data stream. The step of obtaining the streaming media address comprises the following steps:
obtaining available service information in a streaming media cluster through an STDU_scheduler;
and selecting streaming media service from available services according to a load balancing principle, and acquiring an address of the STDU as a streaming media address according to the streaming media service.
The step of obtaining the stream media address is described in detail in this embodiment, and the address of the STDU is sent to the client as the stream media address, so that the client establishes a connection with the STDU according to the stream media address to obtain the data stream.
In the foregoing embodiments, the streaming media transmission method is described in detail, and the application further provides a corresponding embodiment of the streaming media transmission device. It should be noted that the present application describes an embodiment of the device portion from two angles, one based on the angle of the functional module and the other based on the angle of the hardware.
Fig. 3 is a block diagram of a streaming media transmission device applied to a central node.
The device comprises:
a first acquisition module 10, configured to acquire streaming signaling;
the judging module 11 is used for judging whether the current equipment is a local node or a sinking node according to the node code obtained by the streaming signaling;
a second obtaining module 12, configured to obtain, when the current device is at the local node, a streaming media address of 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 a 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 device part applied to the center node corresponds to the embodiment of the method part applied to the center node, the embodiment of the device part applied to the center node is referred to the description of the embodiment of the method part applied to the center node, and is not repeated herein.
The streaming media transmission device applied to the central node provided by the embodiment acquires streaming signaling through the first acquisition module; then, judging whether the current equipment is a local node or a sinking node by a judging module according to the node code obtained by the streaming signaling; if the current equipment is at the local node, acquiring a streaming media address of the local node through a second acquisition module, and transmitting the streaming media address to a client corresponding to the streaming signaling through a first transmission module; if the current equipment is at the sink node, sending a stream fetching signaling to the sink node through a second sending module, so that the sink node can acquire a stream media address according to the received stream fetching signaling and send the stream media address to a client corresponding to the stream fetching signaling. When the equipment is at the center node, the device acquires the stream media address of the center node and sends the stream media address to the client so that the client establishes connection with the center node according to the stream media address to acquire a data stream; when the equipment is at the sink node, the device does not need to transmit the data stream of the sink node to the center node, the center node provides service, the stream media address is sent to the client, the client directly establishes connection with the sink node, and further, the data stream is acquired, the waste of network bandwidth is reduced in a nearby stream acquisition mode, and the data access speed is improved.
Fig. 4 is a block diagram of a streaming media transmission device applied to a sink node.
The device comprises:
the receiving module 15 is configured to receive a stream taking signaling sent by a central node, where the stream taking signaling is a signaling forwarded by the central node under the condition of a local node according to a node code judgment obtained by the stream taking signaling;
a third obtaining module 16, configured to obtain a streaming media address of the local node;
and the third sending module 17 is configured to send the obtained streaming media address to a client corresponding to the streaming signaling.
Since the embodiments of the device portion applied to the sink node and the embodiments of the method portion applied to the sink node correspond to each other, the embodiments of the device portion applied to the sink node are referred to the description of the embodiments of the method portion applied to the sink node, and are not repeated herein.
The streaming media transmission device applied to the sink node provided by the embodiment receives the streaming media taking signaling sent by the center node through the receiving module, wherein the streaming media taking signaling is a signaling forwarded by the center node under the condition of a local node according to node coding judgment obtained by the streaming media taking signaling; then, the streaming media address of the local node is acquired through a third acquisition module; and then the obtained stream media address is sent to a client corresponding to the stream fetching signaling through a third sending module. When the equipment is at the sink node, the device does not need to transmit the data stream of the sink node to the center node, the center node provides service, the stream media address is sent to the client, the client directly establishes connection with the sink node, and further, the data stream is acquired, the waste of network bandwidth is reduced in a nearby stream taking mode, the data access speed is improved, and the delay of data transmission 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 for implementing the steps of the streaming media transmission method as mentioned in the above embodiments when executing a computer program.
The electronic device provided in this embodiment may include, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, or the like.
Processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 may be implemented in hardware in at least one of a digital signal processor (Digital Signal Processor, DSP), a Field programmable gate array (Field-Programmable Gate Array, FPGA), a programmable logic array (Programmable Logic Array, PLA). The processor 21 may also comprise a main processor, which is a processor for processing data in an awake state, also called central processor (Central Processing Unit, CPU), and a coprocessor; a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with an image processor (Graphics Processing Unit, GPU) for rendering and rendering of content required to be displayed by the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (Artificial Intelligence, AI) processor for processing computing operations related to machine learning.
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 a computer program 201, where the computer program, when loaded and executed by the processor 21, 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 further include an operating system 202, data 203, and the like, where the storage manner may be transient storage or permanent storage. The operating system 202 may include Windows, unix, linux, among others. The 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 structure shown in fig. 5 is not limiting of the electronic device and may include more or fewer components than shown.
The electronic device provided in this embodiment includes a memory and a processor, where the processor can implement the streaming media transmission method when executing the program stored in the memory, and the effects are as above.
Finally, the present application also provides a corresponding embodiment of the computer readable storage medium. The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the streaming media transmission method described in the above method embodiments (the method 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 will be appreciated that the methods of the above embodiments, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored on a computer readable storage medium. With such understanding, the technical solution of the present application, or a part contributing to the prior art or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium, performing all or part of the steps of the method described in the various embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The computer readable storage medium provided in this embodiment includes the above-mentioned streaming media transmission method, and the effects are the same as above.
The streaming media transmission method, the streaming media transmission device, the electronic equipment and the media provided by the application are described in detail. In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section. It should be noted that it would be obvious to those skilled in the art that various improvements and modifications can be made to the present application without departing from the principles of the present application, and such improvements and modifications fall within the scope of the claims of the present application.
It should also be noted that in this 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.