Video stream processing method and apparatus, electronic device, and storage medium

By using the state transition method of the target state machine to process video streams, the complexity of video stream acquisition and distribution in existing technologies is solved, and the efficiency and stability of video stream processing are improved.

CN116320295BActive Publication Date: 2026-07-31GRG BANKING EQUIPMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GRG BANKING EQUIPMENT CO LTD
Filing Date
2023-02-21
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

The existing technology for acquiring and distributing video streams is complex and cannot respond quickly to client requests, resulting in poor video stream processing efficiency and stability.

Method used

The video stream is processed using a state transition method of the target state machine. By receiving client requests, it determines whether the video stream exists and requests the video stream from the video source device if it does not exist, ensuring smooth transitions between states of the state machine and reducing logical judgment errors.

Benefits of technology

By using the state transitions of the target state machine, uncertainties and unknown errors in the video stream request process are reduced, thereby improving the efficiency and stability of video stream processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116320295B_ABST
    Figure CN116320295B_ABST
Patent Text Reader

Abstract

This application discloses a video stream processing method, apparatus, electronic device, and storage medium, belonging to the field of video stream processing technology. The method is applied to a target device, which includes a target state machine. The method includes: receiving a video stream acquisition request from a client; determining that the target video stream corresponding to the video stream acquisition request does not exist on the target device, and the target state machine transitions to a video stream input state; determining that the return condition of the video stream input state is a success condition, and the target state machine transitions to a video stream request state, requesting the target video stream from the video source device corresponding to the target video stream; determining that the return condition of the video stream request state is a success condition, and the target state machine transitions to a video stream output state; determining that an output confirmation has been received from the video stream output state, and the target state machine transitions to a video stream sending state, sending the target video stream to the client. This method, through state machine processing, can improve the processing efficiency and stability of video streams.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of video stream processing technology, and in particular relates to a video stream processing method, apparatus, electronic device and storage medium. Background Technology

[0002] With the rapid development of high-definition intelligent video, video surveillance systems have been widely used in smart city construction. When processing video streams, streaming media processing technology is usually used.

[0003] Currently, streaming media processing technology generally adopts a procedural approach, which completes the acquisition and distribution of video streams. This approach involves a complex video stream acquisition process, making it impossible to quickly obtain the target video stream requested by the client or to quickly send the target video stream to the client. Summary of the Invention

[0004] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes a video stream processing method, apparatus, electronic device, and storage medium that can improve the efficiency and stability of video stream processing.

[0005] In a first aspect, this application provides a video stream processing method, the method being applied to a target device, the target device including a target state machine, the method comprising:

[0006] Receive video stream acquisition requests from clients;

[0007] When it is determined that the target video stream corresponding to the video stream acquisition request does not exist in the target device, the target state machine transitions to the video stream input state;

[0008] Once the return condition for the video stream input state is determined to be a success condition, the target state machine jumps to the video stream request state and requests the target video stream from the video source device corresponding to the target video stream.

[0009] Once the return condition for the video stream request status is determined to be a success condition, the target state machine transitions to the video stream output status;

[0010] Upon confirming receipt of the video stream output status, the target state machine transitions to the video stream sending state and sends the target video stream to the client.

[0011] According to the video stream processing method of this application, the target video stream is processed and distributed through the state transition of the target state machine, which can reduce the uncertainties and unknown errors caused by different logical judgments in the video stream request process, and improve the efficiency and stability of video stream processing.

[0012] According to one embodiment of this application, after receiving the video stream acquisition request from the client and before determining that an output confirmation of the video stream output status has been received, the method further includes:

[0013] Once it is determined that the target video stream exists in the target device, the target state machine transitions to the video stream output state.

[0014] According to one embodiment of this application, determining that the target video stream exists in the target device includes:

[0015] Locate the playback status queue, login status queue, and logout status queue of the target device;

[0016] The status corresponding to the target video stream is found in any one of the playback status queue, the login status queue, and the logout status queue, thus confirming that the target video stream exists on the target device.

[0017] According to one embodiment of this application, after finding the state corresponding to the target video stream in any one of the playback state queue, the login state queue, and the logout state queue, and before the target state machine transitions to the video stream output state, the method further includes:

[0018] Determine that the state corresponding to the target video stream exists in the playback state queue, and return the target video stream according to the playback state logic;

