Video stream port planning distribution and cyclic multiplexing method and system

Through the combination of pointer collision comparison algorithm and Redis/ConcurrentHashMap, the problem of video stream port allocation complexity in the video cloud platform is solved, rapid allocation and cyclic multiplexing are achieved, and the allocation efficiency of system ports is improved.

CN119094679APending Publication Date: 2024-12-06INSPUR COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411038268.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

In the video cloud platform, there are difficulties in rapid allocation and cyclic multiplexing of video streaming ports, resulting in high system port resource utilization and high port allocation complexity, affecting efficiency.

Method used

The video stream port is planned, allocated and reused by pointer collision comparison algorithm. By setting system parameters to reserve continuous port intervals, using Redis and ConcurrentHashMap for port identification encoding and management, to achieve rapid allocation and release of ports.

Benefits of technology

It realizes rapid allocation and cyclic multiplexing of video stream ports, saves system port resources, reduces port allocation complexity, and improves allocation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094679A_ABST
    Figure CN119094679A_ABST
Patent Text Reader

Abstract

The invention discloses a video stream port planning distribution and cyclic multiplexing method and system, belongs to the technical field of port distribution, and aims to solve the technical problem of how to quickly distribute and circularly multiplex video stream ports on a video cloud platform. Comprising the following steps: reserving and planning a system port with continuous intervals to obtain a port interval; all ports in the port interval are coded by using identifiers through a pointer collision comparison algorithm, all port identifier values are initialized, a port identifier value collision subscript is introduced, and the collision subscript value is initialized as a port value on the left side of the port interval; video stream port distribution is carried out based on a pointer collision comparison algorithm, port identification value collision matching is carried out from left to right by taking a port identified by a collision subscript in a port interval as a starting point during distribution, an idle port is distributed, an identification value distributed to the port at present is updated, and when the collision subscript reaches a port value on the right side of the port interval, the port identification value is updated. And resetting the port collided with the subscript identifier as a port interval left side value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of port allocation, in particular to a method and system for planning and allocating video stream ports and cyclic multiplexing. Background Art

[0002] In the video cloud platform, the real-time video or recording of the lower-level devices of the playback platform, as well as the upper-level platform's request to play video or record video to the video cloud platform in the platform cascading function, will involve the allocation of video stream ports.

[0003] How to quickly allocate and cyclically reuse video stream ports on the video cloud platform is a technical problem that needs to be solved. Summary of the invention

[0004] The technical task of the present invention is to address the above shortcomings and provide a method and system for planning, allocating and cyclic multiplexing of video stream ports to solve the technical problem of how to quickly allocate and cyclically multiplex video stream ports on a video cloud platform.

[0005] In a first aspect, the present invention provides a method for video stream port planning, allocation and cyclic multiplexing, comprising the following steps:

[0006] Set the value of the system parameter ip_local_reserved_ports, reserve and plan a continuous range of system ports, obtain the port range, and allocate the port range to the dedicated function for port allocation;

[0007] Use the pointer collision comparison algorithm to encode the usage identification of all ports in the port interval, initialize all port identification values, introduce the port identification value collision subscript and initialize the collision subscript value to the port value on the left side of the port interval;

[0008] Video stream port allocation is performed based on the pointer collision comparison algorithm. The port identified by the collision subscript in the port interval is used as the starting point, and port identifier value collision matching is performed from left to right to allocate a free port. At the same time, the identifier value currently assigned to the port is updated. When the collision subscript reaches the port value on the right side of the port interval, the port identified by the collision subscript is reset to the value on the left side of the port interval.

[0009] Preferably, the port interval is expressed as [a, b], where a represents the minimum value of the system ports in a continuous interval, and b represents the maximum value of the system ports in a continuous interval, and the port interval is stored in Redis.

[0010] Preferably, after the usage identification states of all ports in the port interval are initialized to 0, they are saved in ConcurrentHashMap in the form of key-value pairs, and the collision index value is initialized to the port value on the left side of the port interval.

[0011] As a preferred method, the video stream port allocation is performed based on the pointer collision comparison algorithm, and the following operations are performed:

[0012] Read the port identified by the collision subscript as the target port, and obtain the usage identification value of the target port from ConcurrentHashMap;

