Video encoding / decoding control processing method, device, terminal and storage medium

By detecting the abnormal status of the hardware encoder/decoder and switching to the software encoder/decoder, the abnormality problem caused by poor compatibility of the hardware encoder/decoder is solved, and the robustness and stability of the video encoding/decoder during the live broadcast process are improved.

CN115209223BActive Publication Date: 2024-09-20GUANGZHOU FANGGUI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210520875.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-12
Publication Date
2024-09-20
Estimated Expiration
2042-05-12

AI Technical Summary

Technical Problem

During the live broadcast process, the compatibility of hardware encoder/decoder is poor and exceptions are prone to occur, which affects the robustness of video encode/decoder.

Method used

By determining the execution stage of the hardware encoder/decoder, a matching detection strategy is used to detect whether it is in an abnormal state, and when an abnormality is detected, it is switched to the software encoder/decoder to ensure the stability of the live broadcast process.

Benefits of technology

Improved the robustness and stability of the hardware encoder/decoder during the live broadcast process, ensuring that the basic broadcast function during the live broadcast process is not affected.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115209223B
    Figure CN115209223B
Patent Text Reader

Abstract

The present application discloses a control processing method, device, terminal and storage medium for video encoding / decoding, the method comprising: determining an execution stage for encoding / decoding a video file using a hardware encoder / decoder; using a detection strategy matching the execution stage to detect whether the hardware encoder / decoder is in an abnormal state; if the hardware encoder / decoder is in an abnormal state, switching the software encoder / decoder to encode / decode the video file. In the above manner, the present application can improve the robustness of video encoding / decoding during live broadcasting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of live broadcast technology, and in particular to a control processing method, device, terminal and storage medium for video encoding / decoding. Background Art

[0002] With the development of live broadcast technology, more and more people are interacting and entertaining through live broadcast. People can watch or broadcast live broadcasts anytime and anywhere through smart devices, which greatly enriches people's lives and broadens their horizons.

[0003] When users watch or broadcast live through electronic terminals such as mobile terminals or PCs, the electronic terminals need to encode / decode the video files generated during the live broadcast. For example, hardware encoders / decoders can be used to handle some highly complex and performance-intensive tasks, thereby greatly reducing the workload of the CPU. However, during the use of hardware encoders / decoders, due to poor compatibility, exceptions are prone to occur. Summary of the invention

[0004] The main technical problem solved by the present application is to provide a control processing method, device, terminal and storage medium for video encoding / decoding, which can improve the robustness of hardware encoding / decoding during live broadcasting.

[0005] To solve the above technical problems, a technical solution adopted in the present application is: to provide a control processing method for video encoding / decoding, the method comprising: determining the execution stage of encoding / decoding a video file using a hardware encoder / decoder; using a detection strategy matching the execution stage to detect whether the hardware encoder / decoder is in an abnormal state; if the hardware encoder / decoder is in an abnormal state, switching the software encoder / decoder to encode / decode the video file.

[0006] To solve the above technical problems, another technical solution adopted in the present application is: to provide a control and processing device for video encoding / decoding, the device comprising: a determination module, used to determine the execution stage of encoding / decoding a video file using a hardware encoder / decoder; a detection module, used to detect whether the hardware encoder / decoder is in an abnormal state using a detection strategy matching the execution stage; and an execution module, used to switch the software encoder / decoder to encode / decode the video file when the hardware encoder / decoder is in an abnormal state.

[0007] To solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic terminal, which includes: a processor, a memory and a communication circuit; the memory and the communication circuit are coupled to the processor, the memory stores a computer program, and the processor can execute the computer program to implement the control processing method of video encoding / decoding provided in the present application as mentioned above.

[0008] To solve the above technical problems, another technical solution adopted by the present application is: providing a computer-readable storage medium, which stores a computer program, and the computer program can be executed by a processor to implement the control processing method of video encoding / decoding provided by the present application as mentioned above.

