Video recording method and device, electronic equipment and readable storage medium

CN119254912BActive Publication Date: 2026-08-11VIVO MOBILE COMM CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0003]然而,由于上述外挂芯片框架的输入输出非同步流程,因此容易出现丢帧行为,从而导致录制视频的效果较差

Benefits of technology

[0011] In this embodiment, during video recording, the number of buffers in the hardware abstraction layer (HAL) of the electronic device can be detected. If the number of buffers is greater than or equal to a first number, the recorded video frames are sent to the HAL through the manufacturer's camera service framework of the electronic device. This scheme allows the manufacturer's camera service framework to send recorded video frames to the HAL when sufficient buffers are available, ensuring the sent video frames can be processed. Thus, even with asynchronous input/output processes in the external chip framework of the added IC chip, frame loss can be reduced and the recording quality improved by controlling the timing of video frame transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254912B_ABST
    Figure CN119254912B_ABST
Patent Text Reader

Abstract

This application discloses a video recording method, apparatus, electronic device, and readable storage medium, belonging to the field of electronic device technology. The method includes: during video recording, detecting the number of buffers in the hardware abstraction layer of the electronic device; if the number of buffers is greater than or equal to a first number, sending the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of electronic equipment technology, and specifically relates to a video recording method, apparatus, electronic device and readable storage medium. Background Technology

[0002] Currently, when electronic devices record video, the recording quality can be improved by adding external integrated circuit (IC) chips. In the external chip framework after adding the external IC chip, the IC driver is integrated on the manufacturer's camera service framework side, responsible for sending video frames to the external IC chip, while the IC sensor channel is integrated on the Hardware Abstraction Layer (HAL), responsible for asynchronously outputting the processing results of the external IC chip on the video frames.

[0003] However, due to the asynchronous input and output process of the aforementioned external chip framework, frame dropping is prone to occur, resulting in poor video recording quality. Summary of the Invention

[0004] The purpose of this application is to provide a video recording method, apparatus, electronic device, and readable storage medium that can reduce frame dropping and improve the quality of recorded video.

[0005] In a first aspect, embodiments of this application provide a video recording method, which includes: during video recording, detecting the number of buffers in the hardware abstraction layer of an electronic device; and if the number of buffers is greater than or equal to a first number, sending the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device.

[0006] Secondly, embodiments of this application provide a video recording apparatus, which includes a detection module and a transmission module; the detection module is used to detect the number of buffers in the hardware abstraction layer of the electronic device during video recording; the transmission module is used to send the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device when the number of buffers is greater than or equal to a first number.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0010] In a sixth aspect, embodiments of this application provide a computer program / program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.

[0011] In this embodiment, during video recording, the number of buffers in the hardware abstraction layer (HAL) of the electronic device can be detected. If the number of buffers is greater than or equal to a first number, the recorded video frames are sent to the HAL through the manufacturer's camera service framework of the electronic device. This scheme allows the manufacturer's camera service framework to send recorded video frames to the HAL when sufficient buffers are available, ensuring the sent video frames can be processed. Thus, even with asynchronous input / output processes in the external chip framework of the added IC chip, frame loss can be reduced and the recording quality improved by controlling the timing of video frame transmission. Attached Figure Description

[0012] Figure 1 This is a schematic diagram of the external chip framework in related technologies;

[0013] Figure 2 This is one of the flowcharts of the video recording method provided in the embodiments of this application;

[0014] Figure 3 This is the second flowchart of the video recording method provided in the embodiments of this application;

[0015] Figure 4 This is a schematic diagram illustrating the communication between the manufacturer's camera service framework and the hardware abstraction layer through a first variable in the video recording method provided in this application embodiment;

[0016] Figure 5 This is a schematic diagram of the execution logic of the video recording method provided in the embodiments of this application;

[0017] Figure 6 This is the third flowchart of the video recording method provided in the embodiments of this application;

[0018] Figure 7 This is a schematic diagram illustrating the execution of a callback function in the video recording method provided in this application embodiment;

[0019] Figure 8 This is the fourth flowchart of the video recording method provided in the embodiments of this application;

[0020] Figure 9 This is a schematic diagram of frame dropping in IC chips in related technologies;

