Video transmission channel management method and device and vehicle

By obtaining the current status of the video transmission channel in the on-board infotainment system and processing state transition instructions according to the status, the frequent resource application and release problems caused by sometimes not being able to be caused by video streaming are solved, and the system stability is improved.

CN119815089AActive Publication Date: 2025-04-11GREAT WALL MOTOR CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411915779.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-11
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

In the in-vehicle infotainment system, the video stream sometimes causes the video transmission channel to be frequently opened and closed, resulting in resource conflicts, resource locking and underlying system stability problems.

Method used

By obtaining the current state of the video transmission channel, if the target state is not met, the state transition instruction is added to the state transition task or the instructions are not responded to, avoiding unnecessary resource application and release.

Benefits of technology

Reduces frequent opening and closing of video transmission channels, avoids resource conflicts and deadlocks, and improves the stability of the underlying system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119815089A_ABST
    Figure CN119815089A_ABST
Patent Text Reader

Abstract

The invention discloses a video transmission channel management method and device and a vehicle, and belongs to the technical field of vehicles. Comprising the steps that under the condition that a target system of a target vehicle is connected with video source equipment, if a state conversion instruction for a video transmission channel is received, the current channel state of the video transmission channel is obtained, and the video transmission channel is a channel for video stream transmission between the target system and the video source equipment; the state conversion instruction is used for opening or closing a video transmission channel; under the condition that the current channel state is not the target state, adding a state conversion instruction of the video transmission channel into the state conversion task or not responding to the state conversion instruction; and when the current channel state is the target state, opening or closing the video transmission channel. Therefore, opening and closing of the video transmission channel can be delayed or reduced, so that frequent application and release of transmission resources are reduced, the problems of resource conflict and deadlock are avoided, and the system stability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of vehicle technology, and in particular to a video transmission channel management method, device and vehicle. Background Art

[0002] In modern automotive systems, in-vehicle infotainment systems have gradually become an important part of the driving experience. In-vehicle infotainment systems are designed to provide drivers and passengers with a wealth of entertainment, navigation, communication and other services. At present, in-vehicle infotainment systems have also introduced advanced technologies such as screen mirroring and smart assistants. Among these advanced technologies, the transmission and display of video streams are relatively core parts.

[0003] Generally, when transmitting video streams, the in-vehicle infotainment system first establishes a connection with the video source and applies to open a video transmission channel, after which the video source transmits the video stream through the video transmission channel. The video transmission channel is closed when there is no video stream transmission.

[0004] However, when the video source comes from an external device (such as mobile phone mirroring, driving recorder, etc.), the video stream may be intermittent, which will cause the video transmission channel to be frequently opened and closed. The frequent opening and closing of the video transmission channel involves the frequent application and release of transmission resources, which can easily lead to resource conflicts and resource locking problems, and even cause the risk of video transmission channel unavailability, which in turn can easily cause system underlying stability problems. Summary of the invention

[0005] The present application provides a video transmission channel management method, device, vehicle and storage medium, which can choose not to open or close the video transmission channel or open or close the video transmission channel based on the current channel status of the video transmission channel, which can reduce the frequent opening and closing of the video transmission channel, thereby reducing the frequent application and release of transmission resources, thereby avoiding resource conflicts and resource locking problems, and can enhance the stability of the bottom layer of the system. The technical solution includes the following contents.

[0006] In a first aspect, a video transmission channel management method is provided, the method comprising:

[0007] In the case where the target system of the target vehicle is connected to the video source device, if a state conversion instruction for a video transmission channel is received, obtaining a current channel state of the video transmission channel, wherein the video transmission channel is a channel for performing video stream transmission between the target system and the video source device, and the state conversion instruction is used to open or close the video transmission channel;

[0008] When the current channel state is not the target state, adding the state transition instruction for the video transmission channel to the state transition task or not responding to the state transition instruction;

[0009] When the current channel state is the target state, the video transmission channel is opened or closed.

[0010] In the present application, after the connection is established between the target system and the video source device, there is a video transmission channel for video stream transmission. Subsequently, when a state conversion instruction for the video transmission channel is received, that is, when an instruction to open or close the video transmission channel is received, the current channel state of the video transmission channel is first obtained. Afterwards, when the current channel state is not the target state, the state conversion instruction for the video transmission channel is added to the state conversion task or the state conversion instruction for the video transmission channel is not responded to. When the current channel state is the target state, the video transmission channel is opened or closed. In the present application, by adding the state conversion instruction to the state conversion task or not responding to the state conversion instruction when the current channel state is not the target state, when the current channel state does not meet the state conversion requirements, the state conversion instruction is not executed first, but is temporarily stored in the state conversion task or the state conversion instruction is not executed. From the perspective of transmission resources, the transmission resources can be added to the state conversion task instead of applying for / releasing the transmission resources first, and the transmission resources can be applied / released after the release / application of the current transmission resources of the video transmission channel is completed. In addition, if there is no need to execute the state transition instruction in the current channel state, you can directly not apply for / release the transmission resources, thereby reducing unnecessary application / release of transmission resources. This can overcome the problems of resource conflicts and deadlocks in the system, and then solve the problem of underlying memory allocation in the system to improve the underlying stability of the system.

[0011] Optionally, the state conversion instruction includes an opening instruction or a closing instruction, the target state includes an opened state or an unopened state, and when the current channel state is the target state, opening or closing the video transmission channel includes:

[0012] In the case where the state conversion instruction is an opening instruction, if the current channel state is an unopened state, opening the video transmission channel;

[0013] In the case where the state conversion instruction is a closing instruction, if the current channel state is an opened state, the video transmission channel is closed.

[0014] In the present application, the video transmission channel is opened when the current channel state is an unopened state, and the video transmission channel is closed when the current channel state is an opened state, so that the state transition of opening or closing the video transmission channel meets the normal state transition requirements, thereby improving the success rate of opening / closing the video transmission channel.

[0015] Optionally, the channel state of the video transmission channel includes an unopened state, an opening state, an opened state and a closing state, the state transition instruction includes an opening instruction or a closing instruction, and the target state includes an opened state or an unopened state; when the current channel state is not the target state, adding the state transition instruction for the video transmission channel to the state transition task or not responding to the state transition instruction includes:

[0016] In the case where the state transition instruction is an opening instruction, if the current channel state is an opening state, an opened state, or a closing state, then adding the opening instruction for the video transmission channel to the state transition task or not responding to the opening instruction;

[0017] In the case where the state transition instruction is a close instruction, if the current channel state is an unopened state, an opening state or a closing state, a close instruction for the video transmission channel is added to the state transition task or the close instruction is not responded to.

[0018] In the present application, by adding the opening instruction / closing instruction of the video transmission channel to the state transition task or not responding to the opening instruction / closing instruction, when the current channel state of the video transmission channel does not meet the state transition requirements, the opening instruction / closing instruction is not executed first or is not executed subsequently, but is added to the state transition task to wait for the subsequent requirements to be met before execution, thereby delaying or reducing the opening / closing operation of the video transmission channel.

[0019] Optionally, if the current channel state is an opening state, an opened state, or a closing state, adding an opening instruction for the video transmission channel to the state transition task or not responding to the opening instruction comprises:

[0020] When the current channel state is in a closed state, adding an opening instruction for the video transmission channel to the state transition task;

[0021] When the current channel state is in the opening state or the opened state, the opening instruction is not responded;

[0022] Optionally, if the current channel state is an unopened state, an opening state, or a closing state, adding a closing instruction for the video transmission channel to the state transition task or not responding to the closing instruction comprises:

[0023] When the current channel state is in the open state, adding a closing instruction for the video transmission channel to the state transition task;

[0024] When the current channel state is not open or is in the closing state, the closing instruction is not responded to.

[0025] In this case, by adding the open instruction / close instruction to the state transition task, the open instruction / close instruction is executed only when the current channel state meets the requirements, or the open instruction / close instruction is not executed, thereby avoiding the problem of reapplying for resources and frequently opening the video transmission channel.

[0026] Optionally, when the current channel state is in the closed state, after adding the opening instruction of the video transmission channel to the state transition task, the method further includes:

[0027] When it is detected that the current channel state is converted to an unopened state, the opening instruction is executed to open the video transmission channel.

[0028] In the present application, since the opening instruction of the video transmission channel is added to the state transition task in order to wait for the channel state of the video transmission channel to meet the requirements, then when it is detected that the current channel state is not open, since the state that has never been opened can be converted to the state that is being opened, it means that the channel state of the video transmission channel meets the state transition requirements for opening the video transmission channel, so in this case, the opening instruction can be executed to open the video transmission channel.

[0029] Optionally, when the current channel state is in the open state, after adding the closing instruction of the video transmission channel to the state transition task, the method further includes:

[0030] When it is detected that the current channel state is converted to an open state, the closing instruction is executed to close the video transmission channel.