[0019] Alternatively, determine that the state corresponding to the target video stream exists in the login state queue, generate the playback state corresponding to the target video stream, insert the playback state corresponding to the target video stream into the playback state queue, and return the target video stream according to the playback state logic;

[0020] Alternatively, if the state corresponding to the target video stream is determined to exist in the logout state queue, the video source device is reconnected, a playback state corresponding to the target video stream is generated, the playback state corresponding to the target video stream is inserted into the playback state queue, and the target video stream is returned according to the playback state logic.

[0021] According to one embodiment of this application, the step of searching the playback status queue, login status queue, and logout status queue of the target device includes:

[0022] The status corresponding to the target video stream is searched sequentially in the playback status queue, the login status queue, and the logout status queue.

[0023] According to one embodiment of this application, requesting the target video stream from the video source device corresponding to the target video stream includes:

[0024] The video source device is controlled to sequentially perform a device login operation and a device playback operation to obtain the target video stream from the video source device.

[0025] According to one embodiment of this application, controlling the video source device to sequentially perform a device login operation and a device playback operation includes:

[0026] Control the video source device to perform a device login operation, generate the login status of the target video stream, and store the login status in the login status queue of the target device;

[0027] The video source device is controlled to perform a device playback operation, generating the playback status of the target video stream, and the playback status is stored in the playback status queue of the target device.

[0028] Secondly, this application provides a video stream processing apparatus, which is applied to a target device, the target device including a target state machine, the apparatus comprising:

[0029] The receiving module is used to receive video stream acquisition requests from clients;

[0030] The first processing module is used to determine that the target video stream corresponding to the video stream acquisition request does not exist in the target device, and the target state machine jumps to the video stream input state;

[0031] The second processing module is used to determine that the return condition of the video stream input state is a success condition, the target state machine jumps to the video stream request state, and requests the target video stream from the video source device corresponding to the target video stream based on the video stream request state;

[0032] The third processing module is used to determine that the return condition of the video stream request status is a success condition, and the target state machine jumps to the video stream output status;

[0033] The fourth processing module is used to determine the output confirmation of the received video stream output state, and the target state machine jumps to the video stream sending state to send the target video stream to the client.

[0034] The video stream processing apparatus according to this application processes and distributes the target video stream through state transitions of the target state machine, which can reduce uncertainties and unknown errors caused by different logical judgments in the video stream request process, thereby improving the efficiency and stability of video stream processing.

[0035] Thirdly, this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the video stream processing method as described in the first aspect above.

[0036] Fourthly, this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the video stream processing method as described in the first aspect above.

[0037] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the video stream processing method as described in the first aspect above.

[0038] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0039] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0040] Figure 1 This is one of the flowcharts illustrating the video stream processing method provided in the embodiments of this application;

[0041] Figure 2 This is a second schematic flowchart of the video stream processing method provided in the embodiments of this application;

[0042] Figure 3 This is the third flowchart illustrating the video stream processing method provided in the embodiments of this application;

[0043] Figure 4 This is a schematic diagram of the structure of the video stream processing device provided in the embodiments of this application;

[0044] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0045] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0046] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0047] The following is combined Figures 1-5 The present application provides a detailed description of the video stream processing method, video stream processing device, electronic device, and readable storage medium through specific embodiments and application scenarios.

[0048] The video stream processing method can be applied to the terminal, and can be executed by the hardware or software in the terminal.

[0049] The terminal includes, but is not limited to, portable communication devices such as mobile phones or tablets with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads). It should also be understood that, in some embodiments, the terminal may not be a portable communication device, but rather a desktop computer with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads).

[0050] The following embodiments describe a terminal including a display and a touch-sensitive surface. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and joystick.

[0051] like Figure 1 As shown, the video stream processing method includes steps 110 to 150.

[0052] In this embodiment, the video stream processing method is applied to a target device, and the target device includes a target state machine.

[0053] In practice, the target device can be a video surveillance system, which may include multiple video source devices. The target device can acquire and play video streams from multiple video source devices.

[0054] A state machine is a control center consisting of a state register and combinational logic circuits, capable of transitioning between states according to a pre-set state based on control signals. In this embodiment, the target state machine is located in the target device and is used to complete the transition of the video stream state.

