Media stream transmission method and system in large concurrency scene

Through the management platform, the problem of unstable media streaming transmission in large concurrent scenarios is solved, and the stable transmission of media streams and system fault tolerance is improved.

CN120223967AActive Publication Date: 2025-06-27SHENXUE TECH (HANGZHOU) CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202510704949.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-29
Publication Date
2025-06-27
Estimated Expiration
2045-05-29

AI Technical Summary

Technical Problem

In large concurrency scenarios, media streaming is unstable in the existing technology, and the lower-level platforms cannot truly support concurrency, resulting in media streaming being prone to crashes.

Method used

The devices of the lower platform are grouped through the management platform, and the stream fetching instructions are sent asynchronously within the preset time interval, the media stream is obtained, and the time interval is dynamically adjusted according to the stream fetching success rate to be compatible with platforms that do not support true concurrency.

Benefits of technology

It realizes the stable transmission of media streams between the lower-level platforms and the management platforms, improves the fault tolerance and stability of the system, and avoids media streaming crashes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120223967A_ABST
    Figure CN120223967A_ABST
Patent Text Reader

Abstract

The invention relates to a media stream transmission method and system in a large concurrency scene, the media stream transmission method in the large concurrency scene is applied to a management platform, the management platform is used for receiving a media stream pushed by a subordinate platform, and the method comprises the following steps: grouping equipment of the subordinate platform according to a first maximum concurrency amount of the management platform, each group is traversed for stream taking, and the number of devices in each group is smaller than or equal to the first maximum concurrency amount; traversing the devices in the current group, asynchronously sending a stream taking instruction to the lower-level platform devices in sequence according to a preset time interval, and obtaining a media stream returned by the lower-level platform in response to the stream taking instruction; and in response to completion of traversing of the devices in the current group, traversing the devices in the next group until all the groups are traversed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of media stream transmission, and particularly to a media stream transmission method and system in a large concurrent scenario. Background Art

[0002] The current technical basis of video platforms, live broadcast services, and online meeting systems lies in streaming media concurrency technology. According to the media stream transmission direction, the devices or systems involved are divided into an upper-level platform, a management platform, and a lower-level platform. The lower-level platform has a large degree of autonomy during development, resulting in many uncontrollable factors during the media stream push process. As a result, the lower-level platform that should originally support concurrent operations cannot truly support concurrency. In this case, media stream transmission is prone to crashing in a large concurrent scenario.

[0003] Therefore, in the prior art, there is a problem of unstable media stream transmission in a large concurrent situation. Summary of the Invention

[0004] Embodiments of this application provide a media stream transmission method and system in a large concurrent scenario to at least solve the problem of unstable media stream transmission in the related art in a large concurrent scenario.

[0005] In a first aspect, embodiments of this application provide a media stream transmission method in a large concurrent scenario. The method is applied to a management platform, and the management platform is used to receive media streams pushed by a lower-level platform. The method includes: Group the devices of the lower-level platform according to the first maximum concurrency of the management platform, and traverse each group to fetch streams, where the number of devices in each group is less than or equal to the first maximum concurrency; Traverse the devices in the current group, asynchronously send stream fetching instructions to the lower-level platform devices in sequence at a preset time interval, and obtain the media streams returned by the lower-level platform in response to the stream fetching instructions; In response to the completion of traversing the devices in the current group, traverse the devices in the next group until all groups are traversed.

[0006] In an embodiment, after the traversal of the previous group is completed and before the traversal of the current group starts, the method further includes: Determine the asynchronous stream fetching success rate based on the return results of all stream fetching instructions in the previous group, and update the preset time interval based on the success rate and a preset coefficient.

[0007] In an embodiment, the updating the preset time interval based on the success rate and a preset coefficient includes: In response to the success rate being less than a preset minimum threshold, update the preset time interval based on a magnification factor; In response to the success rate being greater than a preset maximum threshold, update the preset time interval based on a reduction factor.

[0008] In one embodiment, the management platform is further configured to push media streams to a superior platform, and the method further includes: Obtain the second maximum concurrency of the target superior platform and the number of media streams that the management platform has pushed to the target superior platform; Determine the maximum new concurrency based on the number of media streams and the second maximum concurrency.