[0031] In the present application, since the closing instruction of the video transmission channel is added to the state transition task in order to wait for the channel state of the video transmission channel to meet the requirements, then when it is detected that the current channel state is in the opened state, since the opened state can be converted to the closing state, it means that the channel state of the video transmission channel meets the state transition requirements for closing the video transmission channel, so in this case, the closing instruction can be executed to close the video transmission channel.

[0032] Optionally, the method further comprises:

[0033] When the current channel state is not the target state, obtaining the state transition task;

[0034] Detecting whether there is a state transition task identical to a target task in the state transition task, the target task being the state transition instruction added last in the state transition task;

[0035] In the case that there is a state transition task identical to the target task in the state transition tasks, the remaining state transition tasks except the target task in the state transition tasks are deleted to execute the state transition instruction indicated by the target task.

[0036] In the present application, by deleting the remaining state transition tasks except the target task, only the final state tasks are retained in the task queue, that is, only the tasks that need to be executed in the end are retained, ensuring that only meaningful operations are performed subsequently, and discarding unnecessary intermediate state transitions and redundant operations, thereby reducing unnecessary system overhead and improving overall system performance.

[0037] Optionally, when the current channel state is the target state, opening or closing the video transmission channel includes:

[0038] When the current channel state is the target state, obtaining the last state conversion time of the video transmission channel;

[0039] When the time interval between the last state conversion time of the video transmission channel and the current time is greater than or equal to a preset interval threshold, the video transmission channel is opened or closed.

[0040] In this application, frequent opening / closing of the video transmission channel in a short period of time will lead to frequent resource application and release, which will cause resource conflicts, deadlocks and other problems, resulting in unstable underlying state. When the time interval between the last state conversion time of the video transmission channel and the current time is greater than or equal to the preset interval threshold, it means that the time interval between the last time the video transmission channel was opened / closed and the time to open / close the video transmission channel this time is large, that is, there is a long period of time when the video transmission channel is not opened / closed. At this time, opening / closing the video transmission channel can avoid resource conflicts and deadlocks.

[0041] Optionally, the method further comprises:

[0042] When the time interval between the last state transition time of the video transmission channel and the current time is less than the preset interval threshold, the video transmission channel is opened or closed after a target duration, and the target duration is greater than or equal to the difference between the time interval and the preset interval threshold.

[0043] In the present application, by opening or closing the video transmission channel after the target duration, the time interval between two opening / closing of the video transmission channel can be greater than or equal to the preset interval threshold, that is, the time interval between opening / closing the video transmission channel can be maintained for a longer duration, so that there will be no frequent opening / closing of the video transmission channel in a short period of time, and there will be no resource conflicts or deadlock problems, so that the underlying state of the system can be kept stable.

[0044] In a second aspect, a video transmission channel management device is provided, the device comprising:

[0045] A first acquisition module is used to acquire the current channel state of the video transmission channel if a state conversion instruction for a video transmission channel is received when a target system of a target vehicle is connected to a video source device, wherein the video transmission channel is a channel for performing video stream transmission between the target system and the video source device, and the state conversion instruction is used to open or close the video transmission channel;

[0046] A task adding module, used for adding the state conversion instruction for the video transmission channel to the state conversion task or not responding to the state conversion instruction when the current channel state is not the target state;

[0047] The opening and closing module is used to open or close the video transmission channel when the current channel state is the target state.

[0048] Optionally, the state conversion instruction includes an opening instruction or a closing instruction, the target state includes an opened state or an unopened state, and the opening and closing module is used to:

[0049] In the case where the state conversion instruction is an opening instruction, if the current channel state is an unopened state, opening the video transmission channel;

[0050] In the case where the state conversion instruction is a closing instruction, if the current channel state is an opened state, the video transmission channel is closed.

[0051] Optionally, the channel state of the video transmission channel includes an unopened state, an opening state, an opened state, and a closing state, the state conversion instruction includes an opening instruction or a closing instruction, and the target state includes an opened state or an unopened state; the task adding module is used to:

[0052] In the case where the state transition instruction is an opening instruction, if the current channel state is an opening state, an opened state, or a closing state, then adding the opening instruction for the video transmission channel to the state transition task or not responding to the opening instruction;

[0053] In the case where the state transition instruction is a close instruction, if the current channel state is an unopened state, an opening state or a closing state, a close instruction for the video transmission channel is added to the state transition task or the close instruction is not responded to.

[0054] Optionally, the task adding module is used to:

[0055] When the current channel state is in a closed state, adding an opening instruction for the video transmission channel to the state transition task;

[0056] When the current channel state is in the opening state or the opened state, the opening instruction is not responded;

[0057] Optionally, the task adding module is used to:

[0058] When the current channel state is in the open state, adding a closing instruction for the video transmission channel to the state transition task;

[0059] When the current channel state is not open or is in the closing state, the closing instruction is not responded to.

[0060] Optionally, the device further comprises:

[0061] A first execution module, configured to execute the opening instruction to open the video transmission channel when detecting that the current channel state is converted to an unopened state;

[0062] Optionally, the device further comprises:

[0063] The second execution module is used to execute the closing instruction to close the video transmission channel when it is detected that the current channel state is converted to an open state.

[0064] Optionally, the device further comprises:

[0065] A second acquisition module, used to acquire the state transition task;

[0066] A detection module, used to detect whether there is a state transition task identical to a target task in the state transition task, wherein the target task is the state transition instruction added last in the state transition task;

[0067] The deleting module is used to delete the remaining state transition tasks except the target task in the state transition tasks when there is a state transition task identical to the target task in the state transition tasks, so as to execute the state transition instruction indicated by the target task.

[0068] Optionally, the opening and closing module is used to:

[0069] When the current channel state is the target state, obtaining the last state conversion time of the video transmission channel;

[0070] When the time interval between the last state conversion time of the video transmission channel and the current time is greater than or equal to a preset interval threshold, the video transmission channel is opened or closed.

[0071] Optionally, the opening and closing module is further used for:

[0072] When the time interval between the last state transition time of the video transmission channel and the current time is less than the preset interval threshold, the video transmission channel is opened or closed after a target duration, and the target duration is greater than or equal to the difference between the time interval and the preset interval threshold.

[0073] In a third aspect, a vehicle is provided, the vehicle comprising:

[0074] A memory for storing executable program codes;

[0075] The processor is used to call and run the executable program code from the memory, so that the vehicle executes the above-mentioned video transmission channel management method.

[0076] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned video transmission channel management method is implemented.

[0077] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the steps of the above-mentioned video transmission channel management method.

[0078] It can be understood that the beneficial effects of the second, third, fourth and fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0080] Figure 1 It is a schematic diagram of an implementation environment of a video transmission channel management method provided in an embodiment of the present application;

[0081] Figure 2 It is a scenario diagram of a video transmission channel management method provided by an embodiment of the present application;

[0082] Figure 3 is a flow chart of a video transmission channel management method provided by an embodiment of the present application;

[0083] Figure 4 is a timing diagram of a video transmission channel management method provided in an embodiment of the present application;

[0084] Figure 5 is a flowchart of another video transmission channel management method provided by an embodiment of the present application;

[0085] Figure 6 It is a structural diagram of a video transmission channel management device provided in an embodiment of the present application;

[0086] Figure 7 It is a structural schematic diagram of a vehicle provided in an embodiment of the present application. DETAILED DESCRIPTION

[0087] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0088] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.

[0089] First, the terms involved in the embodiments of the present application are explained.

[0090] In-Vehicle Infotainment System (IVI): The in-vehicle infotainment system is an integrated multimedia entertainment and information processing system in modern cars, designed to provide drivers and passengers with rich entertainment, navigation, communication and other functions.

[0091] Screen mirroring: a technology that transfers the screen content of an external device (such as a mobile phone) to the car screen, which is generally used to expand the functions of the car computer.

[0092] Camera2 API: A high-level API (Application Programming Interface) provided by Android for managing device cameras, which supports sophisticated camera control and video stream operations. In the embodiment of the present application, the video transmission channel is opened or closed by using the Camera2 API encoding. That is, the vehicle video stream is transmitted by calling the Camera2 API. In addition, the call to the Camera2 API in the embodiment of the present application is not actually calling the camera.

[0093] State machine: A mathematical model that is used to define the various states of a system and how to transition from one state to another under different events. A state machine consists of states, events, and transitions. States: Different states that a system may be in, such as on, off, paused, etc. Events: Triggering events that cause state transitions, such as button clicks, sensor signals, etc. Transitions: Defines a transition from one state to another, usually associated with a specific event. For example, the transition of a system from one state to another can be recorded when there is an event with a button click. In an embodiment of the present application, a state machine is used to manage the channel state of a video transmission channel.

[0094] Task queue: a data structure used to store and manage pending tasks to ensure the orderly execution of tasks. In the embodiment of the present application, the task queue is used to store and manage the state transition tasks of the video transmission channel.