[0055] Step 110: Receive the client's video stream acquisition request.

[0056] The client can send a video stream acquisition request to the target device to acquire the target video stream. The client can also send requests such as video stream disconnection request and video stream recording request to the target device.

[0057] Step 120: Determine that the target video stream corresponding to the video stream acquisition request does not exist in the target device, and the target state machine jumps to the video stream input state.

[0058] Among them, the video stream input status can be the state in which the video source device needs to input a video stream to the target device.

[0059] For example, by using the I-frame information of the target video stream as an index, a search can be performed on the target device. If the target video stream cannot be found on the target device, it can be determined that the target video stream corresponding to the video stream acquisition request does not exist on the target device.

[0060] Step 130: Determine that the return condition of the video stream input state is a success condition. The target state machine jumps to the video stream request state and requests the target video stream from the video source device corresponding to the target video stream.

[0061] The video stream request status can be the status of the target device requesting the input target video stream from the video source device.

[0062] A video source device can be a device that is connected to a target device and provides a video stream to the target device. For example, if the target device is a surveillance system, the video source device can be a camera or other image acquisition device of the surveillance system.

[0063] In practice, the video source device can establish a connection channel with the target device. When the target device's state machine transitions to the video stream input state, the video source device inputs the video stream to the target device through the connection channel.

[0064] When the video stream input is complete, an input completion signal is sent to the target device. The target state machine in the target device receives the return condition of the video stream input status as a success condition, and the target state machine jumps to the video stream request stage.

[0065] If the video source device and the target device cannot establish a connection channel, the target state machine directly switches to the input failure state. Alternatively, if the video source device cannot input a video stream to the target device, the video source device sends an input failure signal to the target device, and the target state machine switches to the input failure state.

[0066] Step 140: Determine that the return condition for the video stream request status is a success condition, and the target state machine jumps to the video stream output status.

[0067] The video stream output status can be the state where the target device has successfully acquired the target video stream and can configure the output of the target video stream.

[0068] In actual execution, after the target device obtains the target video stream and the output configuration information of the target video stream from the video source device, the target state machine jumps to the video stream output state.

[0069] If the target device cannot obtain the target video stream from the video source device or cannot obtain the output configuration information of the target video stream, the target state machine transitions to the request failure state.

[0070] Step 150: Confirm the output of the received video stream output status. The target state machine jumps to the video stream sending state and sends the target video stream to the client.

[0071] Among them, receiving the output confirmation of the video stream output status indicates that the target device has completed the configuration of the target video stream based on the output configuration information of the target video stream, and can then send the target video stream to the client. The video stream sending status can be the status of the target device sending the target video stream to the client.

[0072] If the target device fails to configure the target video stream, resulting in no output confirmation of the video stream output status being received, or if the target state machine times out while waiting for the output confirmation to be sent, the target state machine will transition to the sending failure state.

[0073] It should be noted that during the process of the client requesting the target video stream, both the failure state and the successful video stream transmission state of the target state machine will transition to the end state.

[0074] In related technologies, a process-based approach is typically used to process video streams from acquisition to distribution. However, this approach involves complex acquisition processes with numerous branches that can lead to errors in these branches. Consequently, the acquisition or distribution of the video stream may enter unpredictable branches, resulting in poor efficiency and stability in video stream processing.

[0075] In this embodiment, a state machine is used to handle the logic of video stream acquisition and forwarding. By confirming the possible subsequent situations of each video stream acquisition and forwarding process, the state machine quickly processes and transitions the state, reducing intermediate judgment problems and logical problems of transition branches. The video stream acquisition process is simple, the probability of branch transition errors is reduced, and the efficiency and stability of video stream processing are improved.

[0076] According to the video stream processing method provided in the embodiments of this application, the target video stream is processed and distributed through the state transition of the target state machine. This can reduce uncertainties and unknown errors caused by different logical judgments in the video stream request process, thereby improving the efficiency and stability of video stream processing.

[0077] The following is an example that specifically describes the state transition process of the target state machine.

[0078] like Figure 3 As shown, the target device receives video acquisition requests from clients and searches the playback status queue, login status queue, and logout status queue in the target device. When the status corresponding to the target video stream is found in the queue, it is determined that the requested video stream already exists in the target device. When the status corresponding to the target video stream is not found in the queue, it is determined that the requested video stream does not exist in the target device.