[0009] In one embodiment, determining the number of media streams that the management platform has pushed to the target superior platform includes: Traverse the play sessions of the management platform. In response to the play session having a session stream and the session stream belonging to the target superior platform, regard the play session as a valid session and calculate the number of valid sessions; Determine the number of media streams that the management platform has pushed to the target superior platform according to the number of valid sessions.

[0010] In one embodiment, the method further includes: Receive a stream fetching instruction from the target superior platform and obtain the concurrency request volume based on the stream fetching instruction; In response to the concurrency request volume being greater than the maximum new concurrency, return and send a channel number exception message to the target superior platform; In response to the concurrency request volume being less than or equal to the maximum new concurrency, generate a media stream, push the media stream to the target superior platform, and end the request.

[0011] In one embodiment, the method further includes: In response to the stream fetching instruction request failing or timing out, end the request; In response to the end of the request, update the concurrency request volume through Redis.

[0012] In a second aspect, an embodiment of the present application provides a media stream transmission system in a large concurrency scenario. The system is applied to a management platform, and the management platform is used to receive media streams pushed by a subordinate platform. The system includes: An obtaining module: configured to group devices of a subordinate platform according to the first maximum concurrency of the management platform, traverse each group to fetch streams, where the number of devices in each group is less than or equal to the first maximum concurrency; A stream fetching module: configured to traverse devices in the current group, asynchronously send stream fetching instructions to subordinate platform devices at a preset time interval, and obtain the media streams returned by the subordinate platform in response to the stream fetching instructions; Traversal module: used to traverse the devices in the next group in response to the completion of device traversal within the current group until all groups are traversed.

[0013] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements a media stream transmission method in a large concurrent scenario as described in the first aspect above.

[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements a media stream transmission method in a large concurrent scenario as described in the first aspect above.

[0015] A media stream transmission method and system in a large concurrent scenario provided by an embodiment of the present application at least have the following technical effects.

[0016] In the present application, asynchronous stream fetching is performed at preset time intervals to provide a certain buffer time for concurrent tasks, so as to be compatible with some platforms that do not support true concurrency, improve the fault tolerance and stability of the system, and thus achieve stable transmission of media streams between the lower-level platform and the management platform.

[0017] Details of one or more embodiments of the present application are presented in the following drawings and description to make other features, objectives, and advantages of the present application more concise and understandable. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application, form a part of the present application, and the illustrative embodiments and descriptions thereof are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings: Figure 1 is a schematic diagram of an application scenario shown according to an exemplary embodiment; Figure 2 is a flowchart of a media stream transmission method in a large concurrent scenario shown according to an embodiment of the present application; Figure 3 is a flowchart of fetching a stream from a lower-level platform shown according to an exemplary embodiment; Figure 4 is a flowchart of a method for adjusting a time interval shown according to an exemplary embodiment; Figure 5 is a flowchart of a method for processing a superior stream fetch shown according to an exemplary embodiment; Figure 6 is a timing diagram of a superior platform stream fetching process shown according to an exemplary embodiment; Figure 7It is a structural block diagram of a media stream transmission system in a large concurrent scenario shown according to an embodiment of the present application; Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0019] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be described and explained below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments provided in the present application without creative efforts fall within the scope of protection of the present application.

[0020] Obviously, the accompanying drawings in the following description are only some examples or embodiments of the present application. For those of ordinary skill in the art, without creative efforts, the present application can also be applied to other similar scenarios based on these drawings. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for those of ordinary skill in the art related to the content disclosed in the present application, some design, manufacturing or production changes based on the technical content disclosed in the present application are only conventional technical means and should not be understood as the content disclosed in the present application being insufficient.

[0021] Referring to "embodiment" in the present application means that the specific features, structures or characteristics described in combination with the embodiment may be included in at least one embodiment of the present application. The phrase appears in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those of ordinary skill in the art explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments without conflict.

[0022] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the ordinary meanings understood by those with ordinary skills in the technical field to which this application belongs. The words such as "a", "an", "one", "the" and the like involved in this application do not indicate a limitation in quantity and may represent a singular or plural number. The terms "include", "comprise", "have" and any variations thereof involved in this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may further include unlisted steps or units, or may further include other steps or units inherent to these processes, methods, products or devices. The similar words such as "connect", "be connected", "couple" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "plurality" involved in this application means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, "A and / or B" may represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after. The terms "first", "second", "third" and the like involved in this application are only used to distinguish similar objects and do not represent a specific order for the objects.