[0095] Lock mechanism: A technical means used in a multi-threaded environment to ensure that the operation of shared resources is safe and does not cause competition. In the embodiment of the present application, it is used to ensure that the state conversion operation of the video transmission channel does not cause conflict.

[0096] Before describing the video transmission channel management method provided in the embodiment of the present application, the implementation environment of the embodiment of the present application is first described.

[0097] For example, Figure 1 Schematic diagram of the implementation environment of a video transmission channel management method provided by an embodiment of the present application. Figure 1 , Figure 1 The vehicle 101 and the video source device 102 are included.

[0098] The vehicle 101 may be equipped with an in-vehicle infotainment system 103, and the in-vehicle infotainment system 103 may realize functions such as screen mirroring, multimedia playback, navigation, and in-vehicle information display. In the embodiment of the present application, the in-vehicle infotainment system 103 may realize video streaming transmission.

[0099] The video source device 102 is a device for providing a video stream. Optionally, the video source device 102 may be a mobile terminal such as a mobile phone, a tablet computer, a PDA, or an external device such as a driving recorder.

[0100] The video source device 102 may communicate with the in-vehicle infotainment system 103 of the vehicle 101 via a wired connection or a wireless connection. The wireless connection includes but is not limited to a network connection, a Bluetooth connection, and the like.

[0101] In the embodiment of the present application, after the in-vehicle infotainment system 103 establishes a connection with the video source device 102, if the video source device wants to transmit a video stream to the in-vehicle infotainment system 103, then an application can be made for transmission resources between the in-vehicle infotainment system 103 and the video source device 102 to open a video transmission channel between the in-vehicle infotainment system 103 and the video source device 102, so as to subsequently perform video stream transmission through the video transmission channel.

[0102] The application scenarios of the embodiments of the present application are further described.

[0103] For example, Figure 2Schematic diagram of a video transmission channel management method provided by an embodiment of the present application. Camera2 API can be applied to video streaming transmission on mobile devices and video streaming transmission on vehicles. Figure 2 , Figure 2 The process diagram includes a process diagram of video streaming transmission on a mobile device and a process diagram of video streaming transmission between a vehicle and an external video source.

[0104] Take mobile phones as an example. Figure 2 As shown, when transmitting video streams on a mobile phone, the camera is called by calling the Camera2 API to activate the camera and open the Camera2 channel, and then the video stream captured by the camera can be transmitted to the application. Since the connection between the camera of the mobile phone and the application is fixed, that is, as long as the camera is activated, it means that there is a connection between the camera and the application, that is, the camera has been transmitting video streams to the application, which means that the path between hardware and software is very clear, so there will be no frequent opening and closing of the video transmission channel, so that the video stream transmission on the mobile phone is continuous and stable.

[0105] When calling the Camera2 API to transmit video streams on a vehicle, the call to the Camera2 API is not to open the camera, but to transmit the video stream. Specifically, when transmitting the video stream, the in-vehicle infotainment system first establishes a connection with the external video source. When the video stream is to be transmitted, a request is made to open the video transmission channel (Camera2 channel). The video stream is then transmitted from the external device to the in-vehicle infotainment system through the video transmission channel and displayed through an application.

[0106] Since the in-vehicle infotainment system does not always transmit data after connecting to the external video source, the video transmission channel between the in-vehicle infotainment system and the external video source may be closed to save resources when there is no video stream transmission. When the video data needs to be transmitted again, an application is made to open the video transmission channel between the in-vehicle infotainment system and the external video source, and then the video stream is transmitted through the video transmission channel.

[0107] In addition, there are multiple screens in current vehicles, such as the central control screen, the co-pilot screen, the ceiling screen, the rear screen, etc. The video data of the external video source can be transmitted and displayed on any one of the multiple screens. Consider a scenario where there are multiple passengers in the vehicle, and some passengers may want the screen mirroring to be displayed on the screen they want to display. Then the passengers will switch the display screen of the screen mirroring. If multiple passengers switch the display screen, the display screen will be frequently switched, and the video stream will appear sometimes and sometimes not.

[0108] For the bottom layer of the system, when switching the display screen, it is necessary to first close the video transmission channel between the external video source and the in-vehicle infotainment system, and then open the video transmission channel between the external video source and the in-vehicle infotainment system after the display screen is successfully switched. However, the process of switching the display screen involves two operations on the video transmission channel, that is, first perform the closing operation and then perform the opening operation. Then, in the case of frequent switching of the display screen, the video transmission channel will be frequently opened and closed.

[0109] The process of opening and closing the video transmission channel involves the application and release of transmission resources. In the above scenario, there will be frequent application and release of transmission resources. The application and release of transmission resources both take a certain amount of time. In the above scenario, the transmission resources may be applied for again before they are successfully released. The result of this phenomenon is that the closing operation keeps releasing transmission resources, and the opening operation keeps applying for transmission resources. In this case, the transmission resources applied for again will be released again, which will enter an infinite loop and cause the opening operation to fail to execute successfully, which will cause resource conflicts and deadlocks in the system. In addition, the application and release of resources involve the allocation and recovery of memory in the underlying system, so this will cause problems with the underlying memory allocation of the system, thereby reducing the underlying stability of the system.

[0110] To this end, an embodiment of the present application provides a video transmission channel management method, which can be applied to a scenario in which a vehicle's in-vehicle infotainment system is connected to an external video source for video stream transmission.

[0111] Specifically, after the vehicle's in-vehicle infotainment system establishes a connection with an external video source, upon receiving an application to open / close a video transmission channel, the current channel state of the video transmission channel is first obtained. Afterwards, if the current channel state is not the target state, the task of opening / closing the video transmission channel is added to the state transition tasks to be executed or the video transmission channel is not opened / closed. The video transmission channel is opened / closed only when the current channel state is the target state.

[0112] In the embodiment of the present application, when the current channel state is not the target state, the task of opening / closing the video transmission channel is added to the state transition task to be executed or the video transmission channel is not opened / closed, and the video transmission channel can be opened / closed when the current channel state is the target state. Thus, when the current channel state does not meet the state transition requirements, the operation of opening / closing the video transmission channel is not performed first, but temporarily stored in the state transition task or the operation of opening / closing the video transmission channel does not need to be performed. From the perspective of transmission resources, the transmission resources can be not applied / released first, but added to the state transition task, and the transmission resources can be applied / released after the current transmission resources of the video transmission channel are released / application is completed. In addition, when there is no need to perform the open / close operation in the current channel state, the transmission resources can be directly not applied / released, so that unnecessary application / release of the transmission resources can be reduced, which can overcome the problem of resource conflict and deadlock in the system, and then the problem of system bottom memory allocation can be solved to improve the stability of the system bottom.

[0113] For example, when switching the display screen, the operation of closing the video transmission channel is executed first, and then the operation of opening the video transmission channel is executed. Assuming that the video transmission channel is being closed at this time, the operation of opening the video transmission channel is received. Then you can first get the current channel status. Since the video transmission channel is being closed, the current channel status should be in the closing state. However, to open the video transmission channel, the current channel status must be in the unopened state. Therefore, you can first add the opening operation to the state transition task and wait until the current channel status is in the unopened state before executing it.

[0114] In this way, when an operation to open the video transmission channel is received during the process of closing the video transmission channel, the opening operation is added to the state transition task, so that the task of releasing the transmission resources during the process of closing the video transmission channel can be successfully completed, and after the release of the transmission resources is completed, the transmission resources are applied for again to open the video transmission channel. This can avoid the phenomenon of applying for transmission resources again before the transmission resources are successfully released, solve the problems of resource conflicts and deadlocks, and thus improve the stability of the underlying system.

[0115] The video transmission channel management method provided in the embodiment of the present application is explained in detail below.

[0116] Figure 3 is a flow chart of a video transmission channel management method provided by an embodiment of the present application. The method can be applied to the vehicle-mounted infotainment system of a vehicle. Figure 3 , the method comprises the following steps.

[0117] Step 301: When a target system of a target vehicle establishes a connection with a video source device, if a state conversion instruction for a video transmission channel is received, the current channel state of the video transmission channel is obtained. The video transmission channel is a channel for transmitting video streams between the target system and the video source device. The state conversion instruction is used to open or close the video transmission channel.

[0118] The target system is a system in the target vehicle that can perform video streaming, for example, the target system can be a system with a screen mirroring function. In the embodiment of the present application, the target system can be an in-vehicle infotainment system.

[0119] The state conversion instruction may include an open instruction and a close instruction. The open instruction refers to opening the video transmission channel, and the subsequent state of the video transmission channel is to be converted to the open state. The close instruction refers to closing the video transmission channel, and the subsequent state of the video transmission channel is to be converted to the closed state.

[0120] In the embodiment of the present application, the state transition instruction can be issued by the video source device. For example, when the video source device has a video stream to be sent to the target system, the video source device can apply to open the video transmission channel between the two, that is, send an opening instruction for the video transmission channel. For another example, when the video source device does not have a video stream to send to the target system, it can apply to close the video transmission channel, that is, send a closing instruction for the video transmission channel.