[0079] If the requested video stream does not exist, a video stream input is requested from the video source. If the request for video stream input from the video source is successful, the target state machine transitions to the video stream request state. If the request for input from the video source fails, a message is sent to the client indicating that the video stream acquisition failed.

[0080] The IN protocol indicates that video stream data can be transmitted between the video source and the target device using the IN protocol, resulting in higher data arrival rate and lower data power consumption.

[0081] When a video stream request from the video source is successful, the target state machine transitions to the video stream output state. When a video stream request from the video source fails, the target state machine requests the video source to close the video stream input and replies to the client that the video stream acquisition failed.

[0082] When it is determined that the requested video stream already exists, the state corresponding to the target video stream is directly retrieved from the state queue in the target device, and the target video stream is returned according to the video stream playback state logic. The target state machine then transitions to the video stream output state.

[0083] Upon receiving an output confirmation of the video stream output status, the target state machine transitions to the video stream sending state, sends the target video stream to the client, and then transitions to the end state.

[0084] The ACK event indicates that the video stream sent by the video source to the target device has been received without error, while VDUOUT-SDP indicates that the connection between the video source and the target device is trustworthy and that the video stream has been successfully output to the target device.

[0085] In the event of video stream output failure or timeout while waiting for confirmation of video stream output status, the system requests the video source to close the video stream output and replies to the client that video stream acquisition failed.

[0086] After all state processing is completed, the target state machine transitions to the final state, and the business ends.

[0087] In some embodiments, after receiving a video stream acquisition request from a client, but before determining that an output confirmation of the received video stream output status has been obtained, the method further includes:

[0088] Once it is confirmed that the target video stream exists on the target device, the target state machine transitions to the video stream output state.

[0089] In actual execution, after confirming that the target video stream exists on the target device, the target state machine can directly jump to the video stream output state and configure the output of the target video stream according to the target video stream and its output configuration information. After the output configuration of the target video stream is completed, the target state machine jumps to the video stream sending state and sends the target video stream to the client.

[0090] In some embodiments, determining that the target video stream exists on the target device includes:

[0091] Locate the playback status queue, login status queue, and logout status queue of the target device;

[0092] The target video stream is located in any of the following status queues: playback status queue, login status queue, and logout status queue, thus confirming that the target video stream exists on the target device.

[0093] The states stored in the playback state queue, login state queue, and logout state queue can be states generated by the target state machine during video stream processing.

[0094] For example, the playback status queue stores the playback status of the video stream, the login status queue stores the login status of the video source device, and the logout status queue stores the logout status of the video source device.

[0095] In this embodiment, the playback status queue, login status queue, and logout status queue can be retrieved based on the video information of the target video stream and the device information of the video source device corresponding to the target video stream, thereby determining whether the target video stream exists in the target device.

[0096] The target video stream is located in any of the following status queues: playback status queue, login status queue, and logout status queue, thus confirming that the target video stream exists on the target device.

[0097] For example, the status corresponding to the target video stream can be found in the playback status queue to determine that the target video stream exists on the target device. Alternatively, the status corresponding to the target video stream can be found in the login status queue to determine that the target video stream exists on the target device. Furthermore, the status corresponding to the target video stream can be found in the logout status queue to determine that the target video stream exists on the target device.

[0098] In some embodiments, after finding the state corresponding to the target video stream in any of the state queues—the playback state queue, the login state queue, and the logout state queue—the method further includes, before the target state machine transitions to the video stream output state:

[0099] Once it is determined that the state corresponding to the target video stream exists in the playback state queue, the target video stream is returned according to the playback state logic.

[0100] Alternatively, determine that the state corresponding to the target video stream exists in the login state queue, generate the playback state corresponding to the target video stream, insert the playback state corresponding to the target video stream into the playback state queue, and return the target video stream according to the playback state logic;

[0101] Alternatively, determine that the state corresponding to the target video stream exists in the logout state queue, reconnect to the video source device, generate the playback state corresponding to the target video stream, insert the playback state corresponding to the target video stream into the playback state queue, and return the target video stream according to the playback state logic.