[0023] Figure 1 is a schematic diagram of an application scenario shown according to an exemplary embodiment, as Figure 1 shown, the devices or systems involved are divided into an upper-level platform, a management platform, and a lower-level platform according to the media stream transmission direction. The inventors of this application found in the actual R & D process that the lower-level platform cannot support true concurrency. At this time, the media stream transmission is prone to crash in a large concurrency scenario, affecting the data reading progress and user experience. The inventors guessed that the possible reasons for this problem may include: (1) When the lower-level platform processes the INVITE signaling, it may not use locks and atomic operations, resulting in a race condition when modifying data in multiple threads. (2) Deadlocks are caused due to unreasonable lock granularity, incorrect order, or abnormal blockage in the design of the lower-level platform, resulting in system crashes.

[0024] Based on the above situation, the embodiments of this application provide a media stream transmission method and system in a large concurrency scenario.

[0025] In a first aspect, the embodiments of this application provide a media stream transmission method in a large concurrency scenario. This method is applied to the management platform, and the management platform is used to receive the media stream pushed by the lower-level platform.

[0026] Figure 2 is a flowchart of a media stream transmission method in a large concurrency scenario shown according to an embodiment of this application, asFigure 2 As shown, the method includes: Step S101: Group the devices of the subordinate platform according to the first maximum concurrency of the management platform, and traverse each group to fetch streams. Among them, the number of devices in each group is less than or equal to the first maximum concurrency.

[0027] Optionally, the subordinate platform determines the maximum concurrency of the management platform according to resources such as device performance and network bandwidth, and the priority of the management platform in the target subordinate platform, and sends the maximum concurrency to the management platform. The management platform receives the maximum stream fetching concurrency sent by the subordinate platform. Among them, the number of subordinate platforms is greater than or equal to 1. When there is more than one subordinate platform, the priorities of the management platforms are different. The priority of the management platform is relative to the target subordinate platform, and the priorities of the management platforms corresponding to different target subordinate platforms are different. The subordinate platform determines the priority according to parameters such as the recharge situation and historical maximum concurrency of the management platform in the target subordinate platform.

[0028] In step S101, the management platform groups the devices in the subordinate platform according to the maximum concurrency of the subordinate platform. For example, the image acquisition devices in the subordinate platform are divided into n groups, and the number of devices in each group is A. Among them, both n and A are positive integers, and A represents the maximum concurrency of the subordinate platform. In this way, it is ensured that the concurrency of asynchronous stream fetching is not greater than the maximum concurrency of the management platform, which is beneficial to ensuring the stability of media stream transmission.

[0029] Step S102: Traverse the devices in the current group, and asynchronously send stream fetching instructions to the subordinate platform devices at preset time intervals in sequence, and obtain the media streams returned by the subordinate platform in response to the stream fetching instructions.

[0030] Optionally, traverse each device in the current group. Start the asynchronous stream fetching task of the first device at time T1, start the asynchronous stream fetching task of the second device at time T2, and start the asynchronous stream fetching task of the A-th device at time T c time. The time difference between the current device and the next device is the preset time interval. In this application, the initial preset time interval is set to 100 ms according to the test situation. The initial time interval can also be set to 150 ms, 200 ms, etc. The initial time interval can be set according to the specific actual application situation, and is not limited to the examples listed in this application. In addition, in this application, key frames in the media stream data are extracted after stream fetching, and the stream fetching task ends after key frame extraction, and the callback of the asynchronous stream fetching task is processed.

[0031] In this way, in the case where the subordinate platform is configured to support asynchronous tasks but cannot truly implement the concurrency function, a certain time interval is set to ensure that the subordinate platform stably executes the asynchronous stream fetching task, thereby realizing the stable transmission of the media stream between the subordinate platform and the management platform.

[0032] Step S103: In response to the completion of traversing the devices within the current group, traverse the devices within the next group until all groups are traversed. Optionally, traverse each group in sequence, mark all asynchronous tasks as completed after the current group is traversed, and continue to traverse the next group.

[0033] Figure 3 is a flowchart showing the process of fetching a stream from a subordinate platform according to an exemplary embodiment. As Figure 3 shown, the process of fetching a stream from a subordinate platform specifically includes: dividing the devices of the subordinate platform into n groups, with the size of each group being the first maximum concurrency A of the current platform. Then traverse the n groups to fetch the stream. During the process of traversing each group, set the counter count = A to control the number of traversals within the group, and create a Promise instance to enter the async executor to traverse A devices to fetch the stream.