[0121] In this case, when a state conversion instruction for a video transmission channel is received, the current channel state of the video transmission channel is first acquired, so that it can be subsequently determined whether to execute the state conversion instruction based on the current channel state.

[0122] Optionally, the channel status of the video transmission channel may include an unopened state (IDLE), an opening state (OPENING), an opened state (OPENED) and a closing state (CLOSING).

[0123] The following describes the conversion relationship between several channel states of the video transmission channel.

[0124] The unopened state means that the video transmission channel is in the closed state, and the opened state means that the video transmission channel is in the process of opening. After receiving an instruction to open the video transmission channel, the video transmission channel can enter the opened state. After the video transmission channel is successfully opened, the video transmission channel can be converted from the opened state to the opened state, and the opened state is the state in which the video transmission channel has been successfully opened. The closed state means that the video transmission channel is in the process of closing, and after receiving an instruction to close the video transmission channel, the video transmission channel can enter the closed state. After the video transmission channel is successfully closed, the channel state of the video transmission channel can be converted to the unopened state.

[0125] In the embodiment of the present application, the channel state of the video transmission channel can be managed by a state machine. Then the operation of obtaining the current channel state in the above step 301 can also be: obtaining the current channel state of the video transmission channel recorded by the state machine.

[0126] The following describes how to manage the channel status of the video transmission channel through the state machine.

[0127] The state machine includes states, events and transitions. The state is the channel state of the video transmission channel, which refers to the unopened state, the opening state, the opened state and the closing state.

[0128] The conversion relationship includes: conversion from an unopened state to an opening state, conversion from an opening state to an opened state, conversion from an opened state to a closing state, and conversion from a closing state to an unopened state.

[0129] Event: The triggering event that causes the state transition, that is, under what circumstances will the above-mentioned transition relationship be triggered. For the transition from the unopened state to the opening state, that is, when the opening instruction of the video transmission channel is received, the transition from the unopened state to the opening state can be triggered. Subsequently, when it is detected that the video transmission channel is successfully opened, the transition from the opening state to the opened state can be triggered. For the transition from the opened state to the closing state, when the closing instruction of the video transmission channel is received, the transition from the opened state to the closing state can be triggered. Subsequently, when it is detected that the video transmission channel is successfully closed, the transition from the closing state to the unopened state can be triggered.

[0130] Step 302: When the current channel state is not the target state, a state conversion instruction for the video transmission channel is added to the state conversion task or the state conversion instruction is not responded to.

[0131] The target state refers to the channel state that can be converted to a state corresponding to the state transition instruction. In other words, the target state can be converted to the channel state indicated by the state transition instruction. In an embodiment of the present application, the target state may include an opened state or an unopened state. It should be understood that the target state changes with different state transition instructions. For example, when the unopened state is converted to the opening state, that is, when the opening instruction for the video transmission channel is received, the target state should be the unopened state to open the video transmission channel. For another example, to close the video transmission channel, it is necessary to ensure that the target state is the opened state before closing it.

[0132] In an embodiment of the present application, the target state can be determined based on the state transition instruction.

[0133] Specifically, based on the state conversion instruction, a corresponding channel state is obtained from a preset corresponding relationship and determined as a target state.

[0134] The preset corresponding relationship is the corresponding relationship between the target state and the state transition instruction.

[0135] For example, Table 1 is the correspondence between the target state and the state transition instruction. Referring to Table 1, the state transition instruction in Table 1 includes an open instruction and a close instruction, and the target state corresponding to the open instruction is the unopened state, and the target state corresponding to the close instruction is the opened state.

[0136] Table 1

[0137] State transition instructions Target state Open Command Not open Close Command Opened state

[0138] A state transition task refers to a task to be executed for opening or closing a video transmission channel. In an embodiment of the present application, the state transition task includes at least one unexecuted state transition instruction.

[0139] In the embodiment of the present application, a task queue may be provided, and the state transition tasks may be stored in the task queue.

[0140] Optionally, the task queue may include but is not limited to a first-in-first-out queue or a last-in-first-out queue. For example, the task queue may be a LinkedBlockingQueue (linked list blocking queue) implemented based on a linked list.

[0141] In this case, when the current channel state is not the target state, the state transition instruction is added to the state transition task or the state transition instruction is not responded to, so that when the current channel state does not meet the state transition requirements, the state transition instruction is not executed first, but is temporarily stored in the state transition task or does not need to be executed. From the perspective of transmission resources, the transmission resources can be added to the state transition task instead of applying for / releasing them first, and then the transmission resources can be applied / released after the release / application of the current transmission resources of the video transmission channel is completed. In addition, when there is no need to execute the state transition instruction in the current channel state, the transmission resources can be directly not applied / released, thereby reducing unnecessary application / release of transmission resources, which can overcome the problems of resource conflicts and deadlocks in the system, and then solve the problem of underlying memory allocation in the system to improve the underlying stability of the system.

[0142] The beneficial effects of step 302 are illustrated below by way of example.

[0143] In the prior art, if an instruction to open a video transmission channel is received during the process of closing the video transmission channel, the instruction to open the video transmission channel will be directly executed. In this case, there will be a phenomenon that the transmission resources are applied for again before the transmission resources are successfully released. The result of this phenomenon is that the closing instruction corresponds to the continuous release of transmission resources, and the opening instruction corresponds to the continuous application of transmission resources, which will cause the transmission resources applied for again to be released again, thereby entering an infinite loop, causing the opening instruction to fail to be successfully executed, that is, causing resource conflicts, deadlocks and other problems in the system. In addition, the application and release of resources involve the allocation and recovery of memory in the bottom layer of the system, so this will cause problems in the memory allocation of the bottom layer of the system, thereby reducing the stability of the bottom layer of the system.

[0144] In an embodiment of the present application, assuming that an instruction to open a video transmission channel is received while the video transmission channel is being closed, and the current channel state is not the target state, the opening instruction is first added to the state transition task, and then executed when the current channel state is not open.

[0145] Assuming that an instruction to close the video transmission channel is received while the video transmission channel is being closed, and the current channel state is not the target state, the instruction to close the video transmission channel may not be executed.

[0146] In this case, when an instruction to open the video transmission channel is received during the process of closing the video transmission channel, the opening instruction is added to the state transition task, so that the task of releasing the transmission resources during the process of closing the video transmission channel can be successfully completed, and after the release of the transmission resources is completed, the application for the transmission resources is started again to open the video transmission channel. In addition, when there is no need to repeatedly execute the closing instruction, the closing instruction is directly not executed, thereby avoiding the phenomenon of applying for the transmission resources again before the transmission resources are successfully released, or reducing the phenomenon of unnecessary application / release of transmission resources, which can solve the problems of resource conflicts and deadlocks, and further avoid problems with the underlying memory allocation of the system, so as to improve the underlying stability of the system.

[0147] Optionally, the operation of step 302 may be implemented in the following two possible situations according to the specific type of the state transition instruction.

[0148] In the first case, when the state transition instruction is an open instruction, if the current channel state is an opening state, an opened state, or a closing state, the open instruction for the video transmission channel is added to the state transition task or the open instruction is not responded to.

[0149] In the case where the state transition instruction is an open instruction, that is, to open the video transmission channel, the state transition relationship at this time should be from the unopened state to the opening state, and then from the opening state to the opened state. That is to say, the video transmission channel can only be successfully opened when the current channel state is the unopened state, and the video transmission channel cannot be directly opened when the current channel state is the opening state, the opened state, or the closing state. Therefore, the opening instruction for the video transmission channel can be added to the state transition task or the opening instruction can be ignored.

[0150] In this case, by adding the opening instruction of the video transmission channel to the state transition task or not responding to the opening instruction, when the current channel state of the video transmission channel does not meet the state transition requirements, the opening instruction is not executed first or subsequently. Instead, it is added to the state transition task to wait until the requirements are met later before being executed, thereby delaying or reducing the opening of the video transmission channel.

[0151] Optionally, after adding the opening instruction for the video transmission channel to the state transition task, the opening instruction may be executed to open the video transmission channel when it is detected that the current channel state is transitioned to an unopened state.

[0152] Since the opening instruction of the video transmission channel is added to the state transition task in order to wait for the channel state of the video transmission channel to meet the requirements, if it is detected that the current channel state is not open, since the state that has never been opened can be converted to the state that is being opened, it means that the channel state of the video transmission channel meets the state transition requirements for opening the video transmission channel, so in this case, the opening instruction can be executed to open the video transmission channel.

[0153] Optionally, when it is detected that the current channel state is converted to an unopened state, the operation of executing the open instruction may be: when it is detected that the current channel state is converted to an unopened state, if no new state conversion instruction is received, execute the open instruction; if a new state conversion instruction is received, if the new state conversion instruction is also an open instruction, execute the open instruction.