[0009] The beneficial effects of the present application are as follows: different from the prior art, the execution stage of encoding / decoding a video file using a hardware codec is determined, and a detection strategy matching the execution stage is used to detect whether the hardware codec is in an abnormal state. When the video file generated during the live broadcast is encoded / decoded using the hardware codec, different execution stages will be experienced, and abnormalities may occur in different execution stages, and the abnormalities generated in different execution stages may be different. Therefore, by using a detection strategy matching the execution stage to detect whether the hardware codec is in an abnormal state, it is possible to more quickly and accurately detect whether the hardware codec is in an abnormal state at different execution stages, thereby improving the accuracy and efficiency of the detection. If it is detected that the hardware codec is in an abnormal state, the software codec is switched to encode the video file, thereby remedying the abnormal state to ensure that the basic broadcast function during the live broadcast is not affected, which is conducive to improving the stability of the hardware codec in broadcasting or playing video scenes during the live broadcast, thereby improving the robustness of the video encoding / decoding. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 It is a schematic diagram of the system composition of an embodiment of the live broadcast system of the present application;

[0011] Figure 2 This is a schematic diagram of the first flow chart of an embodiment of the control processing method for video encoding / decoding of the present application;

[0012] Figure 3 This is a second flow chart of an embodiment of the control processing method for video encoding / decoding of the present application;

[0013] Figure 4 This is a third flow chart of an embodiment of the control processing method for video encoding / decoding of the present application;

[0014] Figure 5 This is a fourth flow chart of an embodiment of a control processing method for video encoding / decoding of the present application;

[0015] Figure 6 It is a schematic diagram of the composition of an embodiment of the control processing device of the present application;

[0016] Figure 7 is a schematic block diagram of the circuit structure of an electronic terminal embodiment of the present application;

[0017] Figure 8It is a schematic block diagram of the circuit structure of a computer-readable storage medium embodiment of the present application. DETAILED DESCRIPTION

[0018] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0019] With the rapid development of the live broadcast industry, live broadcast has become an important way for people to entertain themselves through the Internet. People can also watch or broadcast live broadcasts anytime and anywhere through smart devices. During the live broadcast, the anchor performs on the anchor terminal, and users can watch the anchor's performance on the audience terminal, or interact with the anchor through the audience terminal. The video stream generated by the anchor during the live broadcast and some video files played in the live broadcast room can be watched by users in the live broadcast room. In scenarios such as the anchor starting a broadcast or playing a video, the audience terminal that plays the current live video needs to encode / decode the video file to achieve the broadcast in high-definition resolutions such as 720P and 1080P.

[0020] The inventors of this application have discovered during the long-term research and development process that in the process of encoding / decoding video files, the hardware encoder can handle some highly complex and performance-intensive tasks, greatly reducing the workload of the CPU, and due to the incomparable advantages of hardware encoding / decoding in performance and power saving, its actual application accounts for a much larger proportion than software encoding. However, the disadvantage of hardware encoding / decoding is that it has poor compatibility and is prone to abnormalities when facing devices from different hardware manufacturers. The above problems occur more frequently on electronic terminals, especially terminals such as Android systems. In order to improve the robustness of video encoding / decoding during live broadcasts, this application proposes the following embodiments.

[0021] like Figure 1 As shown, the live broadcast system 1 described in the live broadcast system embodiment of the present application may include a server 10, an anchor terminal 20, and an audience terminal 30. The anchor terminal 20 and the audience terminal 30 may be electronic terminals, specifically, the anchor terminal 20 and the audience terminal 30 are electronic terminals with corresponding client programs installed, i.e., client terminals. The electronic terminal may be a mobile terminal, a computer, a server, or other terminals, etc. The mobile terminal may be a mobile phone, a laptop computer, a tablet computer, a smart wearable device, etc., and the computer may be a desktop computer, etc.

[0022] The server 10 can pull the live data stream from the anchor terminal 20, and can push the acquired live data stream to the audience terminal 30 after corresponding processing. After the audience terminal 30 obtains the live data stream, it can watch the live broadcast process of the anchor or guest. The mixing of the live data stream can occur in at least one of the server 10, the anchor terminal 20 and the audience terminal 30. Video or voice connection can be performed between the anchor terminal 20 and the anchor terminal 20, and between the anchor terminal 20 and the audience terminal 30. In the video connection, the connection party can push the live data stream including the video stream to the server 10, and then push the corresponding live data to the corresponding connection party and the audience terminal 30. The anchor terminal 20 and the audience terminal 30 can display the corresponding live screen in the live broadcast room.