[0021] Figure 10 This is a schematic diagram of the IC chip handling frame loss in the video recording method provided in the embodiments of this application;

[0022] Figure 11 This is the fifth flowchart of the video recording method provided in the embodiments of this application;

[0023] Figure 12 This is a schematic diagram of the video recording device provided in the embodiments of this application;

[0024] Figure 13 This is a schematic diagram of the electronic device provided in the embodiments of this application;

[0025] Figure 14 This is a hardware schematic diagram of the electronic device provided in the embodiments of this application. Detailed Implementation

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

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

[0028] The term "instruction" in this application can be either a direct instruction (or explicit instruction) or an indirect instruction (or implicit instruction). A direct instruction can be understood as one in which the sender explicitly informs the receiver of specific information, the operation to be performed, or the requested result, etc., in the instruction sent. An indirect instruction can be understood as one in which the receiver determines the corresponding information based on the instruction sent by the sender, or makes a judgment and determines the operation to be performed or the requested result, etc., based on the judgment result.

[0029] The terms "at least one," "at least one of," etc., used in the specification and claims of this application refer to any one, any two, or a combination of two or more of the included items. For example, at least one of a, b, and c can mean: "a," "b," "c," "a and b," "a and c," "b and c," and "a, b, and c," where a, b, and c can be single or multiple. Similarly, "at least two" refers to two or more items, and its meaning is similar to that of "at least one."

[0030] The video recording method, apparatus, electronic device, and readable storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0031] Currently, when electronic devices record videos, the recording quality can be improved by adding an external IC chip to the electronic device.

[0032] For example, Figure 1 A schematic diagram of the external chip frame after adding an external IC chip is shown, such as... Figure 1 As shown, the IC driver is integrated on the manufacturer's camera service framework side. The manufacturer's camera framework captures data from the data nodes in real time and sends it to the IC via the manufacturer's camera framework real-time chip data transmission node and display processing unit. The display processing unit has the functions of layer compositing and image processing. The IC sensor node channel is placed on the HAL side as a source node. The sensor node receives the output data of the IC and asynchronously outputs the IC's processing result (result). It operates independently from the IC driver and is partially decoupled from the HAL.

[0033] However, due to the asynchronous input / output process of the aforementioned external chip framework, the Internet Service Provider (ISP) queue in the HAL may be empty when the IC outputs a frame, resulting in frame drops. This has a significant impact on post-editing or recording stop processes, leading to poor video recording quality.

[0034] To address the aforementioned problems, embodiments of this application provide a video recording method, apparatus, electronic device, and readable storage medium. The video recording method provided in this application can be applied to scenarios where users are recording videos.

[0035] In the video recording method provided in this application embodiment, during video recording, the number of buffers in the hardware abstraction layer of the electronic device can be detected; and if the number of buffers is greater than or equal to a first number, the recorded video frames are sent to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device. This scheme allows the manufacturer's camera service framework of the electronic device to send recorded video frames to the hardware abstraction layer when it is determined that there are sufficient buffers, enabling the sent video frames to be processed. Thus, even with the asynchronous input / output process of an external chip framework with an added IC chip, frame loss can be reduced and the video recording effect improved by controlling the timing of video frame transmission.

[0036] It should be noted that the video recording method provided in this application can be executed by a video recording device, an electronic device, or a functional module within an electronic device. Some embodiments of this application use an electronic device to illustrate the video recording method provided in this application.

[0037] Figure 2 A flowchart illustrating the video recording method provided in an embodiment of this application is shown. Figure 2 As shown, the video recording method provided in this application embodiment may include the following steps 201 and 202.

[0038] Step 201: During video recording, the electronic device detects the number of buffers in the hardware abstraction layer of the electronic device.

[0039] In this embodiment, the Hardware Abstraction Layer (HAL) is an interface layer located between the operating system kernel and the hardware circuitry, with the purpose of abstracting the hardware. It hides the hardware interface details of a specific platform, providing the operating system with a virtual hardware platform that is hardware-independent and portable across multiple platforms. From a software and hardware testing perspective, both software and hardware testing can be performed separately based on the HAL, making parallel software and hardware testing possible.

[0040] Optionally, in this embodiment of the application, the buffer described above can be used to cache video frames so that the chip in the hardware abstraction layer can process the video frames.