[0102] In actual execution, determining that the state corresponding to the target video stream exists in the playback state queue indicates that the state corresponding to the target video stream is in playback state, and the target video stream can be returned based on the playback state logic of the video stream.

[0103] The fact that the target video stream's state exists in the login state queue indicates that the target video stream's state is logged in. Based on the target video stream's login state, the playback state of the target video stream can be generated, and the target video stream can be returned based on the video stream's playback state logic.

[0104] The fact that the target video stream's status exists in the logout status queue indicates that the target video stream's status is logged out. The fact that the target video stream's status can be found in the logout status queue indicates that the relevant resources of the target video stream have not yet been released.

[0105] If the relevant resources of the target video stream have not been released, the video source device can be reconnected. The playback status of the target video stream can be generated based on the logout status of the target video stream, and the target video stream can be returned based on the playback status logic of the video stream.

[0106] Specifically, after generating the playback status of the target video stream based on its login or logout status, the playback status is inserted into the playback status queue. This allows the target video stream to be retrieved directly from the playback status queue the next time it is retrieved, and the target video stream to be returned according to the playback status logic, reducing the number of operation steps required to retrieve the target video stream.

[0107] In some embodiments, searching the playback status queue, login status queue, and logout status queue of the target device includes:

[0108] Search for the status corresponding to the target video stream in the playback status queue, login status queue, and logout status queue in sequence.

[0109] In this embodiment, when searching the playback status queue, login status queue, and logout status queue, a certain search order is required.

[0110] Among them, the search priority of the playback status queue is higher than that of the login status queue, and the search priority of the login status queue is higher than that of the logout status queue. The search priority represents the search order of different status queues when searching the playback status queue, login status queue and logout status queue.

[0111] In actual execution, according to the search priority of the status queue, the target device first searches the playback status queue, then searches the login status queue, and finally searches the logout status queue.

[0112] By setting up playback status queues, login status queues, and logout status queues, and setting search priorities for different status queues, when faced with a large number of video stream acquisition requests, it is not necessary to frequently request video streams from the video source device. Furthermore, by prioritizing finding the status corresponding to the target video stream in the playback status queue, the complexity of the system can be effectively reduced and the efficiency of video stream processing can be improved.

[0113] In some embodiments, requesting the target video stream from the video source device corresponding to the target video stream includes:

[0114] The system controls the video source device to sequentially perform device login and device playback operations, thereby obtaining the target video stream from the video source device.

[0115] In actual operation, after the video streaming device performs the device login operation and the device playback operation, the target device will obtain the target video stream from the video source device, and the target state machine will jump to the video stream output state. If the target video stream cannot be obtained, the target state machine will jump to the request failure state.

[0116] In some embodiments, controlling the video source device to sequentially perform a device login operation and a device playback operation includes:

[0117] Control the video source device to perform a device login operation, generate the login status of the target video stream, and store the login status in the login status queue of the target device;

[0118] Control the video source device to perform device playback operations, generate the playback status of the target video stream, and store the playback status in the playback status queue of the target device.

[0119] In this embodiment, when the video source device is controlled to perform device login and device playback operations in sequence, a login status and a playback status of the target video stream are generated. The login status of the target video stream is stored in the login status queue of the target device, and the playback status of the target video stream is stored in the playback status queue of the target device.

[0120] When other clients also request the target video stream, the target device can directly find the corresponding status of the target video stream from the login status queue and the playback status queue, and return the target video stream according to the playback status logic.

[0121] In some embodiments, the target device further includes a start state queue, which, after receiving a video stream acquisition request from a client and before requesting the target video stream from the video source device corresponding to the target video stream, further includes:

[0122] Control the video source device to revert to the start state and insert the start state into the start state queue. Perform state transitions in sequence according to the device start state, login state, and playback state to obtain the state corresponding to the target video stream, and return the target video stream according to the playback state logic.

[0123] The following is an example illustrating the overall process of a video stream processing method.

[0124] like Figure 2 As shown, the target device receives a video stream acquisition request from the client and determines whether the target video stream already exists.

[0125] If it is determined that the target video stream does not exist on the target device, the target state machine, according to preset states, sequentially transitions to the video stream input state, video stream request state, video stream output state, and video stream transmission state. If it is determined that the target video stream exists on the target device, the target state machine, according to preset states, sequentially transitions to the video stream output state and video stream transmission state.