[0154] Optionally, if the new state transition instruction received is a closing instruction, the opening instruction is not executed.

[0155] When it is detected that the current channel state is converted to the unopened state, it means that the unopened state can be converted to the opened state, that is, the opening instruction can be executed. However, if a closing instruction is received at this time, it means that the ultimate task at this time is to close the video transmission channel. In order to avoid frequent opening / closing of the video transmission channel, there is no need to execute the opening instruction, so the opening instruction can be not executed.

[0156] Furthermore, since the current channel state is not open, the ultimate task is to close the video transmission channel, so the newly received closing instruction may not be executed at this time.

[0157] Among them, if the current channel state is in the opening state, the opened state or the closing state, the operation of adding the opening instruction of the video transmission channel to the state transition task or not responding to the opening instruction can be: when the current channel state is the closing state, the opening instruction of the video transmission channel is added to the state transition task; when the current channel state is in the opening state or the opened state, the opening instruction is not responded.

[0158] When the current channel state is in the closing state, it means that the video transmission channel needs to be converted from the current channel state to the unopened state first, and then it can be converted from the unopened state to the opening state later. That is to say, the current closing state cannot be directly converted to the unopened state, so in this case, the video transmission channel cannot be directly opened. From the perspective of transmission resources, the transmission resources for the video transmission channel are being released and have not been fully released. At this time, directly executing the open command may result in the aforementioned problem of applying for transmission resources again before the transmission resources are fully released, thereby causing resource conflicts and deadlock problems. Therefore, the open command can be added to the state transition task to wait until the current channel state meets the requirements before executing the open command.

[0159] When the current channel status is in the opening state or the opened state, it means that the video transmission channel is being opened or has been opened, which is the same as the channel status obtained after executing the opening instruction. Therefore, in this case, the opening instruction may not be responded to, that is, the opening instruction is not executed. This can avoid the problem of re-applying for resources and frequently opening the video transmission channel.

[0160] Among them, when the current channel state is the closing state, the operation of adding the opening instruction of the video transmission channel to the state transition task can be: when the current channel state is the closing state, determine whether the target task in the state transition task is the opening instruction of the video transmission channel; when the target task is not the opening instruction of the video transmission channel, add the opening instruction of the video transmission channel to the state transition task.

[0161] The target task is the state transition instruction added last in the state transition task.

[0162] In this case, it is to determine whether the last state transition instruction added in the state transition task is an open instruction. When the last state transition instruction added in the state transition task is not an open instruction, it means that the last task added in the state transition task is not to open the video transmission channel, and there will be no redundant open operations. Then the open instruction of the video transmission channel can be added to the state transition task.

[0163] Optionally, when the target task is an opening instruction for a video transmission channel, the current opening instruction will be deleted.

[0164] When the target task is an instruction to open a video transmission channel, it means that the last task added in the state transition task is also to open the video transmission channel. If the instruction to open the video transmission channel is added to the state transition task, there will be two instructions to open the video transmission channel. Subsequently, there will be two openings of the video transmission channel, resulting in redundant opening operations. Therefore, in this case, the current opening instruction can be deleted.

[0165] When the target task is an opening instruction for a video transmission channel, by deleting the current opening instruction, the same opening operation can be performed once, thereby avoiding unnecessary redundant operations and saving computing resources.

[0166] Optionally, when the current channel state is in the opening state or the opened state, after not responding to the opening instruction, the state transition task may be cleared.

[0167] Since the latest state conversion instruction received is an open instruction, when the current channel state is in the opening state or the opened state, it means that the channel state of the video transmission channel has been the channel state required by the latest state conversion instruction received. The instructions listed in the state conversion task may be the same open instruction as this time or an intermediate conversion task (close instruction) different from this time. In this case, when the channel state required by the latest state conversion instruction is reached, there is no need to execute the instructions in the state conversion task, so the state conversion task can be cleared.

[0168] In this case, by clearing the state transition task, the instructions stored in the state transition task will no longer be executed subsequently, thereby avoiding unnecessary redundant operations, reducing unnecessary open / close operations, and avoiding frequent application / release of transmission resources.

[0169] In the second case, when the state transition instruction is a close instruction, if the current channel state is an unopened state, an opening state, or a closing state, a close instruction for the video transmission channel is added to the state transition task or the close instruction is not responded to.

[0170] In the case where the state transition instruction is a closing instruction, that is, to close the video transmission channel, the state transition relationship at this time should be from the opened state to the closing state, and then from the closing state to the unopened state. In other words, the video transmission channel can only be successfully closed when the current channel state is the opened state. The video transmission channel cannot be directly closed when the current channel state is the closing state, the unopened state, or the opened state. Therefore, the closing instruction for the video transmission channel can be added to the state transition task or the closing instruction can be ignored.

[0171] In this case, by adding the closing instruction of the video transmission channel to the state transition task or not responding to the closing instruction, when the current channel state of the video transmission channel does not meet the state transition requirements, the closing instruction is not executed first or subsequently. Instead, it is added to the state transition task to wait until the requirements are met later before being executed, thereby delaying or reducing the closing operation of the video transmission channel.

[0172] Optionally, after adding a closing instruction for the video transmission channel to the state transition task, the closing instruction may be executed to close the video transmission channel when it is detected that the current channel state is transitioned to an open state.

[0173] Since the closing instruction of the video transmission channel is added to the state transition task in order to wait for the channel state of the video transmission channel to meet the requirements, if it is detected that the current channel state is in the open state, since it can be converted from the open state to the closing state, it means that the channel state of the video transmission channel meets the state transition requirements for closing the video transmission channel, so in this case, the closing instruction can be executed to close the video transmission channel.

[0174] Optionally, when it is detected that the current channel state is converted to an open state, the operation of executing the closing instruction may be: when it is detected that the current channel state is converted to an open state, if no new state conversion instruction is received, then the closing instruction is executed; if a new state conversion instruction is received, then if the new state conversion instruction is also a closing instruction, then the closing instruction is executed.

[0175] Optionally, if the new state transition instruction received is an open instruction, the close instruction is not executed.

[0176] When it is detected that the current channel state is converted to the open state, it means that the open state can be converted to the closing state, that is, the closing instruction can be executed. However, if the opening instruction is received at this time, it means that the ultimate task at this time is to open the video transmission channel. In order to avoid frequent opening / closing of the video transmission channel, there is no need to execute the closing instruction, so the closing instruction can be not executed.

[0177] Furthermore, since the current channel state is an opened state and the ultimate task is to open the video transmission channel, the newly received opening instruction may not be executed at this time.

[0178] Among them, if the current channel state is an unopened state, an opening state or a closing state, the operation of adding a closing instruction for the video transmission channel to the state transition task or not responding to the closing instruction can be: when the current channel state is an opening state, adding a closing instruction for the video transmission channel to the state transition task; when the current channel state is a closing state or an unopened state, not responding to the closing instruction.

[0179] When the current channel state is in the opening state, it means that the video transmission channel can be converted from the current channel state to the opened state, and then it can be converted from the opened state to the closing state. That is to say, the current opening state cannot be directly converted to the closing state. In this case, it is necessary to wait until the channel state of the video transmission channel is converted to the opened state before it can be closed. Therefore, the video transmission channel cannot be directly closed. From the perspective of transmission resources, the transmission resources for the video transmission channel are being applied for and have not been applied for. At this time, directly executing the closing instruction may result in the aforementioned problem of releasing the transmission resources again before the application is completed, which may cause resource conflicts and deadlock problems. In this case, the closing instruction can be added to the state transition task to wait until the current channel state meets the requirements before executing the closing instruction.

[0180] When the current channel state is in the closing state or the unopened state, it means that the video transmission channel is closing or has been closed, which is the same as the channel state obtained after executing the closing instruction. Therefore, in this case, the closing instruction may not be responded to, that is, the closing instruction is not executed.

[0181] Among them, when the current channel state is in the opening state, the operation of adding the closing instruction of the video transmission channel to the state transition task can be: when the current channel state is in the opening state, determining whether the target task in the state transition task is the closing instruction of the video transmission channel; when the target task is not the closing instruction of the video transmission channel, adding the closing instruction of the video transmission channel to the state transition task.

[0182] In this case, it is to determine whether the last state transition instruction added in the state transition task is a closing instruction. When the last state transition instruction added in the state transition task is not a closing instruction, it means that the last task added in the state transition task is not to close the video transmission channel. Then even if the closing instruction is added to the state transition task, there will be no redundant closing operation, so the closing instruction of the video transmission channel can be added to the state transition task.

[0183] Optionally, when the target task is a closing instruction for the video transmission channel, the current closing instruction will be deleted.