[0041] Optionally, in the embodiments of this application, combined with Figure 2 ,like Figure 3 As shown, step 201 above can be specifically implemented through step 201a below.

[0042] Step 201a: During video recording, the electronic device detects the value of the first variable through the manufacturer's camera service framework.

[0043] The value of the first variable is used to indicate the number of buffers, and the value of the first variable is updated in real time by the hardware abstraction layer.

[0044] Optionally, in this embodiment of the application, the first variable can be a hidle variable created by the electronic device, which can be used for real-time communication between the manufacturer's camera service framework and the hardware abstraction layer.

[0045] Optionally, in this embodiment of the application, the initial value of the first variable can be any possible value such as 0, -1 or -2. Before submitting the requested buffer address into the kernel, the hardware abstraction layer can increment the value of the first variable by 1 to update the value of the first variable.

[0046] In this embodiment of the application, since the electronic device can detect the value of the first variable and obtain the number of buffers through the manufacturer's camera service framework, the first variable can facilitate the manufacturer's camera service framework to obtain the number of buffers in a timely manner, simplifying the process of obtaining the number of buffers.

[0047] Alternatively, in this embodiment of the application, the electronic device may also detect the number of the buffers through the hardware abstraction layer described above.

[0048] Step 202: If the number of buffers is greater than or equal to the first number, the electronic device sends the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device.

[0049] Optionally, in the embodiments of this application, the first quantity can be any value greater than 0, such as 1, 2, or 3.

[0050] It is understood that when the number of buffers mentioned above is greater than or equal to the first number mentioned above, there are enough buffers in the hardware abstraction layer to buffer video frames.

[0051] Optionally, in this embodiment of the application, the number of recorded video frames can be one or more.

[0052] Optionally, in this embodiment of the application, when the number of recorded video frames is multiple, the multiple video frames are multiple video frames recorded consecutively.

[0053] Optionally, in this embodiment of the application, when the electronic device detects the value of the first variable through the aforementioned manufacturer's camera service framework to obtain the number of buffers, if the number of buffers is greater than or equal to the first number, the aforementioned manufacturer's camera service framework can automatically send the recorded video frames to the aforementioned hardware abstraction layer.

[0054] For example, such as Figure 4As shown, before submitting the requested buffer address to the kernel, HAL increments the count of the first variable (initial value of the first variable x = 0, -1, or -2). The aforementioned vendor camera service framework can then monitor the value of this first variable in real time, and when the value is greater than 0, it sends the recorded video frame to HAL. This ensures that HAL does not drop frames; where... Figure 4 NV12 is a format in the YUV color space, belonging to the YUV420SP (Semi-Planar) format. In this format, the Y component (luminance) and UV component (chrominance) are stored separately, but the UV components are interleaved, that is, the U and V components are arranged alternately.

[0055] For example, such as Figure 5 As shown, the specific logic of the video recording method provided in this application embodiment is as follows:

[0056] 1. Before submitting the requested buffer address into the kernel, HAL increments the count of the first variable by 1.

[0057] 2. When the count of the first variable mentioned above is greater than 0, the manufacturer's camera service framework sends a frame to the display processing unit.

[0058] 3. When a continuous frame transmission ends (recording stops or reflows), HAL increments the count of the first variable by 8 and notifies the manufacturer's camera service framework to clear all buffered video frames.

[0059] This ensures that HAL does not drop frames.

[0060] Optionally, in the embodiments of this application, combined with Figure 2 ,like Figure 6 As shown, step 202 above can be specifically implemented through step 202a below.

[0061] Step 202a: When the number of buffers is greater than or equal to the first number, and the manufacturer's camera service framework receives the notification corresponding to the callback function, the electronic device sends the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework.

[0062] The aforementioned callback function is executed by the aforementioned hardware abstraction layer and is used to notify the aforementioned manufacturer's camera service framework to send the recorded video frames.

[0063] Optionally, in this embodiment of the application, the callback function can be the FrameReadyCallback function.

[0064] For example, such as Figure 7As shown, a new FrameReadyCallback function can be added and called during configuration, and the FrameReadyCallback function is saved to m_readyCb in the HAL.

