Disclosure of Invention
In view of the above, the main objective of the present invention is to provide a failure recovery apparatus and method, which enable a media processing unit to recover to a state before a failure after the failure occurs, so as to shorten the time for recovering from the failure of the media processing unit.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
the invention provides a failure recovery device, comprising: the media recovery device comprises a media recovery controller, a media monitoring unit, a media command queue and a media data queue; wherein,
the media monitoring unit is used for monitoring the working state of the media processing unit and informing the media recovery controller when the media processing unit is monitored to have a fault;
the media recovery controller is used for monitoring the working state of the media processing unit through the media monitoring unit, resetting the media processing unit when the media processing unit is known to have a fault, and sending necessary media commands stored in the media command queue and key media data stored in the media data queue to the media processing unit;
the media command queue is used for storing necessary media commands sent to the media processing unit by the main control unit;
and the media data queue is used for storing the key media data sent to the media processing unit by the main control unit.
In the above solution, the media recovery controller is further configured to record a necessary media command in the media command queue and record critical media data in the media data queue.
In the above scheme, the apparatus further comprises: and the media channel recovery unit is used for recovering the communication channel between the main control unit and the media processing unit.
In the above scheme, the media recovery controller is further configured to notify the media channel recovery unit to recover the communication channel between the main control unit and the media processing unit after the failure of the media processing unit is known.
The invention also provides a fault recovery method, which comprises the following steps:
the media recovery controller monitors the working state of the media processing unit through the media monitoring unit, resets the media processing unit when the media processing unit fails, and sends necessary media commands stored in the media command queue and key media data stored in the media data queue to the media processing unit;
the media command queue stores necessary media commands sent to the media processing unit by the main control unit;
the media data queue stores key media data sent to the media processing unit by the main control unit.
In the foregoing solution, the media recovery controller monitors the working state of the media processing unit through the media monitoring unit, and specifically includes: the media recovery controller informs the media monitoring unit of monitoring the working state of the media processing unit according to the fault judgment condition, and informs the media recovery controller when the media monitoring unit monitors that the media processing unit is in fault.
In the foregoing solution, after the media recovery controller resets the media processing unit, the method further includes: the media recovery controller recovers the command channel and the data channel of the media processing unit.
In the above solution, when the media recovery controller monitors the working state of the media processing unit through the media monitoring unit, the method further includes: the media recovery controller records necessary media commands in the media commands sent by the main control unit to the media processing unit in a media command queue, and records key media data sent by the main control unit to the media processing unit in a media data queue.
In the above solution, after the sending the necessary media command and the key media data to the media processing unit, the method further includes: the media recovery controller empties the essential media commands in the media command queue and the critical media data in the media data queue, respectively.
The invention provides a failure recovery device and a method.A media recovery controller monitors the working state of a media processing unit through a media monitoring unit, and respectively records a necessary media command and key media data sent by a main control unit in a media command queue and a media data queue; and after the media processing unit is recovered from the fault, emptying all the commands and data recorded in the media command queue and the media data queue. The device and the method of the invention can quickly recover the media processing unit to the state before the failure without changing the current state of the main control unit, thereby shortening the failure recovery time of the media processing unit.
Detailed Description
The basic idea of the invention is: the media recovery controller monitors the working state of the media processing unit through the media monitoring unit, and records necessary media commands in the media commands sent by the main control unit and key media data in the media command queue and the media data queue respectively.
The following describes in detail the apparatus and method for implementing the present invention with reference to specific embodiments.
As shown in fig. 1, the failure recovery apparatus according to the present invention includes: amain control unit 101, amedia recovery controller 102, amedia monitoring unit 103, amedia command queue 104, amedia data queue 105, amedia processing unit 106 and a mediachannel recovery unit 107; wherein,
amain control unit 101, configured to send a media command and media data to amedia processing unit 106;
amedia recovery controller 102, connected to themain control unit 101, themedia monitoring unit 103, themedia command queue 104 and themedia data queue 105, and configured to monitor a working state of themedia processing unit 106 through themedia monitoring unit 103, reset themedia processing unit 106 when themedia processing unit 106 fails, and send necessary media commands stored in themedia command queue 104 and key media data stored in themedia data queue 105 to themedia processing unit 106;
themedia monitoring unit 103 is connected to themedia recovery controller 102 and themedia processing unit 106, and is configured to monitor a working state of themedia processing unit 106, and notify themedia recovery controller 102 when it is monitored that themedia processing unit 106 fails;
amedia command queue 104, connected to themain control unit 101 and themedia processing unit 106, for storing the necessary media commands sent by themain control unit 101 to themedia processing unit 106;
themedia data queue 105 is connected with themain control unit 101 and themedia processing unit 106 and is used for storing the key media data sent to themedia processing unit 106 by themain control unit 101;
themedia processing unit 106 is configured to execute the media command sent by themain control unit 101, decode the media data, and further display the media image.
Further, themedia recovery controller 102 is also configured to record the necessary media commands in themedia command queue 104 and record the critical media data in themedia data queue 105.
The device further comprises: a mediachannel recovery unit 107, configured to recover the communication channel between themain control unit 101 and themedia processing unit 106.
Further, themedia recovery controller 102 is further configured to notify the mediachannel recovery unit 107 to recover the communication channel between themain control unit 101 and themedia processing unit 106 after resetting themedia processing unit 106.
Based on the above device, the present invention provides a failure recovery method, as shown in fig. 2, the method includes the following steps:
step 201: themedia recovery controller 102 starts the media recovery function and informs themedia monitoring unit 103 to monitor the working state of themedia processing unit 106;
in this step, themain control unit 101 notifies themedia recovery controller 102 to start the media recovery function, themedia recovery controller 102 starts the media recovery function, sends the failure determination condition of themedia processing unit 106 to themedia monitoring unit 103, and notifies themedia monitoring unit 103 to monitor the working state of themedia processing unit 106 according to the failure determination condition. The specific implementation of themedia monitoring unit 103 monitoring the working state of themedia processing unit 106 may be set as: themedia monitoring unit 103 monitors the working state of themedia processing unit 106 by periodically sending and receiving messages to and from themedia processing unit 106; the fault judgment conditions are as follows: themedia recovery controller 102 formulates a message period. In this way, after themedia monitoring unit 103 sends a message to themedia processing unit 106, if the message returned by themedia processing unit 106 is not received in the message period, it is determined that themedia processing unit 106 has a fault; if the message returned by themedia processing unit 106 is received in the message period, the working state of themedia processing unit 106 is considered to be normal.
Step 202: themedia recovery controller 102 records the necessary media commands in themedia command queue 104 and the critical media data in themedia data queue 105;
in this step, when the state of themedia processing unit 106 is normal, themedia recovery controller 102 starts themedia command queue 104 and themedia data queue 105, and themedia processing unit 106 normally processes the media command and the media data sent by themain control unit 101; themedia recovery controller 102 records necessary media commands in the media commands sent by themain control unit 101 to themedia processing unit 106 in themedia command queue 104, and increases or decreases entries of the necessary media commands recorded in themedia command queue 104 according to the type of the media commands, so as to reduce the queue length of themedia command queue 104. The necessary media command refers to a command capable of changing the state of themedia processing unit 106, such as a command to start decoding, stop decoding, and adjust brightness; wherein, the command for starting decoding and stopping decoding belongs to the command for clearing the queue, when the command for clearing the queue is recorded in themedia command queue 104, all the media commands stored in themedia command queue 104 are cleared; the brightness adjustment command belongs to the replacement command, when the replacement command is recorded in themedia command queue 104, other replacement commands stored in themedia command queue 104 are removed, and the replacement command is recorded in themedia command queue 104, so that the queue length of themedia command queue 104 is reduced, and if the brightness adjustment command with the brightness of 100 is recorded in themedia command queue 104, the command replaces the command with the brightness of 10 stored in the previous queue, so as to reduce the queue length; the other category belongs to the query command, which is not considered to be a necessary media command and does not need to be recorded in themedia command queue 104, for example, the query work status command sent by themain control unit 101 to themedia processing unit 106 does not need to be recorded. Due to the unique nature of media data processing, the state of themedia processing unit 106 is not so many that the necessary media commands stored in themedia command queue 104 are not so many, thereby ensuring that themedia command queue 104 is not too long.
When the state of themedia processing unit 106 is normal, themedia recovery controller 102 further records key media data in the latest media data sent to themedia processing unit 106 by themain control unit 101 in themedia data queue 105, where the key media data refers to a key frame in a data code stream; for example, when themedia processing unit 106 processes a bitstream in the standard encoding format of h.264, the image parameter set, the sequence parameter set, and the I-frame data may be recorded as key media data in themedia data queue 105. Due to the special attribute of the media data processing, the media data can be allowed to have a certain loss on the premise of not influencing the display of the image, so that only the key media data is saved in themedia data queue 105 without recording all the media data, and the queue length of themedia data queue 105 is greatly shortened.
Here, the setting of the queue length of themedia command queue 104 and themedia data queue 105 may be specifically set according to the actual application situation to avoid the recorded necessary media commands and critical media data from overflowing.
Step 203: after learning that themedia processing unit 106 has a fault through themedia monitoring unit 103, themedia recovery controller 102 resets themedia processing unit 106 and recovers the command channel and the data channel;
in this step, themedia processing unit 106 may periodically send a message to themedia monitoring unit 103, and when themedia monitoring unit 103 does not receive the message sent by themedia processing unit 106 in the message period, according to the fault determination condition, themedia monitoring unit 103 regards that themedia processing unit 106 has a fault and notifies themedia recovery controller 102; after receiving the notification, themedia recovery controller 102 resets themedia processing unit 106, so that themedia processing unit 106 can be recovered to the initial normal state; specifically, themedia monitoring unit 103 may perform a reset on themedia processing unit 106 by sending a reset signal to a reset pin of themedia processing unit 106;
themedia recovery controller 102 also notifies the mediachannel recovery unit 107 to reestablish the command channel and the data channel to recover the command channel and the data channel between themain control unit 101 and themedia processing unit 106. The establishment of the command channel and the data channel is prior art and will not be described in detail herein.
Step 204: themedia recovery controller 102 sends the necessary media commands stored in themedia command queue 104 and the key media data stored in themedia data queue 105 to themedia processing unit 106;
in this step, themedia recovery controller 102 sends the necessary media commands stored in themedia command queue 104 to themedia processing unit 106, so that themedia processing unit 106 recovers in sequence according to the historical occurrence time of the necessary media commands, and themedia processing unit 106 finally recovers to the state before the failure; themedia recovery controller 102 sends the latest key media data stored in themedia data queue 105 to themedia processing unit 106, so that themedia processing unit 106 recovers the latest key media data. As can be seen fromstep 202, themedia processing unit 106 has a shorter failure recovery time due to the shorter queue length of themedia command queue 104 and themedia data queue 105.
Here, during the time of the failure recovery of themedia processing unit 106, since the state of themain control unit 101 is not changed, the media command and the media data are continuously sent to themedia processing unit 106, at this time, themedia recovery controller 102 continuously records the necessary media command and the critical media data in themedia command queue 104 and themedia data queue 105, respectively, and sends the necessary media command and the critical media data stored during the failure recovery time to themedia processing unit 106 after the failure recovery of themedia processing unit 106, so as to ensure that the state after the failure recovery of themedia processing unit 106 is consistent with the state of themain control unit 101.
Step 205: themedia recovery controller 102 empties themedia command queue 104 and themedia data queue 105, respectively.
In this step, when themedia monitoring unit 103 monitors that the working state of themedia processing unit 106 is recovered to normal according to the failure judgment condition, themedia recovery controller 102 is notified, themedia recovery controller 102 empties the media commands stored in themedia command queue 104 and the key media data stored in themedia data queue 105, respectively, and themedia monitoring unit 103 is notified to start a new round of monitoring on themedia processing unit 106.
The above description is only exemplary of the present invention and should not be taken as limiting the scope of the present invention, and any modifications, equivalents, improvements, etc. that are within the spirit and principle of the present invention should be included in the present invention.