[0034] When traversing the devices within the group to fetch the stream, perform asynchronous stream fetching at a certain time interval, and there is a certain time interval between the current stream fetching task and the previous stream fetching task. After the stream fetching is completed, extract the key frames from the obtained media stream, then end the stream fetching task, and process the callback of the asynchronous task. Each time a stream fetching is completed, the corresponding counter value is decremented by 1 until the counter value is 0, indicating that all devices within the current group have been traversed, and resolve the Promise. Then traverse the devices in the next group to fetch the stream until all groups are traversed, and end the loop.

[0035] In one example, after the previous group is traversed and before the current group traversal starts, the method further includes: Step S201: Determine the success rate of asynchronous stream fetching based on the return results of all stream fetching instructions in the previous group.

[0036] Step S202: Update the preset time interval based on the success rate and a preset coefficient.

[0037] Optionally, the initial preset time interval is determined according to the test situation, but the time interval during the asynchronous stream fetching process can also be adjusted according to the application situation. Specifically, after the previous group is traversed, calculate the ratio of the number of successfully fetched tasks to the total number of tasks in the previous group as the success rate, update the preset time interval based on the success rate, and apply the updated preset time interval to the current group.

[0038] In one example, Step S202 includes: Step S2021: In response to the success rate being less than the preset minimum threshold, update the preset time interval based on the amplification factor.

[0039] Step S2022, in response to the success rate being greater than the preset maximum threshold, update the preset time interval based on a reduction factor.

[0040] Optionally, when the success rate is less than the preset minimum threshold, it indicates that the current preset time interval is too small to stably implement the asynchronous task, and the time interval needs to be increased; when the success rate is greater than the preset maximum threshold, it indicates that the current success rate is relatively high, and the current time interval is sufficient to stably implement the asynchronous task. In order to further improve the transmission efficiency on the premise of ensuring the success rate of the asynchronous task, the time interval needs to be reduced to further traverse and adjust the preset time interval.

[0041] As an example, the specific process of adjusting the time interval includes: setting the initial time interval timeInterval, the minimum time interval minInterval, the maximum time interval maxInterval, the minimum threshold of the success rate, and the maximum threshold of the success rate. In this application, considering that it is necessary to ensure the stability of media stream transmission while minimizing the time to be compensated to ensure data transmission efficiency, the time interval is set between 50ms and 1000ms. Then set the maximum concurrency A of the upper-level platform, and group the devices of the lower-level platform according to the maximum concurrency. The number of groups n = the number of devices / A.

[0042] It should be noted that the setting parameters of the time interval, the success rate threshold parameters, the concurrency number, etc. involved above can be set according to the actual application scenario, and are not limited to the examples listed in this application.

[0043] After setting the above parameters, dynamically adjust the time interval. Figure 4 is a flowchart of a method for adjusting the time interval shown according to an exemplary embodiment. As Figure 4 shown, after setting the parameters, traverse each group. During the process of traversing each group, control A concurrent tasks with the initial time interval through Promise and a counter. Record whether the processing result of each concurrent task in the current group is in a failed state or a successful state, and calculate the success rate of the current group according to the number of successful tasks and the total number of tasks.

[0044] Judge whether the success rate of the current group is less than the minimum success rate threshold. If so, it indicates that the current preset time interval is too small to stably implement the asynchronous task, and increase the time interval through an amplification factor. The amplification factor can be set according to the actual application scenario. If the amplified time interval is greater than the maximum time interval, then use the maximum time interval as the updated time interval.

[0045] If the success rate of the current group is not less than the minimum success rate threshold, then it is determined whether the success rate is greater than the maximum success rate threshold. If so, it indicates that the current success rate is relatively high and the current time interval is sufficient to stably implement the asynchronous task. In order to further improve the transmission efficiency on the premise of ensuring the success rate of the asynchronous task, the time interval is reduced by a reduction factor. The reduction factor can be set according to the actual application scenario. If the reduced time interval is less than the minimum time interval, the minimum time interval is used as the updated time interval.

[0046] Traverse the next group at the updated time interval until all groups are traversed to obtain the final optimal time interval.

[0047] In this way, the time interval of the asynchronous stream fetching task is dynamically updated according to the stream fetching success rate of each group to determine the optimal time interval, so as to ensure the transmission efficiency while ensuring the success rate of the asynchronous task.