[0184] When the target task is a closing instruction for a video transmission channel, it means that the last task added in the state transition task is also to close the video transmission channel. If the closing instruction of this video transmission channel is added to the state transition task at this time, there will be two closing instructions for the video transmission channel. Then, there will be two subsequent closings of the video transmission channel, resulting in redundant closing operations. Therefore, in this case, the current closing instruction can be deleted.

[0185] When the target task is to issue a closing instruction to the video transmission channel, by deleting the current closing instruction, the same closing operation can be performed once, thereby avoiding unnecessary redundant operations and saving computing resources.

[0186] Optionally, when the current channel state is in a closing state or an unopened state, after not responding to the closing instruction, the state transition task may be cleared.

[0187] Since the latest state conversion instruction received is a closing instruction, when the current channel state is in the closing state or not open state, it means that the channel state of the video transmission channel has been the channel state required by the latest state conversion instruction received. The instructions listed in the state conversion task may be the same opening instruction as this time or an intermediate conversion task (closing instruction) different from this time. In this case, when the channel state required by the latest state conversion instruction is reached, there is no need to execute the instructions in the state conversion task, so the state conversion task can be cleared.

[0188] In this case, by clearing the state transition task, the instructions stored in the state transition task will no longer be executed subsequently, thereby avoiding unnecessary redundant operations, reducing unnecessary open / close operations, and avoiding frequent application / release of transmission resources.

[0189] It is worth noting that in an embodiment of the present application, when the current channel state is not the target state, a state transition task can be obtained; it is detected whether there is a state transition task that is the same as the target task in the state transition task; when there is a state transition task that is the same as the target task in the state transition task, the remaining state transition tasks except the target task in the state transition task are deleted to execute the state transition instruction indicated by the target task.

[0190] If there is a state transition task that is the same as the target task in the state transition task, it means that there is a task that is the same as the target task in the state transition task, then the same instruction may be executed repeatedly multiple times, and when there are other state transition tasks between the two repeated tasks, multiple intermediate state transition operations will be executed. Therefore, unnecessary redundant operations will be caused, which will increase system overhead.

[0191] In this case, by deleting the remaining state transition tasks except the target task, only the final state tasks are retained in the task queue, that is, only the tasks that need to be executed in the end are retained, ensuring that only meaningful operations are performed subsequently, and discarding unnecessary intermediate state transitions and redundant operations, thereby reducing unnecessary system overhead and improving overall system performance.

[0192] For example, if the state transition instruction is an open instruction and the current channel state is closed, then the open instruction is added to the state transition task. At this time, the state transition task includes an open instruction, a close instruction, and an open instruction. It can be seen that there are two operations of opening the video transmission channel and one operation of closing the video transmission channel in the state transition task, and the ultimate goal is to open the video transmission channel. Therefore, if the previous open instruction and close instruction are executed, the video transmission channel will be opened, then closed, and finally opened again, so that the video transmission channel will be frequently opened. Therefore, the open instruction and the close instruction in the state transition task can be deleted, and only the open instruction is retained, so that only the last open instruction is executed later.

[0193] It should be noted that the embodiment of the present application is also provided with a lock mechanism, which is used to perform thread control on state transitions to prevent multiple state transition tasks from being executed in parallel, thereby avoiding the problem of resource competition and ensuring the security of threads.

[0194] In the embodiment of the present application, the lock mechanism may be a reentrant lock, for example, may be set to a ReentrantLock reentrant lock.

[0195] Specifically, when a state transition instruction is to be executed, the state transition instruction can be locked, while other state transition instructions that have not been locked cannot be executed, thereby ensuring that one thread is executed at a time, thereby avoiding the problem of parallel execution of state transition tasks.

[0196] It is worth noting that the above step 302 describes a specific strategy of adding the state conversion instruction for the video outgoing channel to the state conversion task or not responding to the state conversion instruction when the current channel state is not the target state. The following describes a specific strategy when the current channel state is the target state.

[0197] Step 303: When the current channel state is the target state, the video transmission channel is opened or closed.

[0198] When the current channel state is the target state, it means that the current channel state of the video transmission channel is the channel state that should be in before the state transition. For example, when receiving an opening instruction for the video transmission channel, the target state should be the unopened state to open the video transmission channel. For another example, to close the video transmission channel, the target state should be the opened state to close it.

[0199] In this case, when the current channel state is the target state, it means that the current channel state meets the state transition requirements, that is, the video transmission channel is opened or closed only when the current channel state meets the state transition requirements. In this way, the switching frequency of the video transmission channel can be reduced and the opening / closing success rate of the video transmission channel can be improved.

[0200] Specifically, the operation of step 303 may be: when the state conversion instruction is an open instruction, if the current channel state is an unopened state, then the video transmission channel is opened; when the state conversion instruction is a close instruction, if the current channel state is an opened state, then the video transmission channel is closed.

[0201] When the state conversion instruction is an opening instruction, it indicates that the video transmission channel is to be opened. In the embodiment of the present application, to open the video transmission channel, the current channel state needs to be in an unopened state, and if the current channel state is in an unopened state, the video transmission channel can be opened.

[0202] When the state conversion instruction is a closing instruction, it indicates that the video transmission channel is to be closed. In the embodiment of the present application, to close the video transmission channel, the current channel state needs to be in an opened state, and if the current channel state is in an opened state, the video transmission channel can be closed.

[0203] In this way, the video transmission channel is opened when the current channel state is not open, and the video transmission channel is closed when the current channel state is open, so that the state transition of opening or closing the video transmission channel meets the normal state transition requirements, thereby improving the success rate of opening / closing the video transmission channel.

[0204] Optionally, the operation of step 303 can also be: when the current channel state is the target state, obtain the last state transition time of the video transmission channel; when the time interval between the last state transition time of the video transmission channel and the current time is greater than or equal to a preset interval threshold, open or close the video transmission channel.

[0205] The last state conversion time of the video transmission channel is the time when the state of the video transmission channel was last converted. For example, if the video transmission channel was closed last time, the state conversion time when the channel state of the video transmission channel was converted to the unopened state can be obtained.

[0206] The preset interval threshold can be set in advance. In an embodiment of the present application, the preset interval threshold can be set according to the duration of the transmission resource application / release. For example, if it takes 150ms (milliseconds) to apply for / release transmission resources, then the preset interval threshold can be set to a duration greater than or equal to 150ms.

[0207] Since opening / closing the video transmission channel in a short period of time will lead to frequent resource application and release, and the resource application and release takes time to complete, assuming that the current transmission resource has not been successfully applied for, and a closing instruction is received in a short period of time, the transmission resource will have to be released again, which may cause the transmission resource corresponding to the opening instruction to be released again. Such a cycle will cause the closing instruction to fail to execute, that is, it will cause resource conflicts, deadlocks and other problems, which will lead to unstable underlying state. Therefore, the video transmission channel can also be opened or closed when the time interval between the last state conversion time of the video transmission channel and the current time is greater than or equal to the preset interval threshold.

[0208] When the time interval between the last state transition time of the video transmission channel and the current time is greater than or equal to the preset interval threshold, it means that the time interval between the last time the video transmission channel was opened / closed and the time to open / close the video transmission channel this time is large, and has exceeded the time length for the system to apply for / release transmission resources. In this case, when opening / closing the video transmission channel at this time, the transmission resources will not be released / successfully applied for and then applied for / released again. In other words, after executing this open / close instruction, the latest applied transmission resources will not be released or the newly applied transmission resources will not be released again after the latest released transmission resources. This avoids resource conflicts and deadlocks, and the video transmission channel can be opened or closed at this time.

[0209] When the time interval between the last state transition time of the video transmission channel and the current time is less than the preset interval threshold, it means that the time interval between the last time the video transmission channel was opened / closed and the time to open / close the video transmission channel this time is small, and does not exceed the time length for the system to apply / release transmission resources, that is, the last opening instruction / closing instruction is still corresponding to applying / releasing transmission resources, then when the video transmission channel is opened / closed at this time, the transmission resources have not been released / successfully applied for and then applied / released again, that is, after executing this opening / closing instruction, the latest applied transmission resources will be released or the newly applied transmission resources will be released again after the latest released transmission resources, which will cause resource conflicts and deadlocks. Therefore, in this case, do not open / close the video transmission channel first.

[0210] Optionally, when the time interval between the last state conversion time of the video transmission channel and the current time is less than a preset interval threshold, the video transmission channel is opened or closed after the target duration.

[0211] The target duration may be set according to the difference between the time interval and a preset interval threshold, and the target duration may be greater than or equal to the difference between the time interval and the preset interval threshold.

[0212] Since the time interval between the last state conversion time of the video transmission channel and the current time is less than the preset interval threshold, continuing to open / close the video transmission channel is equivalent to frequently opening / closing the video transmission channel in a short period of time. At this time, when opening / closing the video transmission channel again, the transmission resources have not been released / successfully applied for and are applied / released again, that is, after executing the opening / closing instruction this time, the transmission resources that have been newly applied for will be released, or after the transmission resources have been released, the transmission resources that have been newly applied for will be released again. Therefore, in the embodiment of the present application, in this case, the video transmission channel can be opened / closed after the target duration.