[0013] If the identification value is 0, it means that the target port is idle and has not been allocated for use. It is directly allocated and the usage status value of the target port in ConcurrentHashMap is updated to 1. If the port currently identified by the collision subscript is the right value of the port interval, the port identified by the collision subscript is reset to the left value of the port interval. Otherwise, the collision subscript is moved to the right in the port interval to the value of the next port, and the port allocation logic ends.

[0014] If the identification value is 1, it means that the target port has been allocated and used. Just update the port value pointed to by the collision index. If the port currently identified by the collision index is the value on the right side of the port interval, reset the port identified by the collision index to the value on the left side of the port interval. Otherwise, move the collision index to the right of the next port in the port interval, and then re-execute the port allocation logic until an idle available port is allocated and the allocation logic is terminated.

[0015] Preferably, when the video stream port is released, the usage status value of the target port stored in ConcurrentHashMap is updated to 0.

[0016] In a second aspect, the present invention provides a video stream port planning allocation and cyclic multiplexing system, which implements video stream port planning allocation and multiplexing through a video stream port planning allocation and cyclic multiplexing method as described in any one of the first aspects, and the system includes a port interval configuration module, an initialization module and a port allocation module;

[0017] The port range configuration module is used to perform the following: set the value of the system parameter ip_local_reserved_ports, reserve and plan a continuous range of system ports, obtain the port range, and allocate the port range to the dedicated function for port allocation;

[0018] The initialization module is used to perform the following: use identification encoding for all ports in the port interval through a pointer collision comparison algorithm, initialize all port identification values, introduce a port identification value collision subscript and initialize the collision subscript value to the port value on the left side of the port interval;

[0019] The port allocation module is used to perform the following: video stream port allocation based on the pointer collision comparison algorithm. When allocating, the port identified by the collision subscript in the port interval is started, and the port identification value collision matching is performed from left to right, and an idle port is allocated. At the same time, the identification value currently allocated to the port is updated. When the collision subscript reaches the port value on the right side of the port interval, the port identified by the collision subscript is reset to the value on the left side of the port interval.

[0020] Preferably, the port interval is expressed as [a, b], where a represents the minimum value of the system ports in a continuous interval, and b represents the maximum value of the system ports in a continuous interval, and the port interval is stored in Redis.

[0021] Preferably, the initialization module is used to initialize the use identification status of all ports in the port range to 0, and save them in the ConcurrentHashMap in the form of key-value pairs, and initialize the collision index value to the port value on the left side of the port range.

[0022] Preferably, the port allocation module is used to perform the following video stream port allocation based on a pointer collision comparison algorithm:

[0023] Read the port identified by the collision subscript as the target port, and obtain the usage identification value of the target port from ConcurrentHashMap;

[0024] If the identification value is 0, it means that the target port is idle and has not been allocated for use. It is directly allocated and the usage status value of the target port in ConcurrentHashMap is updated to 1. If the port currently identified by the collision subscript is the right value of the port interval, the port identified by the collision subscript is reset to the left value of the port interval. Otherwise, the collision subscript is moved to the right in the port interval to the value of the next port, and the port allocation logic ends.

[0025] If the identification value is 1, it means that the target port has been allocated and used. Just update the port value pointed to by the collision index. If the port currently identified by the collision index is the value on the right side of the port interval, reset the port identified by the collision index to the value on the left side of the port interval. Otherwise, move the collision index to the right of the next port in the port interval, and then re-execute the port allocation logic until an idle available port is allocated and the allocation logic is terminated.

[0026] Preferably, when the video stream port is released, the port allocation module is used to update the usage status value of the target port stored in the ConcurrentHashMap to 0.

[0027] The video stream port planning allocation and cyclic multiplexing method and system of the present invention have the following advantages: realizing rapid allocation and cyclic multiplexing of video stream ports, saving occupation of system port resources and reducing complexity of port allocation, and effectively improving allocation efficiency of system ports. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0029] The present invention is further described below in conjunction with the accompanying drawings.

[0030] Figure 1 This is a flowchart of a method for planning, allocating and cyclic multiplexing of video stream ports in Example 1. DETAILED DESCRIPTION

[0031] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments may be combined with each other.

[0032] The embodiments of the present invention provide a method and system for planning, allocating and cyclically multiplexing video stream ports, which are used to solve the technical problem of how to quickly allocate and cyclically multiplex video stream ports on a video cloud platform.

[0033] Embodiment 1:

[0034] The invention discloses a video stream port planning allocation and cyclic multiplexing method, which comprises three steps of port interval configuration, initialization and port allocation.