[0065] HAL is responsible for calling back to the manufacturer's camera service framework (FrameReady) when the Internet service provider's queue meets the requirements.

[0066] Manufacturer's camera service framework:

[0067] a. Add a new thread A to execute the function RequestExecutor(), m_requestCV.wait().

[0068] b. When the manufacturer's camera frame real-time chip data sending node::washing request, push each frame request to inflightReqQueue.

[0069] c. When a FrameReadyCallback is received, m_requestCV notify is executed, waking up thread A, popping a request from m_inflightReqQueue, and sending IC data (DPU->IC) is executed. This ensures that the above hardware abstraction layer can handle a sufficient number of video frame requests before receiving IC data from IFELite, thus preventing the hardware abstraction layer from dropping frames.

[0070] d. For scenarios where recording, post-editing, or flushing is stopped, and requests will be stopped: the flushrequest function of hwcnode will be called, m_requestCV notify will be executed, thread A will be woken up, and the remaining requests will be popped from m_inflightReqQueue for normal processing.

[0071] In this embodiment of the application, since the number of buffers is greater than or equal to the first number, and the manufacturer's camera service framework receives the notification corresponding to the callback function, the electronic device can send the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework. Therefore, the direct interaction between the manufacturer's camera service framework and the hardware abstraction layer can be achieved through the same process, reducing the calling overhead.

[0072] Optionally, in the embodiments of this application, combined with Figure 2 ,like Figure 8 As shown, step 202 can be implemented by step 202b below. After step 202b, the video recording method provided in this application embodiment can also include steps A to C below.

[0073] It should be noted that hardware defects in IC chips can also cause frame drops. For example, ... Figure 9 As shown, the frame with timestamp 133 in Req 21 is discarded by the IC chip, and the subsequently output T=166 is filled into Req 21, resulting in a permanent one-frame misalignment between the input and output images. After frame loss, the buffers and metadata obtained by subsequent processing by the IC chip are misaligned. Even if the request for the latest data to be filled is returned as an error to correct the misalignment, the actual frame loss will be more severe.

[0074] Step 202b: If the number of buffers is greater than or equal to the first number, the electronic device sends at least two video frames and the first information corresponding to each video frame to the hardware abstraction layer through the manufacturer's camera service framework.

[0075] The aforementioned first information includes at least one of a timestamp and a request identifier.

[0076] Optionally, in the embodiments of this application, the above-mentioned at least two video frames are continuously recorded video frames.

[0077] Optionally, in this embodiment of the application, the first information mentioned above can be used to determine whether a video frame is lost.

[0078] Step A: The electronic device receives video frames and the first information corresponding to each video frame from the manufacturer's camera service framework through the chip in the hardware abstraction layer.

[0079] Optionally, in this embodiment of the application, the chip described above can be an IC chip.

[0080] Step B: The electronic device uses a chip to determine the missing video frames in at least two video frames based on the first information corresponding to each video frame.

[0081] For example, taking the first information as including the request identifier as an example, assuming that the chip receives a video frame with request identifier a+2 after receiving a video frame with request identifier a during the process of receiving video frames, then it can be determined that the video frame with request identifier a+1 is lost.

[0082] Step C: The electronic device processes the received video frames through a chip and sends the processed video frames to the manufacturer's camera service framework.

[0083] Among them, the missing video frames in at least two of the aforementioned video frames were sent to the aforementioned manufacturer's camera service framework in an incorrect form.

[0084] Optionally, in this embodiment of the application, the video frame is sent in an error form, that is, the video frame is directly set as an error and then sent.

[0085] For specific methods of processing video frames using chips, please refer to the relevant descriptions in related technologies. To avoid repetition, they will not be repeated here.

[0086] For example, a verification method can be agreed upon with the IC chip in HAL, and timestamps or request identifiers can be added to input and output metadata. When IFELite receives video frames and metadata, it can determine whether there is an anomaly based on the timestamps or request identifiers. Figure 10 As shown, the output of Req 11 is lost. Based on the timestamp, it can be determined that it belongs to a video frame between Req 10 and Req 12. Therefore, the processing results of Req 10 and Req 12 can be returned to the manufacturer's camera service frame respectively. When frames 11+N are returned, Req 11 is returned to the manufacturer's camera service frame in an error format. This ensures that the data returned by the IC chip is the same frame as the one returned to the manufacturer's camera service frame. Here, N is the maximum number of frames to wait, to prevent Req 11 from not returning indefinitely. After that, it can be ensured that the frames after the lost frame match the metadata, and the processing effect is normal.