[0023] Of course, the anchor terminal 20 and the audience terminal 30 are relative. The terminal in the live broadcast process is the anchor terminal 20, and the terminal in the live broadcast process is the audience terminal 30.

[0024] like Figure 2 As shown, the embodiment of the control processing method for video encoding / decoding of the present application can be performed by a client terminal. This embodiment may include the following steps: S100: Determine the execution stage of encoding / decoding a video file using a hardware codec. S200: Detect whether the hardware codec is in an abnormal state using a detection strategy that matches the execution stage. S300: If the hardware codec is in an abnormal state, switch to a software codec to encode / decode the video file.

[0025] Determine the execution stage of encoding / decoding the video file using the hardware codec, and use the detection strategy matching the execution stage to detect whether the hardware codec is in an abnormal state. When the hardware codec is used to encode / decode the video file generated during the live broadcast, it will go through different execution stages, and abnormalities may occur in different execution stages, and the abnormalities generated in different execution stages may be different. Therefore, by using the detection strategy matching the execution stage to detect whether the hardware codec is in an abnormal state, it can be more quickly and accurately detected at different execution stages whether the hardware codec is in an abnormal state, thereby improving the accuracy and efficiency of the detection. If it is detected that the hardware codec is in an abnormal state, the software codec is switched to encode the video file, thereby remedying the abnormal state to ensure that the basic broadcast function during the live broadcast is not affected, which is conducive to improving the stability of the hardware codec in broadcasting or playing video scenes during the live broadcast, thereby improving the robustness of the video encoding / decoding.

[0026] The method described in this embodiment can be applied to the scenario of using hardware encoding / decoding to start broadcasting or playing videos during live broadcasting. The following describes this embodiment in detail with the client terminal as the execution subject.

[0027] The embodiment of the present application may include the following steps:

[0028] S100: Determine an execution stage of encoding / decoding a video file using a hardware encoder / decoder.

[0029] The hardware codec may have a hardware encoding function and / or a hardware decoding function, for example, it may include a hardware encoder and a hardware decoder. Encoding may refer to compressing a video signal, and decoding may refer to decompressing a compressed video signal. Hardware encoding / decoding may refer to writing the data to be encoded / decoded into a hardware encoding / decoding processing chip to perform hardware encoding / decoding on the data to be encoded / decoded. Hardware encoding / decoding is relative to software encoding / decoding. Software encoding / decoding may refer to converting the description of the processing process into a program based on a certain computer language, i.e., source program code. Due to the advantages of hardware encoding / decoding in performance and power saving, in actual application, the application of hardware encoding / decoding exceeds software encoding / decoding. The hardware codec is executed by the relevant hardware of the client terminal, such as GPU, VPU, etc. For example, in an electronic terminal such as a smart phone, a hardware codec may be pre-configured for encoding / decoding.

[0030] The video file can be a video stream generated during the live broadcast process. For example, when the live broadcast process is for the anchor to start broadcasting, the video file can be uploaded to the server 10 by the anchor terminal 20 and sent to each client terminal via the server 10, or it can be obtained by the server 10 from the cloud, operation and maintenance background, etc. and sent to each client terminal. Of course, it can also be uploaded to the server 10 by other client terminals. When the live broadcast process is to play a video, the video file can be the video screen played in the live broadcast room. During the transmission and display process, the video file needs to be encoded and compressed first, and then decoded and decompressed before it can be displayed on the client terminal. Depending on the situation, corresponding decoding or encoding can be performed on the client terminal.

[0031] The execution phase may be, for example, a phase in which a hardware codec may be used, and may include various phases that the hardware codec goes through during the encoding / decoding process, and may also include a phase before or after the hardware codec performs encoding / decoding.

[0032] In one implementation, S100 may include the following steps:

[0033] S110: Determine that the current execution stage of the hardware encoder / decoder is a creation to encoding / decoding process.

[0034] The current execution stage of the hardware encoder / decoder may be a creation to encoding / decoding process. Specifically, the creation to encoding / decoding process may include a creation stage, a configuration stage, a startup stage, and an encoding / decoding stage that are executed in sequence.

[0035] S120: Determine that the current execution stage of the hardware codec is a pre-startup stage.