[0213] In this case, by opening or closing the video transmission channel after the target duration, the time interval between opening / closing the video transmission channel twice can be greater than or equal to the preset interval threshold, that is, the time interval between opening / closing the video transmission channel can exceed the duration of the system applying for / releasing transmission resources, so that there will be no frequent opening / closing of the video transmission channel in a short period of time, and there will be no phenomenon that the transmission resources are not released / successfully applied for and then applied for / released again, which will not cause resource conflicts and deadlock problems, and the underlying state of the system can be kept stable.

[0214] It should be noted that, in the embodiment of the present application, when the current channel state is the target state, the state transition task can also be cleared after opening / closing the video transmission channel.

[0215] When the current channel state is the target state, it means that the currently received closing instruction or opening instruction can be executed. Then, after the video transmission channel is opened / closed, it means that the channel state of the video transmission channel has been the channel state required by the latest received state transition instruction. Then, there is no need to execute the instructions in the state transition task subsequently. Therefore, the state transition task can be cleared.

[0216] In this case, by clearing the state transition task, the instructions stored in the state transition task will no longer be executed subsequently. Since the channel state of the video transmission channel is already the channel state required by the latest received state transition instruction, this can avoid unnecessary redundant operations, thereby avoiding redundant application / release of transmission resources, and avoiding frequent application / release of transmission resources.

[0217] For ease of understanding, now combined Figure 4 and Figure 5 The video transmission channel management method provided in the embodiment of the present application is exemplified.

[0218] For example, Figure 4 It is a timing diagram of a video transmission channel management method provided in an embodiment of the present application. Figure 4 (a) is a timing diagram when an opening instruction for a video transmission channel is received. Figure 4 (b) is a timing diagram when a closing instruction to the video transmission channel is received.

[0219] See also Figure 4 In (a), when receiving an opening instruction for a video transmission channel, when the current channel state is IDLE, the opening instruction is directly executed, that is, the code is executed: execute OpenCamera(), or when a target duration needs to be delayed, the opening instruction is executed after the target duration is extended. After executing the opening instruction, if the video transmission channel is opened, the channel state of the video transmission channel is updated to OPENED.

[0220] When the current channel state is CLOSING, add the open command OpenCamera() to the task queue. When the current channel state is OPENING or OPEN, do not execute the open command, and then clear the state transition task to avoid redundant operations.

[0221] See also Figure 4In (b), when a closing instruction for a video transmission channel is received, when the current channel state is in the opened state (OPENED), the closing instruction can be directly executed, that is, the execution code: executeCloseCamera(), or when a target delay time is required, the closing instruction can be executed after the target delay time. After executing the closing instruction, if the video transmission channel is closed, the channel state of the video transmission channel is updated to the unopened state (IDLE).

[0222] When the current channel state is OPENING, the close instruction CloseCamera() is added to the task queue. When the current channel state is CLOSING or IDLE, the close instruction is not executed, and then the state transition task is cleared to avoid redundant operations.

[0223] For example, Figure 5 It is a flowchart of a video transmission channel management method provided in an embodiment of the present application.

[0224] like Figure 5 As shown, when receiving the opening instruction for the video transmission channel, the current channel state of the video transmission channel is first obtained. Then, it is determined whether the current channel state is not open. If the current channel state is not open (currentState==IDLE), the opening instruction is executed, that is, the execution code: executeOpenCamera(). If the time interval between opening / closing the video transmission channel twice is less than the preset interval threshold, the opening operation can be performed after a delay.

[0225] If the current channel status is not in the unopened state, determine whether the current channel status is in the CLOSING state. If the current channel status is in the CLOSING state, add the open instruction to the task queue to wait for subsequent execution. If the current channel status is not in the CLOSING state, do not execute the open instruction, and clear the task queue to avoid redundant operations.

[0226] When receiving a closing instruction for the video transmission channel, first obtain the current channel state of the video transmission channel. Then determine whether the current channel state is in the open state. If the current channel state is in the open state (currentState == OPENED), execute the closing instruction, that is, execute the code: execute CloseCamera(). If the time interval between opening / closing the video transmission channel twice is less than the preset interval threshold, the closing operation can be performed after a delay.

[0227] If the current channel status is not in the opened state, determine whether the current channel status is in the opening state. If the current channel status is in the opening state, add the closing instruction to the task queue to wait for subsequent execution. If the current channel status is not in the opening state, do not execute the closing instruction, and clear the task queue to avoid redundant operations.

[0228] In an embodiment of the present application, after the connection is established between the target system and the video source device, there is a video transmission channel for video stream transmission. When the subsequent in-vehicle infotainment system receives a state conversion instruction for the video transmission channel, that is, when receiving an instruction to open or close the video transmission channel, it first obtains the current channel state of the video transmission channel. Afterwards, if the current channel state is not the target state, the state conversion instruction for the video transmission channel is added to the state conversion task or the state conversion instruction for the video transmission channel is not responded to. When the current channel state is the target state, the video transmission channel is opened or closed. In this way, when the current channel state is not the target state, the state conversion instruction is added to the state conversion task or the state conversion instruction is not responded to, so that when the current channel state does not meet the state conversion requirements, the state conversion instruction is not executed first, but is temporarily stored in the state conversion task or the state conversion instruction is not executed. From the perspective of transmission resources, the transmission resources can be added to the state conversion task instead of applying for / releasing the transmission resources first, and the transmission resources can be continued to be applied / released after the release / application of the current transmission resources of the video transmission channel is completed. In addition, if there is no need to execute the state transition instruction in the current channel state, you can directly not apply for / release the transmission resources, thereby reducing unnecessary application / release of transmission resources. This can overcome the problems of resource conflicts and deadlocks in the system, and then solve the problem of underlying memory allocation in the system to improve the underlying stability of the system.

[0229] Figure 6 : is a schematic diagram of a video transmission channel management device provided in an embodiment of the present application. The video transmission channel management device can be implemented by software, hardware or a combination of both to form part or all of a vehicle, and the vehicle can be as follows Figure 7 Vehicle shown. See Figure 6 The device includes: a first acquisition module 601, a task adding module 602 and an opening and closing module 603.

[0230] The first acquisition module 601 is used to acquire the current channel state of the video transmission channel if a state conversion instruction for a video transmission channel is received when a target system of the target vehicle is connected to the video source device, the video transmission channel being a channel for video stream transmission between the target system and the video source device, and the state conversion instruction is used to open or close the video transmission channel;

[0231] The task adding module 602 is used to add the state conversion instruction of the video transmission channel to the state conversion task or not respond to the state conversion instruction when the current channel state is not the target state;

[0232] The opening and closing module 603 is used to open or close the video transmission channel when the current channel state is the target state.

[0233] Optionally, the state conversion instruction includes an opening instruction or a closing instruction, the target state includes an opened state or an unopened state, and the opening and closing module 603 is used to:

[0234] When the state conversion instruction is an opening instruction, if the current channel state is an unopened state, the video transmission channel is opened;

[0235] In the case where the state conversion instruction is a closing instruction, if the current channel state is an opened state, the video transmission channel is closed.

[0236] Optionally, the channel state of the video transmission channel includes an unopened state, an opening state, an opened state, and a closing state, the state conversion instruction includes an opening instruction or a closing instruction, and the target state includes an opened state or an unopened state; the task adding module 602 is used to:

[0237] In the case where the state transition instruction is an open instruction, if the current channel state is an opening state, an opened state, or a closing state, the open instruction for the video transmission channel is added to the state transition task or the open instruction is not responded to;

[0238] In the case where the state transition instruction is a close instruction, if the current channel state is an unopened state, an opening state, or a closing state, a close instruction for the video transmission channel is added to the state transition task or the close instruction is not responded to.

[0239] Optionally, the task adding module 602 is used to:

[0240] When the current channel state is in the closing state, an instruction to open the video transmission channel is added to the state transition task;

[0241] When the current channel status is in the opening state or the opened state, the opening instruction will not be responded;

[0242] Optionally, the task adding module 602 is used to:

[0243] When the current channel state is in the open state, a closing instruction for the video transmission channel is added to the state transition task;

[0244] When the current channel status is not open or closing, the closing instruction will not be responded.

[0245] Optionally, the device further comprises:

[0246] A first execution module is used to execute an opening instruction to open a video transmission channel when detecting that the current channel state is converted to an unopened state;

[0247] Optionally, the device further comprises:

[0248] The second execution module is used to execute a closing instruction to close the video transmission channel when it is detected that the current channel state is converted to an open state.

[0249] Optionally, the device further comprises:

[0250] The second acquisition module is used to acquire the state transition task when the current channel state is not the target state;

[0251] A detection module is used to detect whether there is a state transition task that is the same as the target task in the state transition task, and the target task is the state transition instruction added last in the state transition task;