[0087] In this embodiment, since the lost video frame can be determined based on the first information corresponding to each video frame, and the lost video frame is sent in an error form when returning the processing result of the video frame, it can be ensured that the data sent by the chip and the data received by the above-mentioned manufacturer's camera service framework are the same frame. This ensures that the frame after the frame loss matches the metadata, effectively suppresses frame drop during recording, and improves the video recording effect.

[0088] In the video recording method provided in this application embodiment, if it is determined that there are sufficient buffers in the hardware abstraction layer of the electronic device, the manufacturer's camera service framework of the electronic device can be controlled to send the recorded video frames to the hardware abstraction layer, so that the sent video frames can be processed. In this way, even if the input and output of the external chip framework with the added IC chip is asynchronous, frame loss can be reduced and the recording effect can be improved by controlling the timing of the video frame transmission.

[0089] Optionally, in the embodiments of this application, combined with Figure 3 ,like Figure 11 As shown, after step 202 above, the video recording method provided in this application embodiment may further include step 203 below.

[0090] Step 203: The electronic device updates the value of the first variable to the first value through the hardware abstraction layer.

[0091] Wherein, when the value of the first variable is the first value, the first variable is used to notify the manufacturer's camera service framework to clear the cached video frames.

[0092] Optionally, in the embodiments of this application, the first value mentioned above can be any possible value such as 6, 7 or 8.

[0093] Optionally, in the embodiments of this application, the first value mentioned above can be preset by the system, or can be arbitrarily set by the user according to actual usage needs.

[0094] For example, after the electronic device sends the recorded continuous video frames to the hardware abstraction layer through the aforementioned manufacturer's camera service framework, it can increment the value of the first variable by 8 through the hardware abstraction layer to update the value of the first variable to the aforementioned first value, thereby notifying the manufacturer's camera service framework to clear the cached video frames so as to cache newly recorded video frames.

[0095] In this embodiment of the application, since the electronic device can update the value of the first variable to the first value to notify the manufacturer's camera service framework to clear the cached video frames, the interaction function between the manufacturer's camera service framework and the hardware abstraction layer can be enriched by updating the value of the first variable, so as to clear the cached data in a timely manner and process the newly recorded video frames.

[0096] The above-described method embodiments, or various possible implementations of the method embodiments, can be executed individually, or, provided there are no contradictions, they can be combined with each other. The specific implementation can be determined according to actual usage requirements, and this application embodiment does not impose any restrictions on this.

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

[0098] like Figure 12 As shown, this application embodiment provides a video recording device 12, which may include a detection module 11 and a transmission module 12.

[0099] The detection module 11 can be used to detect the number of buffers in the hardware abstraction layer of the electronic device during video recording. The sending module 12 can be used to send the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device when the number of buffers is greater than or equal to a first number.

[0100] In one possible implementation, the detection module 11 can be used to detect the value of the first variable through the aforementioned manufacturer's camera service framework; wherein the value of the first variable is used to indicate the number of the aforementioned buffers, and the value of the first variable is updated in real time by the aforementioned hardware abstraction layer.

[0101] In one possible implementation, the video recording device 10 may further include an update module. The update module can be used to update the value of the first variable to a first value via the hardware abstraction layer after the sending module 12 sends the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device; wherein, when the value of the first variable is the first value, the first variable is used to notify the manufacturer's camera service framework to clear the cached video frames.

[0102] In one possible implementation, the sending module 12 can be specifically used to send the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework when the number of buffers is greater than or equal to the first number and the manufacturer's camera service framework receives the notification corresponding to the callback function; wherein the callback function is executed by the hardware abstraction layer and is used to notify the manufacturer's camera service framework to send the recorded video frames.