[0036] The current execution stage of the hardware codec may be a stage before startup. Specifically, the stage before startup may refer to a stage before the hardware codec is started.

[0037] S200: Detect whether the hardware encoder / decoder is in an abnormal state using a detection strategy that matches the execution phase.

[0038] When the hardware codec is in any stage of the execution phase, the detection strategy matching the current execution phase can be used to detect whether the hardware codec is in an abnormal state. The abnormal state may refer to whether the hardware codec fails to complete encoding / decoding during the creation to encoding process.

[0039] like Figure 3 As shown, when the current execution stage of the hardware codec is the creation to encoding / decoding process, how to use the detection strategy matching the execution stage to detect whether the hardware codec is in an abnormal state can refer to the following steps included in S200:

[0040] S210: Determine whether an abnormality occurs in the process from creation to encoding / decoding of the hardware encoder / decoder.

[0041] By judging whether an exception occurs in any of the stages of the hardware codec creation phase, configuration phase, startup phase, and encoding / decoding phase, it is determined whether an exception occurs in the process of the hardware codec creation to encoding / decoding. The creation phase, configuration phase, startup phase, and encoding / decoding phase are executed in sequence.

[0042] The creation phase refers to the creation of a hardware codec. The hardware codec can be created through the function interface provided by hardware such as GPU. For example, it can be created according to the width and height of the codec and the codec mode. The configuration phase refers to the configuration of the created hardware codec, that is, initializing the created hardware codec and configuring the corresponding parameters. The startup phase refers to starting the configured hardware codec. The encoding / decoding phase refers to encoding / decoding the video file after startup.

[0043] In one implementation, S210 may include the following steps:

[0044] S211: Monitor the execution result of the current stage of the creation to encoding / decoding process.

[0045] The execution results of the current stage are detected in sequence for the processes of creating a hardware codec, configuring a hardware codec, starting the hardware codec, and encoding / decoding the hardware codec. Specifically, the execution results can be monitored by capturing exceptions. If the execution result of the previous stage is normal, the next stage can be performed. If the execution result of the previous stage is abnormal, it can be determined that the hardware codec has an abnormality.

[0046] S212: Determine whether an abnormality occurs in the current stage from creation to the encoding / decoding process based on the execution result.

[0047] When monitoring the execution result by capturing exceptions, if an exception is captured, it is determined that an exception occurs in the current stage; if no exception is captured, it is determined that no exception occurs in the current stage.

[0048] S220: If an exception occurs, the creation to encoding / decoding process is repeated, and it is determined whether an exception occurs in the creation to encoding / decoding process of the hardware encoder / decoder.

[0049] In one implementation, S220 may include the following steps:

[0050] S221: If an exception occurs in any of the creation phase, configuration phase, startup phase, and encoding / decoding phase, the hardware encoder / decoder is destroyed and the hardware encoder / decoder is recreated to repeat the creation to encoding / decoding process.

[0051] When an exception occurs in any of the creation phase, configuration phase, startup phase, and encoding / decoding phase based on the execution result, the hardware codec can be destroyed, and then the hardware codec can be recreated to repeat the creation to encoding / decoding process. Specifically, multiple hardware codecs can be created, and different hardware codecs can be created based on different applications.

[0052] S230: Determine whether the number of times that anomalies occur in all creation to encoding / decoding processes is greater than or equal to a preset threshold.

[0053] After destroying the hardware codec and before re-creating the codec, the number of exceptions that occurred during the creation to the codec can be counted, or the number of destruction of the hardware codec is greater than or equal to a preset threshold. Since during the creation to the codec, if only a small number of exceptions occur, it is not possible to directly determine that the hardware codec is in an abnormal state. It is necessary to determine that the number of exceptions is greater than or equal to the preset threshold before determining that the hardware codec is in an abnormal state.

[0054] S240: If it is greater than or equal to the preset threshold, it is determined that the hardware codec is in an abnormal state.