[0048] Refer again to Figure 1 In one example, the management platform is further used to push media streams to a superior platform. At this time, the method further includes: Step S104, obtain the second maximum concurrency of the target superior platform and the number of media streams that the management platform has pushed to the target superior platform.

[0049] Optionally, the management platform determines the maximum stream fetching concurrency of the target superior platform according to resources such as performance and network bandwidth, and the priority of the target superior platform in the management platform. The number of superior platforms is greater than or equal to 1. The priority of the superior platform is relative to the management platform, and different superior platforms have different corresponding priorities. The management platform determines the priority according to parameters such as the recharge situation and historical maximum concurrency of the target superior platform in the management platform.

[0050] In one example, determining the number of media streams that the management platform has pushed to the target superior platform in step S104 includes: Traverse the play sessions of the management platform. In response to the play session having a session stream and the session stream belonging to the target superior platform, regard the play session as a valid session and calculate the number of valid sessions. Determine the number of media streams that the management platform has pushed to the target superior platform according to the number of valid sessions.

[0051] Optionally, the number of valid sessions is taken as the number of media streams that have been pushed to the target upper-level platform. In the platform cascading scenario, audio and video playback involves multi-level platform signaling interaction, media stream transmission, and dynamic resource allocation. Existing technologies generally rely on SIP signaling session management (such as INVITE / BYE signaling counting). In case of network anomalies, device failures, or interruption of process links, the signaling session may become invalid. However, due to the lack of receipt of the session end signaling, the invalid session will still be regarded as a valid session, resulting in inaccurate counting of valid sessions. This example determines the number of media streams pushed to the target upper-level platform by the number of session streams, which can accurately calculate the number of valid sessions, avoid the problem of the concurrency exceeding the maximum concurrency due to inaccurate session counting, and improve the stability of media stream transmission.

[0052] Step S105: Determine the maximum new concurrency based on the number of media streams and the second maximum concurrency.

[0053] Optionally, determine the maximum new concurrency according to the difference between the second maximum concurrency of the target upper-level platform and the number of media streams that have been pushed to the target upper-level platform. By accurately calculating the maximum new concurrency, the concurrency process can be effectively controlled, and the stability of media stream transmission can be improved.

[0054] Figure 5 is a flowchart of a method for processing the upper-level stream fetching according to an exemplary embodiment. Refer to Figure 5 Steps S502 to S509 to determine the number of media streams between the current platform and the upper-level platform. The specific process includes: determining whether there is a session stream in the playback session. If not, the session is regarded as an invalid session. If the session stream exists, it is determined whether the session stream belongs to the target upper-level platform. If it belongs to the target upper-level platform, it is regarded as a valid session stream. The invalid sessions are deleted, and the current media stream number between the management platform and the upper-level platform is determined according to the number of valid sessions. Determine the maximum new concurrency according to the number of media streams and the maximum concurrency of the target upper-level platform. The maximum new concurrency is expressed as newCount = C – currentCount, where currentCount represents the number of media streams that have been pushed to the target upper-level platform; C represents the second maximum concurrency.

[0055] In one example, the method further includes: Step S106: Receive the stream fetching instruction from the target upper-level platform, and obtain the concurrency request volume based on the stream fetching instruction.

[0056] Step S107: In response to the concurrency request volume being greater than the maximum new concurrency, return and send the channel number exception information to the target upper-level platform.

[0057] Step S108: In response to the concurrent request volume being less than or equal to the maximum new concurrency volume, generate a media stream, push the media stream to the target upper-level platform, and end the request.

[0058] Optionally, parse the stream fetching instruction sent by the upper-level platform, and determine the concurrent request volume based on all the stream fetching instructions. Continue to refer to Figure 5 , specifically refer to steps S510 - S514. Use Redis atomic operations to count the concurrent request volume. If the concurrent request volume is greater than the maximum new concurrency volume, immediately return exception prompts such as "concurrency exceeded" and "abnormal number of concurrent channels". If the concurrent request volume is less than or equal to the maximum new concurrency volume, generate a media stream, push the media stream to the target upper-level platform, and end the request, and update the concurrent request volume through Redis.