[0103] In one possible implementation, the video recording device 10 may further include a receiving module and a processing module. Specifically, the sending module 12 may be used to send at least two video frames and first information corresponding to each video frame to the hardware abstraction layer via the aforementioned vendor camera service framework. The first information includes at least one of a timestamp and a request identifier. The receiving module may be used to receive the video frames and first information sent by the vendor camera service framework via a chip in the hardware abstraction layer after the sending module 12 sends the at least two video frames and the first information corresponding to each video frame to the hardware abstraction layer via the vendor camera service framework. The processing module may be used to determine the missing video frames among the at least two video frames based on the first information corresponding to each video frame via the chip; process the received video frames via the chip; and send the processed video frames to the vendor camera service framework, wherein the missing video frames among the at least two video frames were sent to the vendor camera service framework in an erroneous form.

[0104] In the video recording apparatus provided in this application embodiment, the apparatus can control the manufacturer's camera service framework of the electronic device to send recorded video frames to the hardware abstraction layer when it is determined that there are sufficient buffers in the hardware abstraction layer of the electronic device, so that the sent video frames can be processed. Thus, even with the asynchronous input / output process of an external chip framework with an added IC chip, frame loss can be reduced and the recording quality improved by controlling the timing of video frame transmission.

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

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

[0107] The video recording device provided in this application embodiment can implement all the processes implemented in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0108] like Figure 13 As shown, this application embodiment also provides an electronic device 100, including a processor 101 and a memory 102. The memory 102 stores a program or instructions that can run on the processor 101. When the program or instructions are executed by the processor 101, they implement the various steps of the video recording method embodiment described above and can achieve the same technical effect. To avoid repetition, they will not be described again here.

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

[0110] Figure 14 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0111] like Figure 14As shown, the electronic device 1000 includes, but is not limited to, components such as: radio frequency unit 1001, network module 1002, audio output unit 1003, input unit 1004, sensor 1005, display unit 1006, user input unit 1007, interface unit 1008, memory 1009, and processor 1010.

[0112] Those skilled in the art will understand that the electronic device 1000 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1010 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 14 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0113] The processor 1010 can detect the number of buffers in the hardware abstraction layer of the electronic device during video recording; and if the number of buffers is greater than or equal to a first number, it can send the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device.

[0114] In one possible implementation, the processor 1010 can be used to detect the value of the first variable through the aforementioned manufacturer's camera service framework; wherein the value of the first variable is used to indicate the number of the aforementioned buffers, and the value of the first variable is updated in real time by the aforementioned hardware abstraction layer.

[0115] In one possible implementation, the processor 1010 can also be used to update the value of the first variable to a first value through the hardware abstraction layer after sending the recorded video frames to the hardware abstraction layer via the manufacturer's camera service framework of the electronic device; wherein, when the value of the first variable is the first value, the first variable is used to notify the manufacturer's camera service framework to clear the cached video frames.

[0116] In one possible implementation, the processor 1010 can be used to send recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework when the number of buffers is greater than or equal to the first number and the manufacturer's camera service framework receives a notification corresponding to the callback function; wherein the callback function is executed by the hardware abstraction layer and is used to notify the manufacturer's camera service framework to send the recorded video frames.

[0117] In one possible implementation, the processor 1010 can be specifically configured to send at least two video frames and first information corresponding to each video frame to the hardware abstraction layer via the aforementioned vendor camera service framework. The first information includes at least one of a timestamp and a request identifier. The processor 1010 can also be configured to, after sending at least two video frames and the first information corresponding to each video frame to the hardware abstraction layer via the vendor camera service framework, receive the video frames and the first information corresponding to each video frame sent by the vendor camera service framework via a chip in the hardware abstraction layer; determine the missing video frames among the at least two video frames based on the first information corresponding to each video frame; process the received video frames via the chip; and send the processed video frames to the vendor camera service framework, wherein the missing video frames among the at least two video frames were sent to the vendor camera service framework in an erroneous manner.

[0118] In the electronic device provided in this application embodiment, the electronic device can control the manufacturer's camera service framework to send recorded video frames to the hardware abstraction layer when it is determined that there are sufficient buffers in the hardware abstraction layer of the electronic device, so that the sent video frames can be processed. In this way, even if the input and output of the external chip framework with added IC chips is asynchronous, frame loss can be reduced and the recording quality can be improved by controlling the timing of video frame transmission.