[0055] When the number of exceptions in all creation to encoding / decoding processes is greater than or equal to a preset threshold, it can be determined that the hardware encoder / decoder is in an abnormal state. Figure 3 As shown, when the preset threshold is 3 times, if an exception occurs in the process of creating a hardware codec, the hardware codec is destroyed. At this time, the number of exceptions is 1 time, which does not exceed 3 times, then the hardware codec is recreated, and the creation to encoding / decoding process is performed again. During this creation to encoding / decoding process, if an exception occurs in the process of configuring the hardware codec, the hardware codec is destroyed. At this time, the number of exceptions is 2 times, which does not exceed 3 times, then the hardware codec is recreated, and the creation to encoding / decoding process is performed again. During this creation to encoding / decoding process, if an exception occurs in the process of starting the hardware codec, the hardware codec is destroyed. At this time, the number of exceptions is 3 times, which is equal to the preset threshold, and it is determined that the hardware codec is in an abnormal state at this time.

[0056] In one implementation, when the current execution stage of the hardware codec is the pre-startup stage, how to detect whether the hardware codec is in an abnormal state using a detection strategy matching the execution stage may refer to the following steps included in S200:

[0057] S250: Acquire the hardware codec flag information in the pre-startup stage.

[0058] The flag information of the hardware codec may be a flag for indicating whether the hardware codec is available. Specifically, the flag information of the hardware codec may be set to indicate available and unavailable. When the flag information of the hardware codec indicates available, it indicates that the hardware codec is not in an abnormal state. When the flag information of the hardware codec indicates unavailable, it indicates that the hardware codec is in an abnormal state.

[0059] In one implementation, before S250, the following steps may be included:

[0060] S251: Detect whether the hardware encoder / decoder is stuck during use.

[0061] A hardware codec freeze may be an abnormal situation that occurs during the use of the hardware codec. If the hardware codec freezes, it cannot be restored by restarting the application. If it is not handled, the encoded / decoded video cannot be played, which seriously affects the user experience.

[0062] In one implementation, S251 may include the following steps:

[0063] S2511: Execute the creation and / or destruction phase of the hardware codec in an asynchronous thread.

[0064] like Figure 4 As shown, the creation and / or destruction phases of the hardware encoder / decoder are executed in a separate asynchronous thread, and the creation and / or destruction phases of the hardware encoder / decoder are stuck, that is, the asynchronous thread cannot normally execute the creation and / or destruction phases and cannot return execution results. Executing the tasks of the creation and / or destruction phases by asynchronous threads will not cause other tasks in the main thread, such as starting a preview, continuing to encode / decode video streams, etc., to be unable to proceed, thereby helping to improve the stability of the live broadcast process.

[0065] S2512: Detect whether the asynchronous thread returns the execution result within a preset time.

[0066] The preset time may be pre-set in the server and / or the client terminal, or may be changed based on actual needs. The execution result may include, for example, a successful execution result and a failed execution result.

[0067] S2513: If the asynchronous thread does not return the execution result within the preset time, it is determined that the hardware codec is stuck in the creation and / or destruction phase.

[0068] By setting a preset time, if the thread of the task of the creation and / or destruction phase of the hardware codec executed asynchronously within the preset time cannot return an execution result, it can be determined that the hardware codec has been stuck.

[0069] S2514: If the hardware encoder returns the execution result within the preset time, it is determined that the hardware encoder is not stuck in the creation and / or destruction phase.

[0070] If the thread of the asynchronously executed hardware codec creation and / or destruction phase task returns an execution result within a preset time, it can be determined that the hardware codec is not stuck, and the flag information of the hardware codec can be set to be available.

[0071] S252: If a jam occurs, the flag information of the hardware codec is set to indicate that the hardware codec is unavailable.

[0072] Since a hardware codec is usually unrecoverable after it is stuck, in order to ensure that the user can use the application without restarting the computer, the flag information of the stuck hardware codec can be set to indicate that the hardware codec is unavailable. During the next use, the software codec can be directly used according to the flag information of the hardware codec.

[0073] S260: Determine whether the hardware codec is in an abnormal state based on the flag information.

[0074] When judging whether the hardware codec is in an abnormal state, the judgment can be made according to the flag information of the hardware codec. Specifically, if the flag information indicates that the hardware codec is unavailable, the hardware codec is judged to be in an abnormal state, and if the flag information indicates that the hardware codec is available, the hardware codec is judged not to be in an abnormal state.