[0059] In this way, by accurately determining the number of media streams, ensure that the sum of the currently allowed maximum new concurrency volume and the number of media streams does not exceed the maximum concurrency volume. And, the atomicity of Redis ensures an accurate response to new concurrent requests, avoids transmission crashes, and improves the stability of media stream transmission.

[0060] In one example, the method further includes: in response to the failure or timeout of the stream fetching instruction request, end the request. In response to the end of the request, update the concurrent request volume through Redis.

[0061] Optionally, when the request is completed, whether it is successful or failed, decrement the concurrent request quantity to ensure resource release and improve resource utilization.

[0062] This application divides the stream fetching process of the upper-level platform into two stages through steps S104 - S108. Stage 1 (request - response stage): Receive a play request and allocate temporary resources. Stage 2 (media stream transmission stage): Establish a media transmission channel and consume actual resources. Figure 6 is a timing diagram of a stream fetching process of an upper-level platform shown according to an exemplary embodiment. As Figure 6As shown, by querying the streaming media server in real time, the number of media streams being transmitted in the second stage, currentCount, is obtained. The maximum new concurrent volume allowed to enter the first stage, maxRequestCount = C – currentCount, is determined based on the number of media streams. The concurrent request count, requestCount, in the first stage is counted through Redis atomic operations (INCR / DECR). After receiving a request, if requestCount > maxRequestCount, abnormal prompts such as "concurrent limit exceeded" and "abnormal number of concurrent channels" are immediately returned; if the concurrent request volume is less than or equal to the maximum new concurrent volume, a media stream is generated, and the media stream is pushed to the target upper-level platform, and the request ends. When the request is completed, whether it is successful or failed, the concurrent request count, requestCount, is decremented to ensure resource release and improve resource utilization.

[0063] In this way, by steps S104~S108, the number of streaming media is accurately determined, resource leakage caused by signaling anomalies is avoided, and thus the maximum new concurrent volume is dynamically adjusted according to the actual state of the media stream to improve resource utilization. Global control is achieved through Redis counting and the status of the upper-level platform, reducing the system complexity, and the network fluctuations and device state changes can be responded to in real time through Redis. For example, when a camera fails, a request fails, or the network is interrupted, the concurrent request count is automatically released to improve resource utilization.

[0064] In summary, in this application, asynchronous tasks are started at set time intervals through steps S101~S103, which are compatible with some platforms that do not support true concurrency. At the cost of a small time delay, the fault tolerance and stability of the system are improved, thereby realizing the stable transmission of media streams between the lower-level platform and the management platform. By steps S104~S108, the number of effective session streams belonging to the target upper-level platform is judged to accurately determine the number of streaming media, avoiding resource leakage caused by signaling anomalies, and thus the maximum new concurrent volume is dynamically adjusted according to the actual state of the media stream to improve resource utilization. The atomicity of Redis ensures an accurate response to new concurrent requests, avoiding transmission crashes and improving the stability of media stream transmission. Global control is achieved through Redis counting and the status of the upper-level platform, reducing the system complexity, and the network fluctuations and device state changes can be responded to in real time through Redis. For example, when a camera fails, a request fails, or the network is interrupted, the concurrent request count is automatically released to improve resource utilization.

[0065] In a second aspect, an embodiment of the present application provides a media stream transmission system in a large concurrent scenario. The system is applied to a management platform, and the management platform is used to receive media streams pushed by a lower-level platform. Figure 7 It is a structural block diagram of a media stream transmission system in a large concurrent scenario shown according to an embodiment of the present application, as Figure 7As shown in the figure, the system includes: Acquisition module 100: used to group the devices of the subordinate platform according to the first maximum concurrency of the management platform, and traverse each group to fetch streams, where the number of devices in each group is less than or equal to the first maximum concurrency.

[0066] Stream fetching module 200: used to traverse the devices in the current group, asynchronously send stream fetching instructions to the devices of the subordinate platform at preset time intervals in sequence, and obtain the media streams returned by the subordinate platform in response to the stream fetching instructions.

[0067] Traversal module 300: used to, in response to the completion of traversing the devices in the current group, traverse the devices in the next group until all groups are traversed.

[0068] In one example, after the traversal of the previous group is completed and before the traversal of the current group starts, the system further includes: Used to determine the asynchronous stream fetching success rate based on the return results of all stream fetching instructions in the previous group, and update the preset time interval based on the success rate and a preset coefficient.

[0069] In one example, updating the preset time interval based on the success rate and a preset coefficient includes: In response to the success rate being less than the preset minimum threshold, update the preset time interval based on the amplification coefficient.