[0035] Step S100 port range configuration: set the value of the system parameter ip_local_reserved_ports, reserve and plan a continuous range of system ports, obtain the port range, and allocate the port range to a dedicated function for port allocation.

[0036] In this embodiment, the port interval is expressed as [a, b], where a represents the minimum value of the system ports in the continuous interval, and b represents the maximum value of the system ports in the continuous interval. The port interval is stored in Redis.

[0037] Step S200 initialization: use the pointer collision comparison algorithm to encode the usage identification of all ports in the port interval, initialize all port identification values, introduce the port identification value collision index and initialize the collision index value to the port value on the left side of the port interval.

[0038] In step S200 of this embodiment, after the use identification states of all ports in the port interval are initialized to 0, they are saved in ConcurrentHashMap in the form of key-value pairs, and the collision index value is initialized to the port value on the left side of the port interval.

[0039] Step S300 port allocation: Video stream port allocation is performed based on the pointer collision comparison algorithm. When allocating, the port identified by the collision subscript in the port interval is started, and the port identification value collision matching is performed from left to right. An idle port is allocated, and the identification value currently allocated to the port is updated. When the collision subscript reaches the port value on the right side of the port interval, the port identified by the collision subscript is reset to the value on the left side of the port interval.

[0040] As a specific implementation of step S300, the video stream port allocation is performed based on the pointer collision comparison algorithm, and the following operations are performed:

[0041] (1) Read the port identified by the collision subscript as the target port, and obtain the usage identification value of the target port from ConcurrentHashMap;

[0042] (2) If the identification value is 0, it means that the target port is idle and has not been allocated for use. It is directly allocated and the usage status value of the target port in ConcurrentHashMap is updated to 1. If the port currently identified by the collision subscript is the right value of the port interval, the port identified by the collision subscript is reset to the left value of the port interval. Otherwise, the collision subscript is moved to the right in the port interval to the value of the next port, and the port allocation logic ends.

[0043] (3) If the identification value is 1, it means that the target port has been allocated for use. Only the port value indicated by the collision index needs to be updated. If the port currently identified by the collision index is the value on the right side of the port interval, the port identified by the collision index is reset to the value on the left side of the port interval. Otherwise, the collision index is moved to the right of the next port in the port interval, and then the port allocation logic is re-executed until an idle available port is allocated and the allocation logic is terminated.

[0044] In this embodiment, each video stream port allocation will have the following allocation logic: read the port identified by the collision subscript, and obtain the use status identification information of the port from ConcurrentHashMap, compare the status identification value, if the identification value is 0, it means that the target port is idle and has not been allocated for use, directly allocate, and update the use status value of the current port stored in ConcurrentHashMap to 1, if the port currently identified by the collision subscript is the value of port b in the interval port [a, b], the port identified by the collision subscript is reset to the value of port a, otherwise the collision subscript is moved to the right in the interval port [a, b] to the value of the next port, and the port allocation logic is terminated; if the identification value is 1, it means that the target port has been allocated for use, only the port value indicated by the collision subscript needs to be updated, if the port currently identified by the collision subscript is the value of port b in the interval port [a, b], the port identified by the collision subscript is reset to the value of port a, otherwise the collision subscript is moved to the right in the interval port [a, b] to the value of the next port, and then the port allocation logic is re-executed until an idle available port is allocated and the allocation logic is terminated.

[0045] As a specific implementation of this embodiment, when the video stream port is released, the usage status value of the target port stored in ConcurrentHashMap is updated to 0.

[0046] The method of this embodiment realizes the rapid allocation and cyclic reuse of video stream ports based on ConcurrentHashMap, an excellent JDK native basic component, and Redis, a mature and stable third-party middleware, which saves the occupation of system port resources and reduces the complexity of port allocation, and effectively improves the allocation efficiency of system ports.

[0047] Embodiment 2:

[0048] The present invention provides a video stream port planning allocation and cyclic multiplexing system, the system includes a port interval configuration module, an initialization module and a port allocation module, and the system executes the method disclosed in Example 1 to realize video stream port planning allocation and multiplexing.

[0049] The port range configuration module is used to perform the following: set the value of the system parameter ip_local_reserved_ports, reserve and plan a continuous range of system ports, obtain the port range, and allocate the port range to a dedicated function for port allocation.

[0050] In this embodiment, the port interval is expressed as [a, b], where a represents the minimum value of the continuous system ports in the interval, and b represents the maximum value of the continuous system ports in the interval. The port interval is stored in Redis.