[0075] In one implementation, Figure 5 As shown, when the current execution stage of the hardware codec is the pre-startup stage, how to use the detection strategy matching the execution stage to detect whether the hardware codec is in an abnormal state can refer to the following steps included in S200:

[0076] S270: Obtain identification information of the hardware encoder / decoder.

[0077] The identification information of the hardware codec can be information used to identify the hardware codec. Each hardware codec has unique corresponding identification information. Through the identification information, the hardware codec corresponding to the identification information can be determined. The flag bit mentioned above is part of the identification information. For example, there is a sign bit in the identification information as a flag bit to indicate an available or unavailable state. For example, the identification information is 20222561, and the last symbol is the flag bit. "1" indicates an available state, and "0" indicates an unavailable state. Of course, the flag can also be independent of the identification information, and can form a new string with the identification information.

[0078] S280: Determine whether the identification information of the hardware codec is in a preset blacklist.

[0079] The preset blacklist list may be sent from the server 10 to the client terminal. Specifically, the blacklist list may be a hardware codec with an unrecoverable problem that is determined after a large number of verifications. For example, the identification information corresponding to the hardware codec that is detected to be abnormal during the creation of the encoding / decoding process may be written into the preset blacklist list, and the identification information corresponding to the hardware codec that is detected to be in an abnormal state by detecting whether it is stuck may also be written into the preset blacklist list. In other words, these hardware codecs with unrecoverable problems are in an abnormal state. By judging whether the identification information of the hardware codec is in the preset blacklist list, it is determined whether the hardware codec has an unrecoverable problem, and then it can be determined whether the hardware codec is in an abnormal state.

[0080] S290: If the identification information of the hardware codec is in the preset blacklist, it is determined that the hardware codec is in an abnormal state.

[0081] If the identification information of the hardware codec is in the preset blacklist, it can be considered that the hardware codec has an irrecoverable problem, and then the hardware codec is determined to be in an abnormal state. If the identification information of the hardware codec is not in the preset blacklist, it can be considered that the hardware codec does not have an irrecoverable problem, and then the hardware codec is determined not to be in an abnormal state.

[0082] S300: If the hardware codec is in an abnormal state, switch to the software codec to encode or decode the video file.

[0083] When it is determined that the hardware codec is in an abnormal state, the software codec can be switched to encode / decode the video file. After the software codec completes the encoding / decoding, the software codec can be destroyed. Software encoding / decoding can be implemented by a program based on a certain computer language. The advantage of software codecs is that they do not rely on specific hardware manufacturers and have good compatibility. In the case of hardware codec abnormalities, you can switch to software codecs, such as x264, to remedy the hardware codec in an abnormal state, which can ensure that the basic broadcasting function during the live broadcast is not affected, which is conducive to improving the stability of the live broadcast process.

[0084] In summary, in the control processing method of video encoding / decoding of the present embodiment, the execution stage of encoding / decoding the video file by the hardware encoder / decoder is determined, and the detection strategy matching the execution stage is used to detect whether the hardware encoder / decoder is in an abnormal state. When the hardware encoder / decoder is used to encode / decode the video file generated during the live broadcast, it will go through different execution stages, and abnormalities may occur in different execution stages, and the abnormalities generated in different execution stages may be different. Therefore, by using the detection strategy matching the execution stage to detect whether the hardware encoder / decoder is in an abnormal state, it is possible to more quickly and accurately detect whether the hardware encoder / decoder is in an abnormal state at different execution stages, thereby improving the accuracy and efficiency of the detection. If it is detected that the hardware encoder / decoder is in an abnormal state, the software encoder / decoder is switched to encode the video file, thereby remedying the abnormal state to ensure that the basic broadcast function during the live broadcast process is not affected, which is conducive to improving the stability of the hardware encoder / decoder in broadcasting or playing video scenes during the live broadcast process, thereby improving the robustness of the video encoding / decoding.

[0085] like Figure 6As shown, the control processing device 2 described in the control processing device embodiment of the present application may include a determination module 40, a detection module 50 and an execution module 60. Specifically, the determination module 40 is used to determine the execution stage of encoding / decoding the video file using the hardware codec. The detection module 50 is used to detect whether the hardware codec is in an abnormal state using a detection strategy matching the execution stage. The execution module 60 is used to switch the software codec to encode / decode the video file when the hardware codec is in an abnormal state.