[0070] In response to the success rate being greater than the preset maximum threshold, update the preset time interval based on the reduction coefficient.

[0071] In one example, the management platform is further used to push media streams to the superior platform, and the system further includes: Acquisition module: used to obtain the second maximum concurrency of the target superior platform, and the number of media streams that the management platform has pushed to the target superior platform.

[0072] Determination module: used to determine the maximum new concurrency based on the number of media streams and the second maximum concurrency.

[0073] In one example, the acquisition module includes: Used to traverse the play sessions of the management platform, and in response to the existence of a session stream in the play session and the session stream belonging to the target superior platform, regard the play session as a valid session and calculate the number of valid sessions.

[0074] Used to determine the number of media streams that the management platform has pushed to the target superior platform according to the number of valid sessions.

[0075] In one example, the system further includes: Used to receive the stream fetching instruction of the target superior platform, and obtain the concurrent request volume based on the stream fetching instruction.

[0076] In response to the concurrent request volume being greater than the maximum new concurrency volume, return and send the channel number exception information to the target superior platform.

[0077] In response to the concurrent request volume being less than or equal to the maximum new concurrency volume, generate a media stream, push the media stream to the target superior platform, and end the request.

[0078] In one example, the system further includes: for ending the request in response to the failure or timeout of the stream fetching instruction request. In response to the end of the request, update the concurrent request volume through Redis.

[0079] In summary, this application starts an asynchronous task by setting a time interval, is compatible with some platforms that do not support true concurrency, and at the cost of a small time delay, improves the fault tolerance and stability of the system, thereby realizing the stable transmission of the media stream between the subordinate platform and the management platform. Accurately determine the number of media streams based on the number of session streams belonging to the target superior platform, avoid resource leakage caused by signaling anomalies, and thus dynamically adjust the maximum new concurrency volume according to the actual state of the media stream to improve resource utilization. The atomicity of Redis ensures the accurate response to new concurrent requests, avoids transmission crashes, and improves the stability of media stream transmission. Global control is achieved through Redis counting and the status of the superior platform, reducing the system complexity, and can also respond to network fluctuations and device status changes in real time through Redis. For example, when a camera fails, a request fails, or the network is interrupted, the concurrent request count is automatically released to improve resource utilization.

[0080] In a third aspect, an embodiment of the present application provides an electronic device. Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements a media stream transmission method in a large concurrency scenario provided by the first aspect. Figure 8 The displayed electronic device 60 is only an example and should not bring any restrictions to the functions and usage scope of the embodiments of the present application.

[0081] The electronic device 60 can be presented in the form of a general computing device. For example, it can be a server device. The components of the electronic device 60 may include, but are not limited to: at least one of the above-mentioned processors 61, at least one of the above-mentioned memories 62, and a bus 63 connecting different system components (including the memory 62 and the processor 61).

[0082] The bus 63 includes a data bus, an address bus, and a control bus.

[0083] The memory 62 may include volatile memory, such as random access memory (RAM) 621 and / or cache memory 622, and may further include read-only memory (ROM) 623.

[0084] The memory 62 may also include a program / utilities 625 having a set (at least one) of program modules 624. Such program modules 624 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment.

[0085] The processor 61 executes various functional applications and data processing by running computer programs stored in the memory 62, such as a media stream transmission method in a large concurrent scenario provided in the first aspect of the present application.

[0086] The electronic device 60 may also communicate with one or more external devices 64 (such as a keyboard, a pointing device, etc.). Such communication may be performed through an input / output (I / O) interface 65. Moreover, the electronic device 60 may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 66. As Figure 8 shown, the network adapter 66 communicates with other modules of the electronic device 60 through the bus 63. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in combination with the electronic device 60, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (redundant array of independent disks) systems, tape drives, and data backup storage systems, etc.

[0087] It should be noted that, although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, such a division is merely exemplary and not mandatory. In fact, according to the embodiments of the present invention, the features and functions of two or more units / modules described above may be embodied in one unit / module. Conversely, the features and functions of one unit / module described above may be further divided and embodied by multiple units / modules.

[0088] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed by a processor, a media stream transmission method in a large concurrent scenario provided in the first aspect is implemented.

[0089] Among them, the readable storage medium may more specifically include, but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0090] In a possible implementation, the present invention can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps of implementing a media stream transmission method in a large concurrent scenario provided by the first aspect.