[0126] In a normal process, the target video stream is successfully acquired and sent to the client; in an abnormal process, a video stream transmission failure message is returned to the client.

[0127] Once all status processing is complete, the request process ends.

[0128] The video stream processing method provided in this application embodiment can be executed by an electronic device or a functional module or entity in an electronic device that can implement the video stream processing method. The electronic devices mentioned in this application embodiment include, but are not limited to, mobile phones, tablets, computers, cameras, and wearable devices. The video stream processing method provided in this application embodiment will be described below using an electronic device as the execution subject as an example.

[0129] The video stream processing method provided in this application can be executed by a video stream processing device. This application uses a video stream processing device executing the video stream processing method as an example to illustrate the video stream processing device provided in this application.

[0130] This application also provides a video stream processing apparatus, which is applied to a target device, the target device including a target state machine.

[0131] like Figure 4 As shown, the video stream processing device includes:

[0132] The receiving module 410 is used to receive video stream acquisition requests from clients;

[0133] The first processing module 420 is used to determine that the target video stream corresponding to the video stream acquisition request does not exist in the target device, and the target state machine jumps to the video stream input state.

[0134] The second processing module 430 is used to determine that the return condition of the video stream input state is a success condition, the target state machine jumps to the video stream request state, and requests the target video stream from the video source device corresponding to the target video stream based on the video stream request state;

[0135] The third processing module 440 is used to determine that the return condition of the video stream request status is a success condition, and the target state machine jumps to the video stream output status.

[0136] The fourth processing module 450 is used to determine the output confirmation of the received video stream output status, the target state machine jumps to the video stream sending state, and sends the target video stream to the client.

[0137] The video stream processing apparatus provided in the embodiments of this application processes and distributes the target video stream through state transitions of the target state machine, which can reduce uncertainties and unknown errors caused by different logical judgments in the video stream request process, thereby improving the efficiency and stability of video stream processing.

[0138] In some embodiments, the third processing module 440 is used to determine that the target video stream exists in the target device, and the target state machine jumps to the video stream output state.

[0139] In some embodiments, the third processing module 440 is further configured to search the playback status queue, login status queue, and logout status queue of the target device;

[0140] The target video stream is located in any of the following status queues: playback status queue, login status queue, and logout status queue, thus confirming that the target video stream exists on the target device.

[0141] In some embodiments, the third processing module 440 is further configured to determine that the state corresponding to the target video stream exists in the playback state queue, and return the target video stream according to the playback state logic;

[0142] Alternatively, determine that the state corresponding to the target video stream exists in the login state queue, generate the playback state corresponding to the target video stream, insert the playback state corresponding to the target video stream into the playback state queue, and return the target video stream according to the playback state logic;

[0143] Alternatively, determine that the state corresponding to the target video stream exists in the logout state queue, reconnect to the video source device, generate the playback state corresponding to the target video stream, insert the playback state corresponding to the target video stream into the playback state queue, and return the target video stream according to the playback state logic.

[0144] In some embodiments, the third processing module 440 is further configured to sequentially search for the status corresponding to the target video stream in the playback status queue, the login status queue, and the logout status queue.

[0145] In some embodiments, the second processing module 430 is used to control the video source device to sequentially perform a device login operation and a device playback operation to obtain the target video stream of the video source device.

[0146] In some embodiments, the second processing module 430 is further configured to control the video source device to perform a device login operation, generate the login status of the target video stream, and store the login status in the login status queue of the target device;

[0147] Control the video source device to perform device playback operations, generate the playback status of the target video stream, and store the playback status in the playback status queue of the target device.

[0148] The video stream processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0149] The video stream processing device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0150] The video stream processing device provided in this application embodiment can achieve... Figures 1 to 5 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0151] In some embodiments, such as Figure 5 As shown, this application embodiment also provides an electronic device 500, including a processor 501, a memory 502, and a computer program stored in the memory 502 and executable on the processor 501. When the program is executed by the processor 501, it implements the various processes of the above-described video stream processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0152] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0153] This application also provides a non-transitory computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described video stream processing method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0154] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0155] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described video stream processing method.

[0156] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0157] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0158] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0159] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

[0160] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0161] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

Claims