[0051] The initialization module is used to perform the following: use identification encoding for all ports in the port interval through a pointer collision comparison algorithm, initialize all port identification values, introduce a port identification value collision index and initialize the collision index value to the port value on the left side of the port interval.

[0052] In this embodiment, the initialization module is used to initialize the use identification status of all ports in the port interval to 0, save them in the ConcurrentHashMap in the form of key-value pairs, and initialize the collision index value to the port value on the left side of the port interval.

[0053] The port allocation module is used to perform the following: video stream port allocation based on the pointer collision comparison algorithm. When allocating, the port identified by the collision subscript in the port interval is started, and the port identification value collision matching is performed from left to right, and an idle port is allocated. At the same time, the identification value currently allocated to the port is updated. When the collision subscript reaches the port value on the right side of the port interval, the port identified by the collision subscript is reset to the value on the left side of the port interval.

[0054] As a specific implementation of the port allocation module, the module performs the following operations:

[0055] (1) Read the port identified by the collision subscript as the target port, and obtain the usage identification value of the target port from ConcurrentHashMap;

[0056] (2) If the identification value is 0, it means that the target port is idle and has not been allocated for use. It is directly allocated and the usage status value of the target port in ConcurrentHashMap is updated to 1. If the port currently identified by the collision subscript is the right value of the port interval, the port identified by the collision subscript is reset to the left value of the port interval. Otherwise, the collision subscript is moved to the right in the port interval to the value of the next port, and the port allocation logic ends.

[0057] (3) If the identification value is 1, it means that the target port has been allocated for use. Only the port value indicated by the collision index needs to be updated. If the port currently identified by the collision index is the value on the right side of the port interval, the port identified by the collision index is reset to the value on the left side of the port interval. Otherwise, the collision index is moved to the right of the next port in the port interval, and then the port allocation logic is re-executed until an idle available port is allocated and the allocation logic is terminated.

[0058] In this embodiment, each video stream port allocation will have the following allocation logic: read the port identified by the collision subscript, and obtain the use status identification information of the port from ConcurrentHashMap, compare the status identification value, if the identification value is 0, it means that the target port is idle and has not been allocated for use, directly allocate, and update the use status value of the current port stored in ConcurrentHashMap to 1, if the port currently identified by the collision subscript is the value of port b in the interval port [a, b], the port identified by the collision subscript is reset to the value of port a, otherwise the collision subscript is moved to the right in the interval port [a, b] to the value of the next port, and the port allocation logic is terminated; if the identification value is 1, it means that the target port has been allocated for use, only the port value indicated by the collision subscript needs to be updated, if the port currently identified by the collision subscript is the value of port b in the interval port [a, b], the port identified by the collision subscript is reset to the value of port a, otherwise the collision subscript is moved to the right in the interval port [a, b] to the value of the next port, and then the port allocation logic is re-executed until an idle available port is allocated and the allocation logic is terminated.

[0059] As a specific implementation of this embodiment, when the video stream port is released, the usage status value of the target port stored in ConcurrentHashMap is updated to 0.

[0060] The present invention has been shown and described in detail above through the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art can know that the means in the above different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the protection scope of the present invention.

Claims

1. A video stream port planning allocation and cyclic multiplexing method, characterized in that: The steps include: Set the value of the system parameter ip_local_reserved_ports, reserve and plan a continuous range of system ports, obtain the port range, and allocate the port range to the dedicated function for port allocation; Use the pointer collision comparison algorithm to encode the usage identification of all ports in the port interval, initialize all port identification values, introduce the port identification value collision subscript and initialize the collision subscript value to the port value on the left side of the port interval; Video stream port allocation is performed based on the pointer collision comparison algorithm. The port identified by the collision subscript in the port interval is used as the starting point, and port identifier value collision matching is performed from left to right to allocate a free port. At the same time, the identifier value currently assigned to the port is updated. When the collision subscript reaches the port value on the right side of the port interval, the port identified by the collision subscript is reset to the value on the left side of the port interval.

2. The video stream port planning allocation and cyclic multiplexing method according to claim 1 is characterized in that: The port interval is expressed as [a, b], where a represents the minimum value of the continuous system ports in the interval, and b represents the maximum value of the continuous system ports in the interval. The port interval is stored in Redis.