[0086] For the specific functions and execution processes of each functional module of the control processing device embodiment of the present application, reference can be made to the detailed description of the control processing method embodiment of the video encoding / decoding of the present application, which will not be repeated here.

[0087] like Figure 7 As shown, the electronic terminal 100 described in the electronic terminal embodiment of the present application may be the above-mentioned client terminal, and the electronic terminal 100 includes a processor 110 , a memory 120 , and a communication circuit. The memory 120 and the communication circuit are coupled to the processor 110 .

[0088] The memory 120 is used to store computer programs, and may be a RAM (Read-Only Memory), a ROM (Random Access Memory), or other types of storage devices. Specifically, the memory may include one or more computer-readable storage media, which may be non-transitory. The memory may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory is used to store at least one program code.

[0089] The processor 110 is used to control the operation of the electronic terminal 100. The processor 110 may also be referred to as a CPU (Central Processing Unit). The processor 110 may be an integrated circuit chip having signal processing capabilities. The processor 110 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 110 may also be any conventional processor, etc.

[0090] The processor 110 is used to execute the computer program stored in the memory 120 to implement the control processing method described in the embodiment of the control processing method for video encoding / decoding of the present application.

[0091] In some embodiments, the electronic terminal 100 may further include: a peripheral device interface 130 and at least one peripheral device. The processor 110, the memory 120 and the peripheral device interface 130 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 130 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 140, a display screen 150, an audio circuit 160 and a power supply 170.

[0092] The peripheral device interface 130 may be used to connect at least one peripheral device related to I / O (Input / output) to the processor 110 and the memory 120. In some embodiments, the processor 110, the memory 120, and the peripheral device interface 130 are integrated on the same chip or circuit board; in some other implementations, any one or two of the processor 110, the memory 120, and the peripheral device interface 130 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.

[0093] The radio frequency circuit 140 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 140 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 140 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 140 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 140 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 140 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.

[0094] The display screen 150 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 150 is a touch display screen, the display screen 150 also has the ability to collect touch signals on the surface or above the surface of the display screen 150. The touch signal can be input to the processor 110 as a control signal for processing. At this time, the display screen 150 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 150 can be one, arranged on the front panel of the electronic terminal 100; in other embodiments, the display screen 150 can be at least two, respectively arranged on different surfaces of the electronic terminal 100 or in a folding design; in other embodiments, the display screen 150 can be a flexible display screen, arranged on a curved surface or a folding surface of the electronic terminal 100. Even, the display screen 150 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 150 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).

[0095] The audio circuit 160 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 110 for processing, or input them into the radio frequency circuit 140 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the electronic terminal 100. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 110 or the radio frequency circuit 140 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 160 may also include a headphone jack.

[0096] The power supply 170 is used to power various components in the electronic terminal 100. The power supply 170 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 170 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged through a wired line, and a wireless rechargeable battery is a battery that is charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0097] For a detailed description of the functions and execution processes of each functional module or component in the electronic terminal embodiment of the present application, reference can be made to the description in the above-mentioned video encoding / decoding control processing method embodiment of the present application, which will not be repeated here.

[0098] In the several embodiments provided in the present application, it should be understood that the disclosed electronic terminal 100 and control processing method can be implemented in other ways. For example, the various embodiments of the electronic terminal 100 described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0099] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0100] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0101] See also Figure 8 , if the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium 200. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions / computer programs to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories, random access memories, magnetic disks or optical disks, and electronic terminals such as computers, mobile phones, laptops, tablet computers, cameras, etc. having the above-mentioned storage media.

[0102] The description of the execution process of the program data in the computer-readable storage medium can be referred to the description in the above-mentioned embodiment of the control processing method for video encoding / decoding of the present application, which will not be repeated here.

