Video transmission channel management method and device, and vehicle

By managing the state transition of the video transmission channel and deciding whether to execute the state transition instruction based on the current channel state, the resource conflict and deadlock problems caused by frequent operations of the video transmission channel are solved, and the system stability is improved.

CN119815089BActive Publication Date: 2025-10-14GREAT WALL MOTOR CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The frequent opening and closing of video transmission channels in in-vehicle infotainment systems leads to resource conflicts and resource locking issues, affecting the underlying stability of the system.

Method used

By obtaining the current channel state of the video transmission channel and deciding whether to perform the open or close operation based on the target state of the state transition instruction, unnecessary resource application and release are avoided, and the state transition task is used to manage the state transition of the video transmission channel.

Benefits of technology

It reduces the 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 CN119815089B_ABST
    Figure CN119815089B_ABST
Patent Text Reader

Abstract

The application discloses a video transmission channel management method and device and a vehicle, and belongs to the technical field of vehicles. The method comprises the following steps: in the case that a target system of a target vehicle is connected with a video source device, if a state conversion instruction of a video transmission channel is received, the current channel state of the video transmission channel is acquired, the video transmission channel is a channel for video stream transmission between the target system and the video source device, and the state conversion instruction is used for opening or closing the video transmission channel; in the case that the current channel state is not a target state, the state conversion instruction of the video transmission channel is added to a state conversion task or the state conversion instruction is not responded; and in the case that the current channel state is the target state, the video transmission channel is opened or closed. In this way, the opening and closing of the video transmission channel can be delayed or reduced, the 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 vehicles, in-vehicle infotainment systems (IVIs) are becoming an integral part of the driving experience. They are designed to provide drivers and passengers with a rich array of entertainment, navigation, communication, and other services. These systems also incorporate advanced technologies such as screen mirroring and smart assistants. Among these advanced technologies, video streaming and display are key components.

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

[0004] However, when the video source comes from an external device (such as a mobile phone mirror, a dash cam, etc.), the video stream may appear and disappear at times, 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 channels being unavailable, which in turn can easily cause problems with the underlying stability of the system. Summary of the Invention

[0005] This application provides a video transmission channel management method, device, vehicle, and storage medium. These methods can select whether to open or close a video transmission channel, or whether to open or close it, based on its current channel status. This reduces the frequent opening and closing of video transmission channels, thereby reducing the frequent application and release of transmission resources, thereby avoiding resource conflicts and resource locking, and enhancing the stability of the underlying system. The technical solution includes the following.

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

[0007] When a target system of a target vehicle is connected to a video source device, if a state transition 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 transmitting a video stream between the target system and the video source device, and the state transition 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 a connection is established between a target system and a video source device, a video transmission channel for video stream transmission exists. Subsequently, upon receiving a state transition instruction for the video transmission channel, that is, upon receiving an instruction to open or close the video transmission channel, the current channel state of the video transmission channel is first obtained. Then, if the current channel state is not the target state, the state transition instruction for the video transmission channel is added to a state transition task or the state transition instruction for the video transmission channel is not responded to. If the current channel state is the target state, the video transmission channel is opened or closed. In the present application, by adding the state transition instruction to the state transition task or not responding to the state transition instruction when the current channel state is not the target state, the state transition instruction is not executed if the current channel state does not meet the state transition requirements, but is instead temporarily stored in the state transition task or not executed. From the perspective of transmission resources, transmission resources can be applied for / released first, but added to the state transition task, waiting for the release / application of the current transmission resources for the video transmission channel before applying for / releasing transmission resources again. 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 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 transition instruction includes an open instruction or a close instruction, the target state includes an open state or an unopen state, and when the current channel state is the target state, opening or closing the video transmission channel includes:

[0012] In a 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 a case where the state conversion instruction is a closing instruction, if the current channel state is an open 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 open instruction or a close instruction, and the target state includes an opened state or an unopened state; and 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 open instruction, if the current channel state is an opening state, an opened state, or a closing state, then adding the open instruction for the video transmission channel to the state transition task or not responding to the open 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 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 / 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 includes:

[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 to;

[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 includes:

[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 can be 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 this 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, if it is detected that the current channel state is not open, since the state can be transitioned from the never-opened state to the opening state, it means that the channel state of the video transmission channel meets the state transition requirements for opening the video transmission channel. Therefore, 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 this application, the closing instruction for 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 the current channel state is detected to be open, since the open state can be transitioned 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. Therefore, in this case, the closing instruction can be executed to close the video transmission channel.

[0032] Optionally, the method further includes:

[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, wherein the target task is the state transition instruction last added 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 this 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 transition time of the video transmission channel;

[0039] In a case where a 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 result in frequent resource application and release, which will cause resource conflicts, deadlocks and other problems, thereby causing instability in the underlying state. In the case where 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, that is, there has been a long period of time when the video transmission channel has not been opened / closed. At this time, opening / closing the video transmission channel can avoid resource conflicts and deadlocks.

[0041] Optionally, the method further includes:

[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 the 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, thereby keeping the underlying state of the system stable.

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

[0045] a first acquisition module configured to, when a connection is established between a target system of a target vehicle and a video source device, acquire a current channel state of the video transmission channel upon receiving a state conversion instruction for a video transmission channel, wherein the video transmission channel is a channel for transmitting a video stream 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, configured to add the state transition instruction for the video transmission channel to the state transition task or not respond to the state transition instruction if 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 transition instruction includes an open instruction or a close instruction, the target state includes an open state or an unopened state, and the opening and closing module is configured to:

[0049] In a 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 a case where the state conversion instruction is a closing instruction, if the current channel state is an open 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 transition instruction includes an open instruction or a close instruction, and the target state includes an opened state or an unopened state; and the task adding module is configured to:

[0052] 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, then adding the open instruction for the video transmission channel to the state transition task or not responding to the open 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 to;

[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 is 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 configured to execute the closing instruction to close the video transmission channel when detecting that the current channel state is converted to an open state.

[0064] Optionally, the device further comprises:

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

[0066] A detection module, configured 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 last added 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 transition time of the video transmission channel;

[0070] In a case where a 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 to:

[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, comprising:

[0074] a memory for storing executable program code;

[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 video transmission channel management method described above 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 following briefly introduces the drawings required for use in the description of the embodiments. 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 any creative work.

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

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

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

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

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

[0085] Figure 6 This is a structural diagram of a video transmission channel management device provided by 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 this application clearer, the implementation methods of this 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 merely 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, words such as “first” and “second” are used to distinguish between identical or similar items with basically the same functions and effects. Those skilled in the art can understand that words such as “first” and “second” do not limit the quantity and execution order, and words such as “first” and “second” do not necessarily limit them to be different.

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

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

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

[0092] Camera2 API: This is a high-level API (Application Programming Interface) provided by Android for managing device cameras, supporting sophisticated camera control and video streaming operations. In this embodiment, the video transmission channel is opened or closed by using the Camera2 API code. This means that the vehicle-mounted video stream is transmitted by calling the Camera2 API. Furthermore, calling the Camera2 API in this embodiment does not actually call 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 the transition from one state to another, usually associated with a specific event. For example, the transition of the 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: is a data structure used to store and manage pending tasks, ensuring 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 operations on shared resources are safe and do not cause contention. In the embodiment of the present application, it is used to ensure that state transition operations on the video transmission channel do not cause conflicts.

[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 This is a 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, which can 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 can 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 an 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, thereby subsequently transmitting the video stream through the video transmission channel.

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

[0103] For example, Figure 2This is a scene diagram of a video transmission channel management method provided by an embodiment of the present application. The Camera2 API can be applied to video streaming transmission on mobile devices and on vehicles. Figure 2 , Figure 2 The process diagram includes a video streaming process on a mobile device and a video streaming process 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 activated by calling the Camera2 API, which opens the Camera2 channel. The video stream captured by the camera is then transmitted to the application. Since the connection between the mobile phone's camera and the application is fixed, that is, as long as the camera is activated, there is a connection between the camera and the application, which means that the camera is always transmitting the video stream to the application. This shows that the path between hardware and software is very clear. Therefore, there is no frequent opening and closing of the video transmission channel, and the video streaming transmission on the mobile phone is continuous and stable.

[0105] When calling the Camera2 API to stream video from a vehicle, the call doesn't actually open the camera; it actually transmits the video stream. Specifically, the in-vehicle infotainment system first establishes a connection with the external video source. To transmit the video stream, a request is made to open a video transmission channel (Camera2 channel). The video stream is then transmitted from the external device to the in-vehicle infotainment system via the video transmission channel and displayed by an application.

[0106] Because the in-vehicle infotainment system and the external video source do not always transmit data after being connected, 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 streaming. To resume video data transmission, the video transmission channel between the in-vehicle infotainment system and the external video source is reopened and the video stream is transmitted through this channel.

[0107] Furthermore, current vehicles have multiple screens, such as the central control screen, passenger screen, ceiling screen, and rear screen. Video data from an external video source can be transmitted and displayed on any of these screens. Consider a scenario where there are multiple passengers in the vehicle, some of whom may wish to mirror their screens to their preferred display. This involves switching between mirrored screens. This frequent switching of screens by multiple passengers can lead to intermittent video streaming.

[0108] At the system level, when switching between display screens, the video transmission channel between the external video source and the in-vehicle infotainment system must first be closed. Once the display screen has been successfully switched, the video transmission channel between the external video source and the in-vehicle infotainment system must be opened again. However, switching between display screens involves two operations on the video transmission channel: first closing it and then opening it. Frequent screen switching can result in the video transmission channel being 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, frequent application and release of transmission resources will occur. The application and release of transmission resources both require 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 corresponds to the continuous release of transmission resources, and the opening operation corresponds to the continuous application of transmission resources. This will cause the transmission resources that have been applied for again to be released again, thus entering an infinite loop and causing the opening operation to fail to execute successfully, which will lead to 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 underlying system, so this will cause problems with the underlying memory allocation of the system, thereby reducing the stability of the underlying 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 where a vehicle's in-vehicle infotainment system is connected to an external video source for video streaming transmission.

[0111] Specifically, after the vehicle's in-vehicle infotainment system establishes a connection with an external video source and receives a request to open or close a video transmission channel, it first obtains the current channel state of the video transmission channel. If the current channel state is not the target state, the task of opening or closing the video transmission channel is added to the pending state transition tasks, or the video transmission channel is not opened or closed. The video transmission channel is only opened or closed if the current channel state is the target state.

[0112] In an 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. Only when the current channel state is the target state can the video transmission channel be opened / closed. 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 is 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, transmission resources can be added to the state transition task instead of being applied for / released first, and then application / release of transmission resources can be continued after the release / application of the current transmission resources of the video transmission channel is completed. In addition, when there is no need to perform the open / close operation in the current channel state, transmission resources can be directly not applied for / released, thereby reducing unnecessary application / release of transmission resources. This can overcome the problems of resource conflicts and deadlocks in the system, and further solve the problem of memory allocation at the bottom layer of the system to improve the stability of the bottom layer of the system.

[0113] For example, when switching between display screens, the video transmission channel is closed before being opened. Suppose the video transmission channel is currently closed when an opening operation is received. To do this, first obtain the current channel status. Since the video transmission channel is currently closed, the current channel status should be closing. However, opening the video transmission channel requires that the channel is not open. Therefore, add the opening operation to the state transition task first and wait until the current channel status is not open before executing it.

[0114] In this way, when an operation to open a video transmission channel is received while the channel is being closed, the opening operation is added to the state transition task. This allows the task of releasing transmission resources during the closing process to be completed smoothly. After the release of transmission resources is completed, the application for transmission resources is restarted to open the video transmission channel. This avoids the phenomenon of requesting transmission resources again before the transmission resources are successfully released, resolves resource conflicts and deadlocks, and improves 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 This is a flow chart of a video transmission channel management method provided by an embodiment of the present application. This method can be applied to a vehicle's in-vehicle infotainment system. Figure 3 , the method includes the following steps.

[0117] Step 301: When a connection is established between the target system of the target vehicle and the video source device, if a state conversion instruction for the 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 transition instruction may include an open instruction and a close instruction. The open instruction refers to opening the video transmission channel, and subsequently converting the current state of the video transmission channel to the open state. The close instruction refers to closing the video transmission channel, and subsequently converting the current channel state of the video transmission channel to the closed state.

[0120] In an 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 send to the target system, the video source device can request to open a video transmission channel between the two, that is, send an instruction to open the video transmission channel. For another example, when the video source device has no video stream to send to the target system, it can request to close the video transmission channel, that is, send an instruction to close 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 obtained, so that it can be 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 the video transmission channel is closed, while the "opening" state means 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 "opening" state. After the video transmission channel is successfully opened, the video transmission channel can transition from the "opening" state to the "opened" state, which indicates that the video transmission channel has been successfully opened. The "closing" state means the video transmission channel is in the process of closing. After receiving an instruction to close the video transmission channel, the video transmission channel can enter the "closing" state. After the video transmission channel is successfully closed, its channel state can transition 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 refers to the channel state of the video transmission channel, namely, the unopened state, the opening state, the opened state, and the closing state.

[0128] The conversion relationships include: conversion from unopened state to opening state, conversion from opening state to opened state, conversion from opened state to closing state, and conversion from closing state to 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 transition instruction for the video transmission channel is added to the state transition task or the state transition instruction is not responded to.

[0131] The target state refers to the channel state that can be converted to the 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 the embodiment of the present application, the target state may include an open state or an unopened state. It should be understood that the target state changes accordingly 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 before the video transmission channel can be opened. 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 the 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 shows 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 Unopened 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 the state transition instruction does not need to be executed. From the perspective of transmission resources, it is possible not to apply for / release transmission resources first, but to add them to the state transition task, and then continue to apply for / release transmission resources after waiting for the release / application of the current transmission resources of the video transmission channel. In addition, if there is no need to execute the state transition instruction in the current channel state, it is possible to directly not apply for / release 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.

[0142] The following example illustrates the beneficial effects of step 302.

[0143] In the prior art, if an instruction to open a video transmission channel is received while the video transmission channel is being closed, the instruction to open the video transmission channel will be directly executed. In this case, the transmission resource will be applied for again before the transmission resource is successfully released. The result of this phenomenon is that the closing instruction keeps releasing the transmission resource, and the opening instruction keeps applying for the transmission resource, which will cause the transmission resource applied for again to be released again, thus entering an infinite loop and causing the opening instruction to fail to be successfully executed, which will lead to 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] Assume 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 closing of the video transmission channel can be successfully completed, and after the release of the transmission resources is completed, the application for transmission resources is started again to open the video transmission channel. In addition, when there is no need to repeat the closing instruction, the closing instruction is directly not executed, thereby avoiding the phenomenon of applying for transmission resources again before the transmission resources are successfully released, or reducing the phenomenon of unnecessary application / release of transmission resources. This can solve the problems of resource conflicts and deadlocks, and further avoid problems with the underlying memory allocation of the system, thereby improving the stability of the underlying 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 will be added to the state transition task or the open instruction will not be responded to.

[0149] If 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. This means that the video transmission channel can only be successfully opened when the current channel state is unopened. If the current channel state is the opening state, the opened state, or the closing state, the video transmission channel cannot be directly opened. Therefore, the video transmission channel opening instruction 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 video transmission channel open instruction is added to the state transition task to wait for the video transmission channel's channel status to meet the requirements, if the current channel status is detected as open, since the never-opened state can be transitioned to the opening state, this means that the video transmission channel's channel status meets the state transition requirements for opening the video transmission channel. Therefore, the open 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 can be: when it is detected that the current channel state is converted to an unopened state, if no new state conversion instruction is received, then execute the open instruction; if a new state conversion instruction is received, then execute the open instruction if the new state conversion instruction is also an open instruction.

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

[0155] If the current channel state is detected to be in the closed state, it means that the closed state can be switched to the open state, that is, the open instruction can be executed. However, if a close 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 open instruction again, so the open instruction can be ignored.

[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 status 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 status is the closing state, the opening instruction of the video transmission channel is added to the state transition task; when the current channel status is in the opening state or the opened state, the opening instruction is not responded to.

[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 open state. In other words, 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 instruction may cause 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 instruction can be added to the state transition task to wait until the current channel state meets the requirements before executing the open instruction.

[0159] If the current channel status is "Opening" or "Already Opened," it indicates that the video transmission channel is being opened or has already been opened. This is the same channel status as the one obtained after executing the open command. Therefore, in this case, the open command can be ignored, that is, the open command is not executed. This avoids 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 time 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 operation. 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 the 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. Then there will be two subsequent openings of the video transmission channel, which will result in redundant opening operations. Therefore, in this case, the opening instruction can be deleted.

[0165] In the case where 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 the opening instruction is not responded to, the state transition task may be cleared.

[0167] Since the most recently received state transition instruction is an open instruction, if 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 already reached the channel state required by the most recently received state transition instruction. The instructions listed in the state transition task may be the same open instruction as this one, or a different intermediate transition task (close instruction). Therefore, when the channel state required by the most recently received state transition instruction is reached, there is no need to execute the instructions in the state transition task, so the state transition 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, the close instruction for the video transmission channel will be added to the state transition task or the close instruction will not be responded to.

[0170] If the state transition instruction is a close instruction, that is, to close the video transmission channel, the state transition relationship should be from the open state to the closing state, and then from the closing state to the unopened state. This means that the video transmission channel can only be successfully closed when the current channel state is open. If the current channel state is the closing state, the unopened state, or the open state, the video transmission channel cannot be directly closed. 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 the 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 the open state.

[0173] Since the closing instruction for the video transmission channel is added to the state transition task to wait for the channel state of the video transmission channel to meet the requirements, if the current channel state is detected to be open, since the open state can be transitioned 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. Therefore, 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 close instruction can 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 execute the close instruction; if a new state conversion instruction is received, then execute the close instruction if the new state conversion instruction is also a close instruction.

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

[0176] If the current channel state is detected to be in the open state, it means that the state can be switched from the open state to the closing state, that is, the close command can be executed. However, if the open command 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 close command again, so the close command can be ignored.

[0177] Furthermore, since the current channel state is an open 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 status 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 status is an opening state, adding a closing instruction for the video transmission channel to the state transition task; when the current channel status 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 opening state, and then it can be converted from the opening 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 opening state before closing. Therefore, the video transmission channel cannot be closed directly. From the perspective of transmission resources, the transmission resources for the video transmission channel are being applied for and have not yet been applied for. At this time, directly executing the closing instruction may cause 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] If the current channel status is in the closing state or the closed state, it means that the video transmission channel is closing or has been closed, which is the same as the channel status obtained after executing the close command. Therefore, in this case, the close command can be ignored, that is, the close command is not executed.

[0181] Among them, when the current channel state is in the open 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 open state, determine 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, add 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 the 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, which will result 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 for 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 the closing state or the closed state, after not responding to the closing instruction, the state transition task may be cleared.

[0187] Since the most recently received state transition instruction is a close instruction, if 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 already reached the channel state required by the most recently received state transition instruction. The instructions listed in the state transition task may be the same open instruction as this one, or a different intermediate transition task (close instruction) from this one. Therefore, when the channel state required by the most recently received state transition instruction is reached, there is no need to execute the instructions in the state transition task, so the state transition 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, it is also possible to obtain a state transition task when the current channel state is not the target state; detect whether there is a state transition task that is the same as the target task in the state transition task; if there is a state transition task that is the same as the target task in the state transition task, delete the remaining state transition tasks except the target task in the state transition task 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 multiple times. If there are other state transition tasks between the two repeated tasks, multiple intermediate state transition operations will be executed. This will cause unnecessary redundant operations, 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 to open the video transmission channel and one operation to close 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, resulting in the video transmission channel being frequently opened. Therefore, the open instruction and 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, it may be set to a ReentrantLock reentrant lock.

[0195] Specifically, when a state transition instruction is to be executed, the state transition instruction can obtain a lock, while other state transition instructions that have not obtained a lock will not 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 for adding the state transition instruction for the video outgoing channel to the state transition task or not responding to the state transition 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] If the current channel state is the target state, it indicates that the current channel state of the video transmission channel is the channel state that should have been in before the state transition. For example, if a command to open the video transmission channel is received, the target state must be the unopened state in order to open the video transmission channel. For another example, if a command to close the video transmission channel is received, the target state must be the opened state in order to close the video transmission channel.

[0199] In this case, if the current channel state is the target state, it means that the current channel state meets the state transition requirements. In other words, the video transmission channel is only opened or closed when the current channel state meets the state transition requirements. This can reduce the switching frequency of the video transmission channel and improve the success rate of opening / closing the video transmission channel.

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

[0201] When the state transition instruction is an open 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 transition instruction is a close 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 open state, and if the current channel state is in an open 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 state transition time of the last video transmission channel; when the time interval between the state transition time of the last 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 transition time of the video transmission channel is the last time the state of the video transmission channel was transitioned. For example, if the video transmission channel was closed last time, the last state transition time when the channel state of the video transmission channel was transitioned 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 based on the duration of the transmission resource application / release. For example, if it takes 150ms (milliseconds) to apply for / release the transmission resource, 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 result in frequent resource application and release, which takes time to complete, if the current transmission resource has not yet been successfully applied for and a close instruction is received within a short period of time, the transmission resource will need to be released again. This may cause the transmission resource corresponding to the open instruction to be released again. This cycle will cause the close instruction to fail to execute, which will cause resource conflicts, deadlocks and other problems, resulting in unstable underlying state. Therefore, the video transmission channel can be opened or closed 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.

[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, which has exceeded the time length for the system to apply for / release transmission resources. Then, 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. That is to say, 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 can avoid resource conflicts and deadlock problems, 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 for / release transmission resources. In other words, the last opening instruction / closing instruction is still applying for / releasing transmission resources. If the video transmission channel is opened / closed at this time, the transmission resources have not been released / successfully applied for and then applied for / released again. In other words, after executing this opening / closing instruction, the latest applied transmission resources will be released or after the latest released transmission resources, the newly applied transmission resources will be released again, 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 transition 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 may not be released / successfully applied for and then applied for / released again. In other words, after executing the current open / close instruction, the most recently applied transmission resources may be released, or after the most recently released transmission resources, newly applied transmission resources may be released again. Therefore, in this 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 the 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 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 of transmission resources not being released / successfully applied for and then applied for / released again, which will not cause resource conflicts or 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 become 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 This 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 instruction to open the video transmission channel is received. Figure 4 (b) is a timing diagram when a closing instruction for the video transmission channel is received.

[0219] See also Figure 4 In step (a), upon receiving an open command for the video transmission channel, if the channel is currently in the IDLE state, the open command is directly executed, that is, the code execute OpenCamera() is executed. Alternatively, if a target delay is required, the open command is executed after the target delay is extended. After executing the open command, 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, the open command OpenCamera() is added to the task queue. If the current channel state is OPENING or OPEN, the open command is not executed, and the state transition task is cleared afterwards to avoid redundant operations.

[0221] See also Figure 4In (b), upon receiving a close instruction for the video transmission channel, if the channel is currently in the open state (OPENED), the close instruction can be directly executed, that is, the code: executeCloseCamera() can be executed. Alternatively, if a delay of a target duration is required, the close instruction can be executed after the delay of the target duration. After executing the close 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. If the current channel state is CLOSING or IDLE, the close instruction is not executed, and the state transition task is cleared afterwards to avoid redundant operations.

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

[0224] like Figure 5 As shown, upon receiving an open command for a video transmission channel, the current channel state of the video transmission channel is first obtained. A determination is then made as to whether the current channel state is not open. If the current channel state is not open (currentState == IDLE), the open command is executed, i.e., the code executeOpenCamera() is executed. If the time interval between opening / closing the video transmission channel is less than a preset interval threshold, the open operation can be delayed.

[0225] If the current channel status is not "Not Opened," determine whether the current channel status is "Closing." If the current channel status is "Closing," add the open instruction to the task queue for subsequent execution. If the current channel status is not "Closing," do not execute the open instruction and clear the task queue to avoid redundant operations.

[0226] Upon receiving a command to close the video transmission channel, the current channel state of the video transmission channel is first obtained. A determination is then made as to whether the channel is open. If the channel is open (currentState == OPENED), the close command is executed, i.e., the code executes: executeCloseCamera(). If the time interval between opening / closing the video transmission channel is less than a preset interval threshold, the close operation may be delayed.

[0227] If the current channel status is not "Opened," determine whether the current channel status is "Opening." If the current channel status is "Opening," add the close instruction to the task queue for subsequent execution. If the current channel status is not "Opening," do not execute the close instruction, and clear the task queue to avoid redundant operations.

[0228] In an embodiment of the present application, after a connection is established between the target system and the video source device, a video transmission channel for video stream transmission exists. Subsequently, upon receiving a state transition instruction for the video transmission channel, that is, upon receiving an instruction to open or close the video transmission channel, the in-vehicle infotainment system first obtains the current channel state of the video transmission channel. If the current channel state is not the target state, the state transition instruction for the video transmission channel is added to a state transition task or the state transition instruction for the video transmission channel is not responded to. If the current channel state is the target state, the video transmission channel is opened or closed. Thus, if 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. This allows the state transition instruction to be temporarily stored in the state transition task or not executed if the current channel state does not meet the state transition requirements, rather than being executed. From a transmission resource perspective, transmission resources can be added to the state transition task rather than being applied for / released, waiting until the current transmission resources for the video transmission channel are released / applied for before continuing to apply for / release transmission resources. 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 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 This is a schematic diagram of the structure of a video transmission channel management device provided by an embodiment of the present application. The video transmission channel management device can be implemented as part or all of a vehicle by software, hardware, or a combination of both. The vehicle can be as follows Figure 7 Vehicle shown. Figure 6 The device includes: a first acquisition module 601, a task adding module 602 and an opening and closing module 603.

[0230] A first acquisition module 601 is configured to acquire a current channel state of a video transmission channel upon receiving a state conversion instruction for a video transmission channel when a connection is established between a target system of a target vehicle and a video source device. 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.

[0231] The task adding module 602 is configured to add a state transition instruction for the video transmission channel to the state transition task or not respond to the state transition 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 transition instruction includes an open instruction or a close instruction, the target state includes an open state or an unopen state, and the opening and closing module 603 is configured to:

[0234] In the case where the state transition instruction is an open instruction, if the current channel state is an unopened state, the video transmission channel is opened;

[0235] In the case where the state transition instruction is a closing instruction, if the current channel state is an open 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 transition instruction includes an open instruction or a close 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] 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.

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

[0240] When the current channel state is closed, add the opening instruction of the video transmission channel to the state transition task;

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

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

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

[0244] If the current channel status is not open or closing, the close command will not be responded.

[0245] Optionally, the device further comprises:

[0246] A first execution module is configured 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 configured to execute a closing instruction to close the video transmission channel when detecting 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 a 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 deletion 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 configured to:

[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 a connection is established between the target vehicle and the video source device, a video transmission channel exists for video stream transmission. Subsequently, upon receiving a state transition instruction for the video transmission channel, that is, upon receiving an instruction to open or close the video transmission channel, the current channel state of the video transmission channel is first obtained. If the current channel state is not the target state, the state transition instruction for the video transmission channel is added to a state transition task or the state transition instruction for the video transmission channel is not responded to. If the current channel state is the target state, the video transmission channel is opened or closed. Thus, if 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. This allows the state transition instruction to be temporarily stored in the state transition task or not executed if the current channel state does not meet the state transition requirements, rather than being executed. From a transmission resource perspective, transmission resources can be added to the state transition task rather than being applied for / released, waiting for the release / application of the current transmission resources for the video transmission channel before continuing to apply for / release transmission resources. 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 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 video stream transmission, the division of the above-mentioned functional modules is only 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.

[0260] The functional units and modules in the above embodiments may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The above integrated units may be implemented in the form of hardware or software functional units. In addition, the specific names of the functional units and modules are only for the purpose of distinguishing them from each other and are not intended to limit the scope of protection of the embodiments of this 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 and technical effects brought about by the units and modules in the above embodiments 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] This embodiment can divide the vehicle into functional modules based on the above-described method example. For example, each functional module can be mapped to a specific function, or two or more functions can be integrated into a single processing module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and represents only one logical functional division. In actual implementation, other division methods may be used.

[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 and 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] When an integrated unit is used, the vehicle may include a processing module and a storage module. The processing module may be used to control and manage the vehicle's movements, while 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 controller that implements or executes the various exemplary logic blocks, modules, and circuits described in conjunction with the present disclosure. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processing (DSP) and a microprocessor, and the storage module may be a memory.

[0269] This embodiment also provides a computer-readable storage medium, which stores computer program code. When the computer program code runs 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 further provides a computer program product. When the computer program product is run on a computer, the computer is caused 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 distributed and completed by 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 this 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. There may be other division methods in actual implementation. For example, 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 content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A video transmission channel management method, characterized in that: The method comprises: When a target system of a target vehicle is connected to a video source device, if a state transition 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 transmitting a video stream between the target system and the video source device, and the state transition 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, wherein The state transition instruction includes an open instruction or a close instruction, the target state includes an open state or an unopen state, and when the current channel state is the target state, opening or closing the video transmission channel includes: In a 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 a case where the state conversion instruction is a closing instruction, if the current channel state is an open state, the video transmission channel is closed.

3. The method according to claim 1, wherein 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; and 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 open instruction, if the current channel state is an opening state, an opened state, or a closing state, then adding the open instruction for the video transmission channel to the state transition task or not responding to the open 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, wherein 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 includes: 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 to; 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 includes: 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, wherein 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: When detecting that the current channel state is converted to an unopened state, executing the opening instruction to open the video transmission channel; 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: 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, wherein 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, wherein the target task is the state transition instruction last added 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, wherein 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 transition time of the video transmission channel; In a case where a 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, wherein 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 configured to, when a connection is established between a target system of a target vehicle and a video source device, acquire a current channel state of the video transmission channel upon receiving a state conversion instruction for a video transmission channel, wherein the video transmission channel is a channel for transmitting a video stream 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, configured to add the state transition instruction for the video transmission channel to the state transition task or not respond to the state transition instruction if 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 code; A processor is 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