[0252] The deleting module is used to delete the remaining state transition tasks except the target task in the state transition tasks when there is a state transition task identical to the target task in the state transition tasks, so as to execute the state transition instruction indicated by the target task.

[0253] Optionally, the opening and closing module 603 is used to:

[0254] When the current channel state is the target state, obtain the last state transition time of the video transmission channel;

[0255] When the time interval between the last state conversion time of the video transmission channel and the current time is greater than or equal to a preset interval threshold, the video transmission channel is opened or closed.

[0256] Optionally, the opening and closing module 603 is further used for:

[0257] When the time interval between the last state transition time of the video transmission channel and the current time is less than a preset interval threshold, the video transmission channel is opened or closed after a target duration, and the target duration is greater than or equal to the difference between the time interval and the preset interval threshold.

[0258] In an embodiment of the present application, after the connection is established between the target vehicle and the video source device, there is a video transmission channel for video stream transmission. Subsequently, when a state conversion instruction for the video transmission channel is received, that is, when an instruction to open or close the video transmission channel is received, the current channel state of the video transmission channel is first obtained. Afterwards, when the current channel state is not the target state, the state conversion instruction for the video transmission channel is added to the state conversion task or the state conversion instruction for the video transmission channel is not responded to. When the current channel state is the target state, the video transmission channel is opened or closed. In this way, when the current channel state is not the target state, the state conversion instruction is added to the state conversion task or the state conversion instruction is not responded to, so that when the current channel state does not meet the state conversion requirements, the state conversion instruction is not executed first, but is temporarily stored in the state conversion task or the state conversion instruction is not executed. From the perspective of transmission resources, the transmission resources can be added to the state conversion task instead of applying for / releasing the transmission resources first, and the transmission resources can be continued to be applied / released after the release / application of the current transmission resources of the video transmission channel is completed. In addition, if there is no need to execute the state transition instruction in the current channel state, you can directly not apply for / release the transmission resources, thereby reducing unnecessary application / release of transmission resources. This can overcome the problems of resource conflicts and deadlocks in the system, and then solve the problem of underlying memory allocation in the system to improve the underlying stability of the system.

[0259] It should be noted that: when the video transmission channel management device provided in the above embodiment manages the video transmission channel during the video stream transmission, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0260] The functional units and modules in the above embodiments may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the above integrated units may be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.

[0261] The video transmission channel management device and the video transmission channel management method provided in the above embodiments belong to the same concept. The specific working process of the units and modules in the above embodiments and the technical effects brought about can be found in the method embodiment part and will not be repeated here.

[0262] Figure 7 It is a structural schematic diagram of a vehicle provided in an embodiment of the present application.

[0263] For example, Figure 7 As shown, the vehicle includes: a memory 71 and a processor 70, wherein the memory 71 stores an executable program code 72, and the processor 70 is used to call and execute the executable program code 72 to perform the above-mentioned video transmission channel management method.

[0264] In this embodiment, the functional modules of the vehicle can be divided according to the above method example. For example, each functional module can be corresponded, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0265] In the case of dividing each functional module into corresponding functional modules, the vehicle may include: a first acquisition module, a task adding module and an opening and closing module. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.

[0266] The vehicle provided in this embodiment is used to execute the above-mentioned video transmission channel management method, and thus can achieve the same effect as the above-mentioned implementation method.

[0267] In the case of an integrated unit, the vehicle may include a processing module and a storage module. The processing module may be used to control and manage the actions of the vehicle. The storage module may be used to support the vehicle in executing corresponding program codes and data.

[0268] The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits shown in conjunction with the disclosure of the present application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.

[0269] This embodiment also provides a computer-readable storage medium, in which a computer program code is stored. When the computer program code is executed on a computer, the computer executes the above-mentioned related method steps to implement the above-mentioned video transmission channel management method in the above-mentioned embodiment.

[0270] This embodiment also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the above-mentioned video transmission channel management method in the above-mentioned embodiment.

[0271] Among them, the vehicle, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the method provided above and will not be repeated here.

[0272] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and brevity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0273] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0274] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A video transmission channel management method, characterized in that: The method comprises: In the case where the target system of the target vehicle is connected to the video source device, if a state conversion instruction for a video transmission channel is received, obtaining a current channel state of the video transmission channel, wherein the video transmission channel is a channel for performing video stream transmission between the target system and the video source device, and the state conversion instruction is used to open or close the video transmission channel; When the current channel state is not the target state, adding the state transition instruction for the video transmission channel to the state transition task or not responding to the state transition instruction; When the current channel state is the target state, the video transmission channel is opened or closed.

2. The method according to claim 1, characterized in that The state conversion instruction includes an opening instruction or a closing instruction, the target state includes an opened state or an unopened state, and when the current channel state is the target state, opening or closing the video transmission channel includes: In the case where the state conversion instruction is an opening instruction, if the current channel state is an unopened state, opening the video transmission channel; In the case where the state conversion instruction is a closing instruction, if the current channel state is an opened state, the video transmission channel is closed.

3. The method according to claim 1, characterized in that The channel state of the video transmission channel includes an unopened state, an opening state, an opened state, and a closing state, the state transition instruction includes an opening instruction or a closing instruction, and the target state includes an opened state or an unopened state; when the current channel state is not the target state, adding the state transition instruction for the video transmission channel to the state transition task or not responding to the state transition instruction includes: In the case where the state transition instruction is an opening instruction, if the current channel state is an opening state, an opened state, or a closing state, then adding the opening instruction for the video transmission channel to the state transition task or not responding to the opening instruction; In the case where the state transition instruction is a close instruction, if the current channel state is an unopened state, an opening state or a closing state, a close instruction for the video transmission channel is added to the state transition task or the close instruction is not responded to.

4. The method according to claim 3, characterized in that If the current channel state is an opening state, an opened state, or a closing state, adding an opening instruction for the video transmission channel to the state transition task or not responding to the opening instruction comprises: When the current channel state is in a closed state, adding an opening instruction for the video transmission channel to the state transition task; When the current channel state is in the opening state or the opened state, the opening instruction is not responded; If the current channel state is an unopened state, an open state, or a closed state, adding a close instruction for the video transmission channel to the state transition task or not responding to the close instruction comprises: When the current channel state is in the open state, adding a closing instruction for the video transmission channel to the state transition task; When the current channel state is not open or is in the closing state, the closing instruction is not responded to.

5. The method according to claim 4, characterized in that In the case where the current channel state is in the closed state, after adding the opening instruction of the video transmission channel to the state conversion task, the method further includes: When detecting that the current channel state is converted to an unopened state, executing the opening instruction to open the video transmission channel; In the case where the current channel state is in the open state, after adding the closing instruction of the video transmission channel to the state conversion task, the method further includes: When it is detected that the current channel state is converted to an open state, the closing instruction is executed to close the video transmission channel.

6. The method according to claim 1, characterized in that The method further comprises: When the current channel state is not the target state, obtaining the state transition task; Detecting whether there is a state transition task identical to a target task in the state transition task, the target task being the state transition instruction added last in the state transition task; In the case that there is a state transition task identical to the target task in the state transition tasks, the remaining state transition tasks except the target task in the state transition tasks are deleted to execute the state transition instruction indicated by the target task.

7. The method according to claim 1, characterized in that When the current channel state is the target state, opening or closing the video transmission channel includes: When the current channel state is the target state, obtaining the last state conversion time of the video transmission channel; When the time interval between the last state conversion time of the video transmission channel and the current time is greater than or equal to a preset interval threshold, the video transmission channel is opened or closed.

8. The method according to claim 7, characterized in that The method further comprises: When the time interval between the last state transition time of the video transmission channel and the current time is less than the preset interval threshold, the video transmission channel is opened or closed after a target duration, and the target duration is greater than or equal to the difference between the time interval and the preset interval threshold.

9. A video transmission channel management device, characterized in that: The device comprises: A first acquisition module is used to acquire the current channel state of the video transmission channel if a state conversion instruction for a video transmission channel is received when a target system of a target vehicle is connected to a video source device, wherein the video transmission channel is a channel for performing video stream transmission between the target system and the video source device, and the state conversion instruction is used to open or close the video transmission channel; A task adding module, used for adding the state conversion instruction for the video transmission channel to the state conversion task or not responding to the state conversion instruction when the current channel state is not the target state; The opening and closing module is used to open or close the video transmission channel when the current channel state is the target state.

10. A vehicle, characterized in that: The vehicle comprises: A memory for storing executable program codes; A processor, configured to call and run the executable program code from the memory so that the vehicle executes the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method, device and system for improving end-to-end video transmission quality

    CN105306867A

  • Master-slave device address allocation system and method

    CN109992547A

  • Video playing method, video playing device and electronic equipment

    CN112866782A

  • Video bitrate switching method and apparatus, electronic device, and storage medium

    WO2023051243A1