[0091] Among them, the program code for executing the present invention can be written in any combination of one or more programming languages. The program code can be executed entirely on the user device, partially on the user device, executed as an independent software package, partially on the user device and partially on a remote device, or entirely on a remote device.

[0092] The technical features of the above-described embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0093] The above-described embodiments only express several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.

Claims

1. A media stream transmission method under a large concurrent scenario, characterized in that, The method is applied to a management platform, which is used to receive media streams pushed by subordinate platforms. The method includes: Group the devices of the subordinate platforms according to the first maximum concurrency of the management platform, and traverse each group to fetch streams, where the number of devices in each group is less than or equal to the first maximum concurrency; Traverse the devices in the current group, asynchronously send stream fetching instructions to the subordinate platform devices at preset time intervals in sequence, and obtain the media streams returned by the subordinate platforms in response to the stream fetching instructions; In response to the completion of traversing the devices in the current group, traverse the devices in the next group until all groups are traversed.

2. The media stream transmission method in a large concurrency scenario according to claim 1, characterized in that After the traversal of the previous group is completed and before the traversal of the current group starts, the method further includes: Determine the asynchronous stream fetching success rate based on the return results of all stream fetching instructions in the previous group; Update the preset time interval based on the success rate and a preset coefficient.

3. A media stream transmission method under a large concurrent scenario according to claim 2, characterized in that, The updating the preset time interval based on the success rate and a preset coefficient includes: In response to the success rate being less than a preset minimum threshold, update the preset time interval based on an amplification factor; In response to the success rate being greater than a preset maximum threshold, update the preset time interval based on a reduction factor.

4. A media stream transmission method under a large concurrent scenario according to any one of claims 1 to 3, characterized in that The management platform is further used to push media streams to a superior platform. The method further includes: Obtain the second maximum concurrency of the target superior platform and the number of media streams that the management platform has pushed to the target superior platform; Determine the maximum additional concurrency based on the number of media streams and the second maximum concurrency.

5. A media stream transmission method in a large concurrent scenario according to claim 4, characterized in that, Determining the number of media streams that the management platform has pushed to the target superior platform includes: Traverse the playback sessions of the management platform. In response to the existence of a session stream in the playback session and the session stream belonging to the target superior platform, regard the playback session as a valid session and calculate the number of valid sessions; Determine the number of media streams that the management platform has pushed to the target superior platform according to the number of valid sessions.

6. A media stream transmission method in a large concurrency scenario according to claim 4, characterized in that The method further includes: Receive a stream fetching instruction from the target superior platform, and obtain the concurrency request volume based on the stream fetching instruction; In response to the concurrency request volume being greater than the maximum additional concurrency, return and send a channel number exception message to the target superior platform; In response to the concurrency request volume being less than or equal to the maximum additional concurrency, generate a media stream, push the media stream to the target superior platform, and end the request.

7. A media stream transmission method in a large concurrent scenario according to claim 6, characterized in that The method further includes: In response to the failure or timeout of the stream fetching instruction request, end the request; In response to the end of the request, update the concurrency request volume through Redis.

8. A media stream transmission system under a large concurrent scenario, characterized in that, The system is applied to a management platform, which is used to receive media streams pushed by subordinate platforms. The system includes: An acquisition module: used to acquire the first maximum concurrency of the management platform and the device grouping of the subordinate platforms, and traverse each group, where the number of devices in each group is less than or equal to the first maximum concurrency; A stream fetching module: used to traverse the devices in the current group, asynchronously send stream fetching instructions to the subordinate platform devices at preset time intervals in sequence, and obtain the media streams returned by the subordinate platforms in response to the stream fetching instructions; Traversal module: Used to traverse the devices in the next group in response to the completion of traversing the devices in the current group until all groups are traversed.

9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements a media stream transmission method in a large concurrent scenario as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements a media stream transmission method in a large concurrent scenario as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data downloading method and device, computer equipment and storage medium

    CN112954406A

  • Media stream sending method and system, processing equipment and storage medium

    CN113630628A

  • Live broadcast control method and device, video cloud platform and storage medium

    CN116095369A

  • Media stream forwarding method and forwarding device

    CN116527949A

  • Method and system for improving stream recovery efficiency of cascade architecture of video monitoring platform

    CN117834928A