Audio stream forwarding method and system of network broadcasting system
By establishing a mapping relationship between broadcast tasks and playback terminals, and using IP address and type identifiers for audio packet encapsulation, the method addresses inefficiencies in audio stream forwarding, ensuring efficient and flexible delivery.
Patent Information
- Application Number
- CN202510563616.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-07-15
AI Technical Summary
In the prior art, audio stream forwarding is complex and redundant, and it is difficult for the audio forwarding server to forward audio streams efficiently. The terminal access server has complicated responsibilities, which affects the forwarding efficiency and capacity expansion and upgrading of the audio stream.
By assigning a target playback terminal to the broadcast task and building a mapping relationship between the broadcast task identification and the target playback terminal, encapsulate audio packets according to the length of the IP address, and distinguishing audio packets through type identification, the audio forwarding server focuses on audio stream forwarding, simplifying logical calculations.
It improves the efficiency of audio stream forwarding, simplifies the audio stream forwarding process, and improves the forwarding flexibility and cross-site broadcasting capabilities of audio streams.
Smart Images

Figure CN120321059A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of network broadcast audio stream forwarding, and particularly relates to a method and system for forwarding audio streams in a network broadcast system. Background Art
[0002] The network broadcast system uses network technology to transmit audio, and forwards the audio stream generated when playing an audio file or the audio collected by an audio collection terminal to a playback terminal, thereby realizing remote audio transmission and playback. In some application scenarios, the forwarding of audio streams even requires cross-server support. For example, the subway central control station needs to broadcast to terminals at multiple stations on multiple lines.
[0003] Currently, the forwarding of audio streams is mainly completed by the terminal access server. First, the collected audio stream is forwarded to the audio forwarding server, and then the audio forwarding server forwards the audio stream to the playback terminal for playback through the terminal access server. However, the forwarding of audio streams is complex and redundant, from the audio forwarding server to the terminal access server and then to the playback terminal. Moreover, the terminal access server only caches the terminal information of the terminals accessing this server, and does not cache the terminal information of other stations. If the audio stream of this station needs to be forwarded to other stations, more information is required to support a more complex operation process. In addition, the responsibilities of the terminal access server are not single. It not only needs to interact with terminal instructions to complete the functions of opening and closing audio playback for the terminal, but also forwards the stream to the terminal. This is not convenient for upgrading and expanding the audio forwarding server and cannot forward efficiently. Summary of the Invention
[0004] This application proposes a method and system for forwarding audio streams in a network broadcast system, which can solve the problems in the prior art that the forwarding of audio streams is complex and redundant, and it is difficult for the audio forwarding server to forward audio streams efficiently.
[0005] The first aspect of this application provides a method for forwarding audio streams in a network broadcast system, and the method includes:
[0006] Allocating one or several target playback terminals for a broadcast task, and constructing a mapping relationship between the broadcast task identifier and the target playback terminals;
[0007] Encapsulating the audio stream of the broadcast task according to the lengths of the IP addresses of all target playback terminals to obtain an encapsulated audio packet, and sending the audio packet to the audio forwarding server;
[0008] According to the type identifier of the audio packet and the mapping relationship, sending the audio stream of the broadcast task to each target playback terminal through the audio forwarding server.
[0009] In the above solution, a mapping relationship is constructed between the broadcast task and the corresponding target playback terminals through the unique broadcast task identifier and the IP addresses of the corresponding target playback terminals, so as to clarify which playback terminals the audio packets should be forwarded to for playback. Then, according to the lengths of the IP addresses of all target playback terminals, the corresponding audio stream encapsulation method is selected to obtain audio packets containing different information, and the audio packets are distinguished by the type identifier. Finally, the audio forwarding server only needs to focus on the forwarding of the audio stream, and confirm the corresponding audio stream forwarding method through the mapping relationship and the type identifier of the audio packet, which greatly improves the forwarding efficiency of the audio stream.
[0010] In a possible implementation method of the first aspect, one or several target playback terminals are assigned to the broadcast task, and a mapping relationship is constructed between the broadcast task identifier and the target playback terminals, specifically:
[0011] The corresponding target playback terminals are assigned to the submitted broadcast task through preemptive scheduling;
[0012] A corresponding mapping relationship is constructed between the broadcast task identifier of the broadcast task and the IP addresses of all target playback terminals.
[0013] The above solution constructs a mapping relationship between the unique broadcast task identifier and the IP addresses of all target playback terminals, determines which playback terminals the audio stream needs to be forwarded to, and provides data support for the forwarding operation of the audio forwarding server.
[0014] In a possible implementation method of the first aspect, the audio stream of the broadcast task is encapsulated according to the lengths of the IP addresses of all target playback terminals to obtain the encapsulated audio packets, specifically:
[0015] Calculate the total length of the IP addresses of all target playback terminals, and calculate the sum of the total length and the data amounts of the preset audio stream header and the audio stream length;
[0016] If the sum of the data amounts is less than the preset maximum transmission unit, the IP addresses of all target playback terminals are encapsulated into the audio stream to obtain the first audio packet containing the IP addresses of all target playback terminals;
[0017] If the sum of the data amounts is greater than or equal to the preset maximum transmission unit, the broadcast task identifier is encapsulated into the audio stream to obtain the second audio packet containing the broadcast task identifier, and the mapping relationship is cached in the audio forwarding server.
[0018] The above solution first calculates the sum of the data volumes of all IP addresses, the audio stream header, and the audio stream length, and compares this sum of lengths with the maximum transmission unit. If it is less than the maximum transmission unit, it means that the above information can be fully encapsulated in the audio packet, and then all IP addresses can be directly encapsulated, facilitating the subsequent audio forwarding server to directly extract the IP addresses to complete the forwarding of the audio stream. If it is greater than or equal to the maximum transmission unit, it means that the above information is too long. Therefore, the broadcast task identifier is selected to be encapsulated in the audio packet, and the IP addresses of the target playback terminals are indirectly obtained through the broadcast task identifier and the mapping relationship in the subsequent process to complete the forwarding of the audio stream.
[0019] In a possible implementation method of the first aspect, the first audio packet and the second audio packet are specifically:
[0020] Generate a type identifier for the audio packet according to the content of the audio packet; wherein, the type identifier includes a first type identifier and a second type identifier;
[0021] Encapsulate the first type identifier into the audio stream header of the first audio packet, and encapsulate the second type identifier into the audio stream header of the second audio packet.
[0022] The above solution provides support for the audio forwarding server to identify whether the audio packet contains the IP addresses of the target playback terminals by encapsulating two different type identifiers into the audio stream header, simplifying the forwarding process of the audio stream.
[0023] In a possible implementation method of the first aspect, according to the type identifier of the audio packet and the mapping relationship, the audio stream of the broadcast task is sent to each target playback terminal by the audio forwarding server, specifically:
[0024] If the type identifier is the first type identifier, extract all the IP addresses of the target playback terminals from the audio packet by the audio forwarding server, and send the audio packet to each target playback terminal according to the IP addresses of the target playback terminals;
[0025] If the type identifier is the second type identifier, send the audio packet to each target playback terminal by the audio forwarding server according to the mapping relationship.
[0026] In a possible implementation method of the first aspect, sending the audio packet to each target playback terminal by the audio forwarding server according to the mapping relationship is specifically:
[0027] Extract the broadcast task identifier from the audio packet by the audio forwarding server;
[0028] Obtain the IP addresses of all the target playback terminals according to the broadcast task identifier and the mapping relationship;
[0029] Send the audio packet to each corresponding target playback terminal according to the IP addresses of all the target playback terminals.
[0030] In the above solution, when the audio packet only contains a broadcast task identifier, the IP address of the corresponding target playback terminal is determined through the broadcast task identifier and the mapping relationship, enabling the audio forwarding server to successfully send the audio packet to the corresponding target playback terminal.
[0031] In a possible implementation method of the first aspect, it further includes:
[0032] If the audio stream of the broadcast task needs to be sent to other sites, add the IP address of the audio forwarding server of other sites to the mapping relationship to construct the mapping relationship between the broadcast task identifier and the audio forwarding server of other sites.
[0033] In the above solution, in a cross-site broadcast environment, only by adding the IP address of the audio forwarding server of other sites to the mapping relationship can the cross-site broadcast of the audio stream be completed, improving the flexibility of audio stream forwarding.
[0034] The second aspect of this application provides an audio stream forwarding system for a network broadcast system. The system includes: a mapping relationship construction module, an audio packet encapsulation module, and an audio packet forwarding module;
[0035] Among them, the mapping relationship construction module is used to allocate one or several target playback terminals for the broadcast task and construct the mapping relationship between the broadcast task identifier and the target playback terminal;
[0036] The audio packet encapsulation module is used to encapsulate the audio stream of the broadcast task according to the lengths of the IP addresses of all target playback terminals to obtain the encapsulated audio packet, and send the audio packet to the audio forwarding server;
[0037] The audio packet forwarding module is used to send the audio stream of the broadcast task to each target playback terminal through the audio forwarding server according to the type identifier of the audio packet and the mapping relationship.
[0038] The third aspect of this application provides a terminal device. The device includes: a terminal device, including a processor and a memory. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of any one of the methods for forwarding the audio stream of the network broadcast system in the embodiments of this application.
[0039] A fourth aspect of the present application provides a storage medium storing computer-readable program code which, when executed, implements the steps of any one of the audio stream forwarding methods of the network broadcast system embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] To more clearly illustrate the technical solutions of the present application, the accompanying drawings required for the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.
[0041] Figure 1 is a specific flowchart of an audio stream forwarding method for a network broadcast system provided by an embodiment of the present application;
[0042] Figure 2 is a schematic diagram of traditional audio stream forwarding for an audio stream forwarding method for a network broadcast system provided by an embodiment of the present application;
[0043] Figure 3 is a structure diagram of an audio packet for an audio stream forwarding method for a network broadcast system provided by an embodiment of the present application;
[0044] Figure 4 is a specific structure diagram of an audio stream forwarding system for a network broadcast system provided by an embodiment of the present application;
[0045] Figure 5 is a structure diagram of a terminal device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0046] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0047] It should be understood that the step numbers used herein are only for convenient description and are not intended to limit the execution order of the steps.
[0048] First Embodiment
[0049] During the audio stream forwarding process of a network broadcast system, when the audio forwarding server receives an audio packet, it will determine the corresponding target playback terminal through a large number of logical calculations. However, excessive logical calculations will reduce the forwarding efficiency of the audio forwarding server, resulting in audio blocking and delays, and thus causing playback stuttering. Therefore, how to simplify the audio stream forwarding process and enable the audio forwarding server to focus on forwarding the audio stream is one of the main research directions of the embodiments of this application.
[0050] As Figure 1 shown, to solve the problems in the prior art that the cross-site forwarding of audio streams is complex and redundant, and it is difficult for the audio forwarding server to efficiently forward audio streams, the first embodiment of this application provides a schematic flowchart of a method for forwarding audio streams in a network broadcast system. The method for forwarding audio streams in this embodiment includes steps S1 to S3, which are described in detail as follows:
[0051] Step S1, allocate one or several target playback terminals for a broadcast task, and construct a mapping relationship between the broadcast task identifier and the target playback terminal.
[0052] In the traditional audio stream forwarding process, the audio stream forwarding is mainly completed by the terminal access server. The terminal access server not only interacts with the terminal for instructions but also is responsible for the transmission of the audio stream. For a broadcast system with an audio forwarding server, the terminal access server also needs to first forward the collected audio stream to the audio forwarding server, and then forward the audio stream to the playback terminal for playback through the terminal access server. Figure 1 A schematic diagram of traditional audio stream forwarding is provided. As shown in the figure, the terminal access server is responsible for forwarding the collected audio or received audio files, and then forwarding these audio files to the playback terminal for playback. During the process of forwarding the audio files, different instructions need to be processed and corresponding logical calculations need to be performed, and the audio playback function also needs to be opened and closed. Due to the complex responsibilities, it is difficult for the terminal access server to efficiently complete the forwarding of the audio stream.
[0053] Therefore, if the audio forwarding server can focus on forwarding the audio stream and the terminal access server can focus on the logical interaction of instructions, then the logical calculations of the audio forwarding server during the forwarding process will be greatly reduced, effectively improving the forwarding efficiency of the audio stream.
[0054] The embodiments of this application provide an improved solution. By constructing a mapping relationship between the unique identifier of the broadcast task and the target playback terminal, it assists the audio forwarding server to quickly and accurately complete the forwarding of the audio stream.
[0055] Specifically, when the network broadcast system initiates a broadcast task, it first extracts the playback terminals corresponding to the broadcast task from the broadcast task or the corresponding database, and then submits the broadcast task containing the playback terminal information to the terminal access server. Then, the terminal access server assigns corresponding target playback terminals to the submitted broadcast tasks through preemptive scheduling. Among them, due to the actual playback situation, the initially extracted playback terminals may be inconsistent with the subsequently determined target playback terminals. Moreover, to distinguish the broadcast tasks, a unique identifier is also generated for the broadcast tasks, namely the broadcast task identifier.
[0056] In addition, the terminal access server will assign one or more target playback terminals to the broadcast task according to actual requirements. For example, when the network broadcast system only wants one playback terminal to play background music, only one playback terminal will be assigned to the broadcast task.
[0057] After the target playback terminals are assigned, the terminal access server will, according to the received instructions, construct the mapping relationship between the broadcast task identifier and the IP addresses of each target playback terminal. Therefore, the audio forwarding server can find the IP addresses of the target playback terminals corresponding to the audio stream according to the broadcast task identifier, so as to complete the forwarding of the audio stream.
[0058] Step S2, encapsulate the audio stream of the broadcast task according to the lengths of the IP addresses of all target playback terminals to obtain the encapsulated audio packets, and send the audio packets to the audio forwarding server.
[0059] After the mapping relationship is constructed, calculate the total length of the IP addresses of all target playback terminals and the sum of the data volumes of the preset audio stream header size and audio stream size, and then compare the sum of the data volumes with the pre-set maximum transmission unit to determine the corresponding audio packet encapsulation method. Among them, the maximum transmission unit is also called MTU, that is, Maximum Transmission Unit, which is the maximum size of the data service unit that can be received, and can also be considered as the maximum length of the packet or frame that can be received, generally the default size provided by the operating system to users.
[0060] If the sum of the data volumes is less than the preset maximum transmission unit, encapsulate the IP addresses of all target playback terminals into the audio stream header to obtain the first audio packet containing the IP addresses of all target playback terminals.
[0061] If the sum of the data volumes is greater than or equal to a preset maximum transmission unit, it means that if the IP addresses of all target playback terminals are encapsulated into the audio stream header, the resulting audio packet will be too large and is very likely to exceed the processing range of the forwarding device. Therefore, it is very likely to be rejected for forwarding. So here, the broadcast task identifier is selected to be encapsulated into the audio stream to obtain a second audio packet containing the broadcast task identifier, so as to reduce the size of the second audio packet. Additionally, after generating the second audio packet, the mapping relationship between the broadcast task identifier and the IP address of each target playback terminal is sent to the audio forwarding server for caching, which facilitates directly extracting the corresponding IP address of the target playback terminal through the mapping relationship later.
[0062] The embodiment of the present application provides a structural diagram of the encapsulated audio packet. As Figure 3 shown, the encapsulated audio packet includes an audio stream header type, a task unique identifier (i.e., the broadcast task identifier), a list of target playback terminal IP addresses (including all IP addresses), and other fields. When the audio packet is the second audio packet, the list of target playback terminal IP addresses is empty.
[0063] As an improvement to the above solution, in order to facilitate the audio forwarding server to quickly distinguish the type of the audio packet in the future, the embodiment of the present application also adds a type identifier to the audio stream header when encapsulating the audio packet. According to the type identifier, the audio forwarding server can confirm whether to directly extract the IP address of the target playback terminal from the audio stream header, which simplifies the audio forwarding process and improves the audio forwarding efficiency.
[0064] Specifically, a first type identifier is generated for the first audio packet and encapsulated into the audio stream header; a second type identifier is generated for the second audio packet and encapsulated into the audio stream header. Then when the audio forwarding server parses the audio packet, it first extracts the audio stream header of this audio packet to confirm the type of the audio packet, and then determines the subsequent audio stream forwarding steps. The audio stream header type in Figure 3 is the type identifier.
[0065] Step S3, according to the type identifier of the audio packet and the mapping relationship, the audio stream of the broadcast task is sent to each of the target playback terminals through the audio forwarding server.
[0066] When the audio forwarding server receives an audio packet, it first extracts the type identifier from the audio stream header of the audio packet to confirm whether it is the first audio packet or the second audio packet.
[0067] If it is the first audio packet, it means that all the IP addresses of the target playback terminals have been encapsulated in this audio packet, and these IP addresses can be directly extracted for audio stream forwarding, and the audio stream is quickly sent to all target playback terminals for playback.
[0068] If it is the second audio packet, it means that no IP address of any target playback terminal is encapsulated in the audio packet. It is necessary to directly extract the type identifier of the audio packet, and based on the type identifier and the mapping relationship between the pre-cached broadcast task identifier and the target playback terminal, obtain the IP addresses of all target playback terminals, and then complete the forwarding of the audio stream.
[0069] When the broadcast task ends, the terminal access server will receive a notice of task end. At this time, the terminal access server will notify the audio forwarding server to delete the cached mapping relationship.
[0070] If it is necessary to record or perform other monitoring operations on the broadcast of a broadcast task, only the IP address of the recording server or the monitoring server needs to be added to the mapping relationship. Similarly, if you do not want a certain terminal to play this task, the IP address of the terminal can be removed from the mapping relationship. Through this solution, the monitoring and recording functions can be efficiently implemented.
[0071] Because the mapping relationship between the broadcast task identifier and the target playback terminal is pre-constructed, the audio forwarding server can focus on the audio forwarding work and does not need to perform logical calculations to determine the target playback terminal for forwarding, simplifying the audio stream forwarding process.
[0072] As an improvement to the above solution, the embodiments of the present application also consider the complexity of cross-site forwarding. Therefore, a solution for simplifying cross-site forwarding is also provided, specifically:
[0073] When the broadcast task needs to be played across sites, only the IP address of the audio forwarding server of other sites needs to be added to the mapping relationship. When the audio forwarding server receives an audio packet, it will forward the audio packet to the audio forwarding server of other sites according to the mapping relationship. The audio forwarding server of other sites only needs to parse the audio stream header to complete the subsequent forwarding steps.
[0074] In addition, when initiating a cross-site broadcast task, it is also necessary to classify the corresponding target playback terminals by site. For example, there are 10 stations on a subway line, and a broadcast system is deployed at each station. Now it is necessary to initiate a broadcast task from Station 1 to all playback terminals at the 10 stations on this line. Therefore, it is necessary to organize the target playback terminals of this broadcast task by site, that is, this broadcast task will include the playback terminals at Station 1, the playback terminals at Station 2,..., and the playback terminals at Station 10. When initiating the broadcast task, Station 1 will send this playback instruction to the broadcast systems at these 10 stations respectively, and they will execute this task independently and establish the mapping relationship between this task and all target playback terminals. When an audio forwarding server receives an audio packet of this task, the audio forwarding server reads from this mapping relationship which playback terminals this audio packet should be forwarded to.
[0075] According to the above solution, the simplicity and ease of use of cross-site playback are solved, and efficient playback of cross-site broadcasts is achieved.
[0076] Implementing the embodiments of the present application has the following beneficial effects:
[0077] In the embodiments of the present application, a corresponding mapping relationship is constructed between the broadcast task and the corresponding target playback terminals through the unique broadcast task identifier and the IP address of the corresponding target playback terminals, so as to clarify which playback terminals the audio packet should be forwarded to for playback. Then, according to the length of the IP addresses of all target playback terminals, the corresponding audio stream encapsulation method is selected to obtain audio packets containing different information, and the audio packets are distinguished by the type identifier. Finally, the audio forwarding server only needs to focus on the forwarding of the audio stream, and confirms the corresponding audio stream forwarding method through the mapping relationship and the type identifier of the audio packet, which greatly improves the forwarding efficiency of the audio stream. Moreover, when dealing with cross-site broadcasts, only the IP addresses of the audio forwarding servers at other sites need to be added to the constructed mapping relationship to achieve cross-site broadcasts, which improves the flexibility of audio stream forwarding.
[0078] Second Embodiment
[0079] Furthermore, in order to execute the audio stream forwarding system of the network broadcast system corresponding to the above method embodiment to achieve the corresponding functions and technical effects, Figure 4 A structural diagram of an audio stream forwarding system of a network broadcast system is provided. For the sake of clarity, only the parts related to this embodiment are shown. The system provided by the embodiments of the present application includes:
[0080] A mapping relationship construction module 201, configured to allocate one or more target playback terminals for a broadcast task and construct a mapping relationship between the broadcast task identifier and the target playback terminals.
[0081] In the traditional audio stream forwarding process, the audio stream forwarding is mainly completed by the terminal access server. The terminal access server not only interacts with the terminal for instructions but also is responsible for the transmission of the audio stream. For a broadcast system with an audio forwarding server, the terminal access server also needs to first forward the collected audio stream to the audio forwarding server and then forward the audio stream to the playback terminal for playback through the terminal access server. The terminal access server also needs to process different instructions and perform corresponding logical calculations during the process of forwarding the audio file, and also needs to open and close the audio playback function. Due to the complex responsibilities, it is difficult for the terminal access server to efficiently complete the forwarding of the audio stream.
[0082] Therefore, if the audio forwarding server can be made to focus on forwarding the audio stream and the terminal access server can focus on the logical interaction of instructions, then the logical calculations during the forwarding process of the audio forwarding server will be greatly reduced, effectively improving the forwarding efficiency of the audio stream.
[0083] The embodiment of the present application provides an improved solution, which assists the audio forwarding server to quickly and accurately complete the forwarding of the audio stream by constructing a mapping relationship between the unique identifier of the broadcast task and the target playback terminal.
[0084] Specifically, when the network broadcast system initiates a broadcast task, first extract the playback terminal corresponding to the broadcast task from the broadcast task or the corresponding database, and then submit the broadcast task containing the playback terminal information to the terminal access server. Then the terminal access server assigns the corresponding target playback terminal to the submitted broadcast task through preemptive scheduling. Among them, due to the actual playback situation, the initially extracted playback terminal may be inconsistent with the subsequently determined target playback terminal. Moreover, in order to distinguish the broadcast task, a unique identifier, that is, the broadcast task identifier, is also generated for the broadcast task.
[0085] In addition, the terminal access server will assign one or more target playback terminals to the broadcast task according to actual requirements. For example, when the network broadcast system only wants one playback terminal to play background music, only one playback terminal will be assigned to the broadcast task.
[0086] After the target playback terminal is assigned, the terminal access server will, according to the received instructions, construct a mapping relationship between the broadcast task identifier and the IP address of each target playback terminal. Therefore, the audio forwarding server can find the IP address of the target playback terminal corresponding to the audio stream according to the broadcast task identifier, thereby completing the forwarding of the audio stream.
[0087] The audio packet encapsulation module 202 is used to encapsulate the audio stream of the broadcast task according to the lengths of the IP addresses of all target playback terminals to obtain the encapsulated audio packets, and send the audio packets to the audio forwarding server.
[0088] After the mapping relationship is constructed, calculate the total length of the IP addresses of all target playback terminals and the sum of the data volumes of the preset audio stream header size and the audio stream size, and then compare the sum of the data volumes with the preset maximum transmission unit to determine the corresponding audio packet encapsulation method. Among them, the maximum transmission unit, also known as MTU, that is, Maximum Transmission Unit, is the maximum size of the data service unit that can be accepted, and can also be considered as the maximum length of the packet or frame that can be accepted. Generally, it is the default size provided by the operating system to users.
[0089] If the sum of the data volumes is less than the preset maximum transmission unit, encapsulate the IP addresses of all target playback terminals into the audio stream header to obtain a first audio packet containing the IP addresses of all target playback terminals.
[0090] If the sum of the data volumes is greater than or equal to the preset maximum transmission unit, it means that if the IP addresses of all target playback terminals are encapsulated into the audio stream header, the resulting audio packet will be too large and is very likely to exceed the processing range of the forwarding device. Therefore, it is very likely to be rejected for forwarding. So here, the broadcast task identifier is selected to be encapsulated into the audio stream to obtain a second audio packet containing the broadcast task identifier to reduce the size of the second audio packet. In addition, after generating the second audio packet, the mapping relationship between the broadcast task identifier and the IP address of each target playback terminal will be sent to the audio forwarding server for caching, which is convenient for directly extracting the corresponding IP address of the target playback terminal through the mapping relationship later.
[0091] Among them, the encapsulated audio packet includes an audio stream header type, a task unique identifier (i.e., the broadcast task identifier), a target playback terminal IP list (including all IP addresses), and other fields. When the audio packet is the second audio packet, the target playback terminal IP list is empty.
[0092] As an improvement of the above solution, in order to facilitate the audio forwarding server to quickly distinguish the type of audio packet in the future, the embodiment of the present application also adds a type identifier to the audio stream header when encapsulating the audio packet. According to the type identifier, the audio forwarding server can confirm whether to directly extract the IP address of the target playback terminal from the audio stream header, which simplifies the audio forwarding process and improves the audio forwarding efficiency.
[0093] Specifically, generate a first type identifier for the first audio packet and encapsulate the first type identifier into the audio stream header; generate a second type identifier for the second audio packet and encapsulate the second type identifier into the audio stream header. Then when the audio forwarding server parses the audio packet, it first extracts the audio stream header of this audio packet to confirm the type of the audio packet, and then determines the next audio stream forwarding step.
[0094] The audio packet forwarding module 203 is used to send the audio stream of the broadcast task to each of the target playback terminals through the audio forwarding server according to the type identifier of the audio packet and the mapping relationship.
[0095] After the audio forwarding server receives an audio packet, it first extracts the type identifier from the audio stream header of the audio packet to confirm whether it is the first audio packet or the second audio packet.
[0096] If it is the first audio packet, it means that the IP addresses of all target playback terminals have been encapsulated in this audio packet, and these IP addresses can be directly extracted for audio stream forwarding, quickly sending the audio stream to all target playback terminals for playback.
[0097] If it is the second audio packet, it means that no IP addresses of target playback terminals are encapsulated in this audio packet. It is necessary to directly extract the type identifier of the audio packet, and according to the type identifier and the mapping relationship between the pre-cached broadcast task identifier and the target playback terminals, obtain the IP addresses of all target playback terminals, and then complete the audio stream forwarding.
[0098] When the broadcast task ends, the terminal access server will receive a notification of the task end. At this time, the terminal access server will notify the audio forwarding server to delete the cached mapping relationship.
[0099] If it is necessary to record the broadcast of a broadcast task or perform other monitoring operations, only the IP addresses of the recording server or the monitoring server need to be added to the mapping relationship. Similarly, if you do not want a certain terminal to play this task, the IP address of this terminal can be removed from the mapping relationship. Through this solution, the monitoring and recording functions can be efficiently implemented.
[0100] Because the mapping relationship between the broadcast task identifier and the target playback terminals is pre-constructed, the audio forwarding server can focus on the audio forwarding work and does not need to perform additional logical calculations to determine the target playback terminals for forwarding, simplifying the audio stream forwarding process.
[0101] If it is necessary to record the broadcast of a broadcast task or perform other monitoring operations, only the IP addresses of the recording server or the monitoring server need to be added to the mapping relationship. Similarly, if you do not want a certain terminal to play this task, the IP address of this terminal can be removed from the mapping relationship. Through this solution, the monitoring and recording functions can be efficiently implemented.
[0102] Because the mapping relationship between the broadcast task identifier and the target playback terminals is pre-constructed, the audio forwarding server can focus on the audio forwarding work and does not need to perform additional logical calculations to determine the target playback terminals for forwarding, simplifying the audio stream forwarding process.
[0103] As an improvement to the above solution, the embodiments of the present application also take into account the complexity of cross-site forwarding, and thus also provide a solution to simplify cross-site forwarding, specifically as follows:
[0104] When a broadcast task needs to be played across sites, only the IP address of the audio forwarding server of other sites needs to be added to the mapping relationship. When the audio forwarding server receives an audio packet, it will forward the audio packet to the audio forwarding server of other sites according to the mapping relationship. The audio forwarding server of other sites only needs to parse the audio stream header to complete the next forwarding step.
[0105] In addition, when initiating a cross-site broadcast task, the corresponding target playback terminals also need to be classified by site. For example, there are 10 stations on a subway line, and a broadcast system is deployed at each station. Now, a broadcast task needs to be initiated from Station 1 to all playback terminals at the 10 stations on this line. Therefore, the target playback terminals of this broadcast task need to be organized by site, that is, this broadcast task will include the playback terminals of Station 1, the playback terminals of Station 2,..., the playback terminals of Station 10. When initiating the broadcast task, Station 1 will send this playback instruction to the broadcast systems of these 10 stations respectively, and they will execute this task independently and establish the mapping relationship between this task and all target playback terminals. When an audio forwarding server receives an audio packet of this task, the audio forwarding server reads from this mapping relationship which playback terminals this audio packet should be forwarded to.
[0106] According to the above solution, the simplicity and ease of use of cross-site playback are solved, and efficient playback of cross-site broadcasts is achieved.
[0107] Implementing the embodiments of the present application has the following beneficial effects:
[0108] In the embodiments of the present application, a corresponding mapping relationship is constructed between the broadcast task and the corresponding target playback terminals through a unique broadcast task identifier and the IP address of the corresponding target playback terminal to clarify which playback terminals the audio packet should be forwarded to for playback. Then, according to the length of the IP addresses of all target playback terminals, the corresponding audio stream encapsulation method is selected to obtain audio packets containing different information, and the audio packets are distinguished by the type identifier. Finally, the audio forwarding server only needs to focus on the forwarding of the audio stream, and confirm the corresponding audio stream forwarding method through the mapping relationship and the type identifier of the audio packet, greatly improving the forwarding efficiency of the audio stream. Moreover, when dealing with cross-site broadcasts, only the IP address of the audio forwarding server of other sites needs to be added to the constructed mapping relationship to achieve cross-site broadcasts, improving the flexibility of audio stream forwarding.
[0109] Further, Figure 5 It is a structural diagram of a terminal device provided in an embodiment of the present application. AsFigure 5 As shown, the terminal device 3 of this embodiment includes: at least one processor 30 (only one is shown in Figure 5 ), a memory 31, and a computer program 32 stored in the memory 31 and executable on the at least one processor. When the processor 30 executes the computer program 32, the steps of a method for forwarding an audio stream of a network broadcast system described in any one of the embodiments of the present application can be implemented.
[0110] The terminal device 3 may be a computing device such as a desktop computer, a cloud server, and a laptop computer. The computing device may include, but is not limited to, the processor 30 and the memory 31. Figure 5 This is only an example of the terminal device 3 and does not limit the terminal device 3. It may include more or fewer components than those shown in the figure.
[0111] The embodiment of the present application provides a storage medium that stores computer-readable program code. When the computer-readable program code is executed, the steps of a method for forwarding an audio stream of a network broadcast system described above are implemented.
[0112] The specific embodiments described above further elaborate on the purpose, technical solution, and beneficial effects of the present application. It should be understood that the above are only specific embodiments of the present application and are not used to limit the protection scope of the present application. In particular, for those skilled in the art, any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. An audio stream forwarding method for a network broadcast system, characterized in that, Including: Allocating one or more target playback terminals for a broadcast task, and constructing a mapping relationship between the broadcast task identifier and the target playback terminals; Encapsulating the audio stream of the broadcast task according to the lengths of the IP addresses of all target playback terminals to obtain an encapsulated audio packet, and sending the audio packet to an audio forwarding server; Sending the audio stream of the broadcast task to each of the target playback terminals through the audio forwarding server according to the type identifier of the audio packet and the mapping relationship.
2. The method for forwarding an audio stream of the network broadcast system according to claim 1, characterized in that The step of allocating one or more target playback terminals for a broadcast task and constructing a mapping relationship between the broadcast task identifier and the target playback terminals specifically includes: Allocating corresponding target playback terminals for the submitted broadcast task through preemptive scheduling; Constructing a corresponding mapping relationship between the broadcast task identifier of the broadcast task and the IP addresses of all target playback terminals.
3. The method for forwarding an audio stream of the network broadcast system according to claim 1, characterized in that The step of encapsulating the audio stream of the broadcast task according to the lengths of the IP addresses of all target playback terminals to obtain an encapsulated audio packet specifically includes: Calculating the total length of the IP addresses of all target playback terminals, and calculating the sum of the total length, the data volume of a preset audio stream header, and the audio stream length; If the sum of the data volumes is less than a preset maximum transmission unit, encapsulating the IP addresses of all target playback terminals into the audio stream to obtain a first audio packet containing the IP addresses of all target playback terminals; If the sum of the data volumes is greater than or equal to the preset maximum transmission unit, encapsulating the broadcast task identifier into the audio stream to obtain a second audio packet containing the broadcast task identifier, and caching the mapping relationship in the audio forwarding server.
4. The method for forwarding an audio stream of the network broadcast system according to claim 3, wherein The first audio packet and the second audio packet specifically are: Generating a type identifier for the audio packet according to the content of the audio packet; wherein the type identifier includes a first type identifier and a second type identifier; Encapsulating the first type identifier into the audio stream header of the first audio packet, and encapsulating the second type identifier into the audio stream header of the second audio packet.
5. The method for forwarding an audio stream of the network broadcast system according to claim 1, wherein The step of sending the audio stream of the broadcast task to each of the target playback terminals through the audio forwarding server according to the type identifier of the audio packet and the mapping relationship specifically includes: If the type identifier is the first type identifier, extracting the IP addresses of all target playback terminals from the audio packet through the audio forwarding server, and sending the audio packet to each of the target playback terminals according to the IP addresses of the target playback terminals; If the type identifier is the second type identifier, sending the audio packet to each of the target playback terminals through the audio forwarding server according to the mapping relationship.
6. The method for forwarding an audio stream of a network broadcast system according to claim 5, wherein The step of sending the audio packet to each of the target playback terminals through the audio forwarding server according to the mapping relationship specifically includes: Extracting the broadcast task identifier from the audio packet through the audio forwarding server; Obtaining the IP addresses of all the target playback terminals according to the broadcast task identifier and the mapping relationship; Sending the audio packet to each corresponding target playback terminal according to the IP addresses of all the target playback terminals.
7. The method for forwarding an audio stream of a network broadcast system according to any one of claims 1 to 6, characterized in that, Also including: If it is necessary to send the audio stream of a broadcast task to other sites, the IP address of the audio forwarding server of other sites is added to the mapping relationship to construct a mapping relationship between the broadcast task identifier and the audio forwarding server of other sites.
8. An audio stream forwarding system for a network broadcast system, characterized in that, It includes: a mapping relationship construction module, an audio packet encapsulation module, and an audio packet forwarding module; Among them, the mapping relationship construction module is used to allocate one or several target playback terminals for the broadcast task and construct a mapping relationship between the broadcast task identifier and the target playback terminals; The audio packet encapsulation module is used to encapsulate the audio stream of the broadcast task according to the lengths of the IP addresses of all target playback terminals to obtain the encapsulated audio packet, and send the audio packet to the audio forwarding server; The audio packet forwarding module is used to send the audio stream of the broadcast task to each target playback terminal through the audio forwarding server according to the type identifier of the audio packet and the mapping relationship.
9. A terminal device, characterized in that, It includes a processor and a memory. The memory stores a computer program. When the processor executes the computer program, the steps of an audio stream forwarding method for a network broadcast system according to any one of claims 1 to 7 are implemented.
10. A storage medium, characterized in that, The storage medium stores computer-readable program code. When the computer-readable program code is executed, the steps of an audio stream forwarding method for a network broadcast system according to any one of claims 1 to 7 are implemented.