3. The video stream port planning allocation and cyclic multiplexing method according to claim 1 is characterized in that: After initializing the usage identification status of all ports in the port range to 0, save them in ConcurrentHashMap in the form of key-value pairs, and initialize the collision index value to the port value on the left side of the port range.

4. The video stream port planning allocation and cyclic multiplexing method according to claim 3 is characterized in that: Based on the pointer collision comparison algorithm, the video stream port is allocated and the following operations are performed: Read the port identified by the collision subscript as the target port, and obtain the usage identification value of the target port from ConcurrentHashMap; If the identification value is 0, it means that the target port is idle and has not been allocated for use. It is directly allocated and the usage status value of the target port in ConcurrentHashMap is updated to 1. If the port currently identified by the collision subscript is the right value of the port interval, the port identified by the collision subscript is reset to the left value of the port interval. Otherwise, the collision subscript is moved to the right in the port interval to the value of the next port, and the port allocation logic ends. If the identification value is 1, it means that the target port has been allocated and used. Just update the port value pointed to by the collision index. If the port currently identified by the collision index is the value on the right side of the port interval, reset the port identified by the collision index to the value on the left side of the port interval. Otherwise, move the collision index to the right of the next port in the port interval, and then re-execute the port allocation logic until an idle available port is allocated and the allocation logic is terminated.

5. The video stream port planning allocation and cyclic multiplexing method according to claim 3 is characterized in that: When the video stream port is released, the usage status value of the target port stored in ConcurrentHashMap is updated to 0.

6. A video stream port planning allocation and cyclic multiplexing system, characterized in that: Video stream port planning allocation and multiplexing are realized by a video stream port planning allocation and cyclic multiplexing method as described in any one of claims 1 to 5, wherein the system includes a port interval configuration module, an initialization module and a port allocation module; The port range configuration module is used to perform the following: set the value of the system parameter ip_local_reserved_ports, reserve and plan a continuous range of system ports, obtain the port range, and allocate the port range to the dedicated function for port allocation; The initialization module is used to perform the following: use identification encoding for all ports in the port interval through a pointer collision comparison algorithm, initialize all port identification values, introduce a port identification value collision subscript and initialize the collision subscript value to the port value on the left side of the port interval; The port allocation module is used to perform the following: video stream port allocation based on the pointer collision comparison algorithm. When allocating, the port identified by the collision subscript in the port interval is started, and the port identification value collision matching is performed from left to right, and an idle port is allocated. At the same time, the identification value currently allocated to the port is updated. When the collision subscript reaches the port value on the right side of the port interval, the port identified by the collision subscript is reset to the value on the left side of the port interval.

7. The video stream port planning allocation and cyclic multiplexing system according to claim 6, characterized in that: The port interval is expressed as [a, b], where a represents the minimum value of the continuous system ports in the interval, and b represents the maximum value of the continuous system ports in the interval. The port interval is stored in Redis.

8. The video stream port planning allocation and cyclic multiplexing system according to claim 6, characterized in that: The initialization module is used to initialize the usage identification status of all ports in the port range to 0, and save them in the ConcurrentHashMap in the form of key-value pairs, and initialize the collision index value to the port value on the left side of the port range.

9. The video stream port planning allocation and cyclic multiplexing system according to claim 8, characterized in that: The port allocation module is used to perform the following video stream port allocation based on the pointer collision comparison algorithm: Read the port identified by the collision subscript as the target port, and obtain the usage identification value of the target port from ConcurrentHashMap; If the identification value is 0, it means that the target port is idle and has not been allocated for use. It is directly allocated and the usage status value of the target port in ConcurrentHashMap is updated to 1. If the port currently identified by the collision subscript is the right value of the port interval, the port identified by the collision subscript is reset to the left value of the port interval. Otherwise, the collision subscript is moved to the right in the port interval to the value of the next port, and the port allocation logic ends. If the identification value is 1, it means that the target port has been allocated and used. Just update the port value pointed to by the collision index. If the port currently identified by the collision index is the value on the right side of the port interval, reset the port identified by the collision index to the value on the left side of the port interval. Otherwise, move the collision index to the right of the next port in the port interval, and then re-execute the port allocation logic until an idle available port is allocated and the allocation logic is terminated.

10. The video stream port planning allocation and cyclic multiplexing system according to claim 8, characterized in that: When the video stream port is released, the port allocation module is used to update the usage status value of the target port stored in the ConcurrentHashMap to 0.