[0103] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A video encoding / decoding control processing method, characterized in that: include: Determine the execution stage of encoding / decoding the video file using the hardware codec; The execution phase at least includes a creation and / or destruction phase of the hardware codec and a pre-startup phase; Detecting whether the hardware codec is in an abnormal state by using a detection strategy that matches the execution phase; wherein the step comprises: executing the creation and / or destruction phase of the hardware codec in an asynchronous thread; detecting whether the asynchronous thread returns an execution result within a preset time; if the asynchronous thread does not return the execution result within the preset time, determining that the hardware codec is stuck in the creation and / or destruction phase; if stuck, setting the flag information of the hardware codec to indicate that the hardware codec is unavailable; obtaining the flag information of the hardware codec in the pre-startup phase; determining whether the hardware codec is in an abnormal state based on the flag information, wherein if the flag information indicates that the hardware codec is unavailable, determining that the hardware codec is in an abnormal state; If the hardware codec is in an abnormal state, the software codec is switched to encode / decode the video file.

2. The control processing method according to claim 1, characterized in that: The execution stage of determining to encode / decode the video file using the hardware encoder / decoder includes: Determining that the current execution stage of the hardware encoder / decoder is a creation to encoding / decoding process; The detecting whether the hardware encoder / decoder is in an abnormal state by using a detection strategy matching the execution stage includes: Determine whether an exception occurs in the process of creating to encoding / decoding the hardware encoder / decoder; If an exception occurs, re-performing the creation to encoding / decoding process, and executing the determination of whether an exception occurs in the creation to encoding / decoding process of the hardware encoder / decoder; Determine whether the number of exceptions that occur during the creation to encoding / decoding process is greater than or equal to a preset threshold; If it is greater than or equal to the preset threshold, it is determined that the hardware codec is in an abnormal state.

3. The control processing method according to claim 2, characterized in that: The creation to encoding / decoding process includes a creation phase, a configuration phase, a startup phase, and an encoding / decoding phase that are performed in sequence; wherein, if an exception occurs, the creation to encoding / decoding process is performed again, including: If an exception occurs in any of the creation phase, configuration phase, startup phase, and encoding / decoding phase, the hardware encoder / decoder is destroyed and the hardware encoder / decoder is recreated to repeat the creation to encoding / decoding process.

4. The control processing method according to claim 3, characterized in that: The determining whether an exception occurs in the process of creating to encoding / decoding the hardware encoder / decoder includes: Monitoring the execution results of the current stage of the creation to encoding / decoding process; Based on the execution result, it is determined whether an abnormality occurs in the current stage of the creation to encoding / decoding process.

5. The control processing method according to claim 1, characterized in that: The execution stage of determining to encode / decode the video file using the hardware encoder / decoder includes: Determining that the current execution stage of the hardware codec is the pre-startup stage; The detecting whether the hardware encoder / decoder is in an abnormal state by using a detection strategy matching the execution stage includes: Obtaining identification information of the hardware encoder / decoder; Determine whether the identification information of the hardware codec is in a preset blacklist; If the identification information of the hardware codec is in the preset blacklist, it is determined that the hardware codec is in an abnormal state.

6. A video encoding / decoding control processing device, characterized in that: include: A determination module, used to determine an execution phase of encoding / decoding a video file using a hardware codec, wherein the execution phase at least includes a creation and / or destruction phase and a pre-startup phase of the hardware codec; A detection module, used to detect whether the hardware codec is in an abnormal state by using a detection strategy matching the execution stage; wherein the creation and / or destruction stage of the hardware codec is executed in an asynchronous thread, and the detection module is used to detect whether the asynchronous thread returns an execution result within a preset time; if the asynchronous thread does not return the execution result within the preset time, the detection module is used to determine that the hardware codec is stuck in the creation and / or destruction stage; if stuck, the detection module is used to set the flag information of the hardware codec to indicate that the hardware codec is unavailable; when the execution stage is the pre-startup stage, the detection module is used to obtain the flag information of the hardware codec, and determine whether the hardware codec is in an abnormal state based on the flag information, wherein if the flag information indicates that the hardware codec is unavailable, the detection module is used to determine that the hardware codec is in an abnormal state; The execution module is used to switch the software codec to encode / decode the video file when the hardware codec is in an abnormal state.

7. An electronic terminal, characterized in that: include: processor, memory, and communications circuitry; The memory and the communication circuit are coupled to the processor, the memory stores a computer program, and the processor can execute the computer program to implement the control processing method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: A computer program is stored, and the computer program can be executed by a processor to implement the control processing method according to any one of claims 1 to 5.