[0119] It should be understood that, in this embodiment, the input unit 1004 may include a graphics processing unit (GPU) 10041 and a microphone 10042. The GPU 10041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1006 may include a display panel 10061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 1007 includes a touch panel 10071 and at least one of other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0120] The memory 1009 can be used to store software programs and various data. The memory 1009 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 1009 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 1009 in this embodiment includes, but is not limited to, these and any other suitable types of memory.

[0121] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor 1010.

[0122] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described video recording method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

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

[0124] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described video recording method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0125] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0126] This application provides a computer program / program product stored in a storage medium. The program / program product is executed by at least one processor to implement the various processes of the video recording method embodiments described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

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

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

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

Claims

1. A video recording method, characterized in that, The method includes: During video recording, the number of buffers in the hardware abstraction layer of the electronic device is detected; When the number of buffers is greater than or equal to a first number, at least two video frames and first information corresponding to each video frame are sent to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device. The first information includes at least one of a timestamp and a request identifier. The chip in the hardware abstraction layer receives video frames sent by the manufacturer's camera service framework and first information corresponding to each video frame. The chip determines the missing video frames in at least two video frames based on the first information corresponding to each video frame. The chip processes the received video frames and sends the processed video frames to the manufacturer's camera service framework, wherein the missing video frames in at least two of the video frames are sent to the manufacturer's camera service framework in an erroneous form.

2. The method according to claim 1, characterized in that, The number of buffers in the hardware abstraction layer of the detection electronic device includes: The value of the first variable is detected through the manufacturer's camera service framework; The value of the first variable is used to indicate the number of buffers, and the value of the first variable is updated in real time by the hardware abstraction layer.

3. The method according to claim 2, characterized in that, After sending the recorded video frames to the hardware abstraction layer via the vendor's camera service framework of the electronic device, the method further includes: The value of the first variable is updated to the first value through the hardware abstraction layer; Wherein, when the value of the first variable is the first value, the first variable is used to notify the manufacturer's camera service framework to clear the cached video frames.

4. The method according to claim 1, characterized in that, When the number of buffers is greater than or equal to a first number, sending the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device includes: If the number of buffers is greater than or equal to the first number, and the vendor camera service framework receives a notification corresponding to the callback function, the recorded video frames are sent to the hardware abstraction layer through the vendor camera service framework. The callback function is executed by the hardware abstraction layer and is used to notify the manufacturer's camera service framework to send the recorded video frames.

5. A video recording device, characterized in that, The device includes a detection module, a transmission module, a receiving module, and a processing module; The detection module is used to detect the number of buffers in the hardware abstraction layer of the electronic device during video recording. The sending module is configured to send at least two video frames and first information corresponding to each video frame to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device when the number of buffers is greater than or equal to a first number. The first information includes at least one of a timestamp and a request identifier. The receiving module is used to receive video frames sent by the manufacturer's camera service framework and first information corresponding to each video frame through the chip in the hardware abstraction layer. The processing module is configured to determine the missing video frame among the at least two video frames based on the first information corresponding to each video frame using the chip; and to process the received video frame using the chip and send the processed video frame to the manufacturer's camera service framework, wherein the missing video frame among the at least two video frames is sent to the manufacturer's camera service framework in an erroneous form.

6. The apparatus according to claim 5, characterized in that, The detection module is specifically used to detect the value of the first variable through the manufacturer's camera service framework; The value of the first variable is used to indicate the number of buffers, and the value of the first variable is updated in real time by the hardware abstraction layer.

7. The apparatus according to claim 6, characterized in that, The device also includes an update module; The update module is used to update the value of the first variable to the first value through the hardware abstraction layer after the sending module sends the recorded video frame to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device. Wherein, when the value of the first variable is the first value, the first variable is used to notify the manufacturer's camera service framework to clear the cached video frames.

8. The apparatus according to claim 5, characterized in that, The sending module is specifically used to send the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework when the number of buffers is greater than or equal to the first number and the manufacturer's camera service framework receives the notification corresponding to the callback function. The callback function is executed by the hardware abstraction layer and is used to notify the manufacturer's camera service framework to send the recorded video frames.

9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the video recording method as described in any one of claims 1-4.

10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the video recording method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Frequency modulation method and related device

    CN118450239A