1. A method for processing a video stream, characterized by, The method is applied to a target device, the target device including a target state machine, and the method includes: Receive video stream acquisition requests from clients; When it is determined that the target video stream corresponding to the video stream acquisition request does not exist in the target device, the target state machine transitions to the video stream input state; Once the return condition of the video stream input state is determined to be a success condition, the target state machine jumps to the video stream request state and requests the target video stream from the video source device corresponding to the target video stream; Once the return condition for the video stream request status is determined to be a success condition, the target state machine transitions to the video stream output status; Upon confirming receipt of the video stream output status, the target state machine transitions to the video stream sending state and sends the target video stream to the client. After receiving the video stream acquisition request from the client, and before confirming the receipt of the video stream output status, the method further includes: Once it is determined that the target video stream exists in the target device, the target state machine transitions to the video stream output state; Determining that the target video stream exists in the target device includes: Locate the playback status queue, login status queue, and logout status queue of the target device; If the state corresponding to the target video stream is found in any one of the playback state queue, the login state queue, and the logout state queue, it is determined that the target video stream exists in the target device. After finding the state corresponding to the target video stream in any one of the playback state queue, the login state queue, and the logout state queue, before the target state machine transitions to the video stream output state, the method further includes: Determine that the state corresponding to the target video stream exists in the playback state queue, and return the target video stream according to the playback state logic; Alternatively, determine that the state corresponding to the target video stream exists in the login state queue, generate the playback state corresponding to the target video stream, insert the playback state corresponding to the target video stream into the playback state queue, and return the target video stream according to the playback state logic; Alternatively, determine that the state corresponding to the target video stream exists in the logout state queue, reconnect the video source device, generate the playback state corresponding to the target video stream, insert the playback state corresponding to the target video stream into the playback state queue, and return the target video stream according to the playback state logic.

2. The video stream processing method of claim 1, wherein, The process of searching the playback status queue, login status queue, and logout status queue of the target device includes: The status corresponding to the target video stream is searched sequentially in the playback status queue, the login status queue, and the logout status queue.

3. The method of claim 1 or 2, wherein, The step of requesting the target video stream from the video source device corresponding to the target video stream includes: The video source device is controlled to sequentially perform a device login operation and a device playback operation to obtain the target video stream from the video source device.

4. The video stream processing method of claim 3, wherein, The control of the video source device to sequentially execute device login and device playback operations includes: Control the video source device to perform a device login operation, generate the login status of the target video stream, and store the login status in the login status queue of the target device; The video source device is controlled to perform a device playback operation, generating the playback status of the target video stream, and the playback status is stored in the playback status queue of the target device.

5. A video stream processing device, characterized in that, The device is applied to a target device, the target device including a target state machine, and the device includes: The receiving module is used to receive video stream acquisition requests from clients; The first processing module is used to determine that the target video stream corresponding to the video stream acquisition request does not exist in the target device, and the target state machine jumps to the video stream input state; The second processing module is used to determine that the return condition of the video stream input state is a success condition, the target state machine jumps to the video stream request state, and requests the target video stream from the video source device corresponding to the target video stream based on the video stream request state; The third processing module is used to determine that the return condition of the video stream request status is a success condition, and the target state machine jumps to the video stream output status; The fourth processing module is used to determine the output confirmation of the received video stream output state, and the target state machine jumps to the video stream sending state to send the target video stream to the client; The third processing module is further configured to: determine that the target video stream exists in the target device; the target state machine jumps to the video stream output state; search the playback state queue, login state queue, and logout state queue of the target device; find the state corresponding to the target video stream in any one of the playback state queue, login state queue, and logout state queue, and determine that the target video stream exists in the target device; determine that the state corresponding to the target video stream exists in the playback state queue, and return the target video stream according to the playback state logic; or, determine that the state corresponding to the target video stream exists in the login state queue, generate the playback state corresponding to the target video stream, insert the playback state corresponding to the target video stream into the playback state queue, and return the target video stream according to the playback state logic; or, determine that the state corresponding to the target video stream exists in the logout state queue, reconnect the video source device, generate the playback state corresponding to the target video stream, insert the playback state corresponding to the target video stream into the playback state queue, and return the target video stream according to the playback state logic.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the video stream processing method as described in any one of claims 1-4.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the video stream processing method as described in any one of claims 1-4.