Video playing method and device, electronic equipment and storage medium
By employing adaptive caching rules in embedded devices and utilizing a combination of memory and flash memory caching, the playback smoothness issue when the decoding performance of embedded devices is insufficient is resolved, thereby improving the playback effect of multimedia file streams.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2026-03-13
AI Technical Summary
When embedded devices have decoding performance higher than the actual playback frame rate, the playback smoothness of multimedia file streams is relatively low.
By receiving multimedia file streams, determining the video frame rate and decoding frame rate, storing the decoded data in the cache area using preset adaptive caching rules, and playing the data when the cache size reaches a threshold, especially for embedded devices, a combination of memory and flash memory caching is used.
It improves the smoothness of multimedia file stream playback and enhances the user experience.
Smart Images

Figure CN121665017A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of playback technology, and in particular to a video playback method, apparatus, electronic device, and storage medium. Background Technology
[0002] Currently, with the rapid development of the times and the continuous progress of technology, people have put forward the demand for video playback in various electronic devices such as electronic photo frames, children's cameras, door locks and other embedded electronic devices.
[0003] Specifically, in embedded devices, the playback of videos by a media player generally uses third-party software libraries such as ffmpeg, gstreamr, and exoplayer, as well as hardware decoding interfaces provided by integrated circuit chip (System on Chip, SoC) manufacturers to decode the video and audio data of multimedia file streams.
[0004] However, since video playback is relatively smooth when the decoding performance is higher than the actual playback frame rate, and the SoC's decoding performance generally has a margin, under high system operating conditions, the SoC's hardware or software decoding may not reach its maximum performance, resulting in lower playback smoothness of multimedia file streams.
[0005] It is evident that improving the smoothness of multimedia file stream playback on embedded device players is an urgent problem to be solved. Summary of the Invention
[0006] This invention provides a video playback method, apparatus, electronic device, and storage medium to improve the smoothness of playing multimedia file streams.
[0007] In a first aspect, embodiments of the present invention provide a video playback method applied to an electronic device, the method comprising:
[0008] Receive the multimedia file stream to be played and determine the video frame rate of the multimedia file stream to be played;
[0009] The multimedia file stream to be played is decoded to obtain decoded data and decoding frame rate;
[0010] When it is determined that the video frame rate is greater than the decoding frame rate, the decoding data is stored in the corresponding cache area according to the preset adaptive caching rules;
[0011] When the amount of decoded data in the buffer area reaches a preset threshold, the decoded data in the buffer area is played.
[0012] In one possible implementation, after obtaining the decoded data, the method further includes:
[0013] Determine the device type of the electronic device.
[0014] In one possible implementation, when it is determined that the video frame rate is greater than the decoding frame rate, the decoded data is stored in the corresponding cache area according to a preset adaptive caching rule, including:
[0015] If the device type of the electronic device is an embedded device, then the cache area is determined to include a first cache area and a second cache area;
[0016] Based on the decoding frame rate, the video frame rate, and the preset adaptive caching rule, determine the first cache quantity to be cached in the first cache region and the second cache quantity to be cached in the second cache region;
[0017] Once it is determined that the first cache area has cached the first cache amount of decoded data, the data other than the first cache amount of decoded data are sequentially stored in the second cache area.
[0018] In one possible implementation, the first cache region is a memory-based cache region, and the second cache region is a cache region based on flash memory storage space.
[0019] In one possible implementation, the decoded data of the first cache quantity is cached in the first cache region in a manner that indicates a memory address.
[0020] In one possible implementation, the decoded data of the first cache quantity is cached in the second cache area in the form of a descriptive filename.
[0021] In a second aspect, embodiments of the present invention provide a video playback device applied to an electronic device, the device comprising:
[0022] The processing unit is used to receive the multimedia file stream to be played and determine the video frame rate of the multimedia file stream to be played.
[0023] The obtaining unit is used to decode the multimedia file stream to be played, and obtain the decoded data and the decoded frame rate;
[0024] A caching unit is used to store the decoded data into the corresponding caching area according to a preset adaptive caching rule when it is determined that the video frame rate is greater than the decoding frame rate.
[0025] The playback unit is used to play the decoded data in the buffer area when it is determined that the amount of decoded data in the buffer area has reached a preset threshold.
[0026] In one possible implementation, after obtaining the decoded data, the apparatus further includes a determining unit for:
[0027] Determine the device type of the electronic device.
[0028] In one possible implementation, the cache unit is specifically used for:
[0029] If the device type of the electronic device is an embedded device, then the cache area is determined to include a first cache area and a second cache area;
[0030] Based on the decoding frame rate, the video frame rate, and the preset adaptive caching rule, determine the first cache quantity to be cached in the first cache region and the second cache quantity to be cached in the second cache region;
[0031] Once it is determined that the first cache area has cached the first cache amount of decoded data, the data other than the first cache amount of decoded data are sequentially stored in the second cache area.
[0032] In one possible implementation, the first cache region is a memory-based cache region, and the second cache region is a cache region based on flash memory storage space.
[0033] In one possible implementation, the cache unit is further configured to:
[0034] The decoded data of the first cache quantity is cached in the first cache area in a manner that describes the memory address.
[0035] In one possible implementation, the cache unit is further configured to:
[0036] The decoded data of the first cache quantity is cached in the second cache area with a descriptive filename.
[0037] Thirdly, embodiments of the present invention provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps included in any of the methods in the first aspect.
[0038] Fourthly, embodiments of the present invention provide a computer-readable storage medium including program code, which, when the program product is run on an electronic device, causes the electronic device to perform the steps included in any of the methods in the first aspect.
[0039] Fifthly, embodiments of the present invention provide a computer program product, the computer program product comprising: computer program code, which, when executed on an electronic device, causes the electronic device to perform the steps included in any of the methods in the first aspect.
[0040] The technical solutions provided by the embodiments of the present invention bring at least the following beneficial effects:
[0041] In this embodiment of the invention, a multimedia file stream to be played is received, and the video frame rate of the multimedia file stream to be played is determined; the multimedia file stream to be played is decoded to obtain decoded data and decoded frame rate; when it is determined that the video frame rate is greater than the decoded frame rate, the decoded data is stored in the corresponding cache area according to a preset adaptive caching rule; when it is determined that the cached amount of decoded data in the cache area reaches a preset threshold, the decoded data in the cache area is played. In other words, this embodiment of the invention can accurately and quickly determine the appropriate caching method for the multimedia file stream based on the difference between the video frame rate and the decoded frame rate, and determine the playback status of the multimedia file stream to complete the playback. This solves the problem of low playback smoothness of multimedia file streams caused by the decoder performance being slightly weaker than the video frame rate of the multimedia file stream, thus improving the user experience.
[0042] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practice. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings.
[0043] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0044] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention, but do not constitute an undue limitation of the invention.
[0045] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present invention;
[0046] Figure 2 A flowchart of a video playback method provided in an embodiment of the present invention;
[0047] Figure 3 This is a structural block diagram of a video playback device provided in an embodiment of the present invention;
[0048] Figure 4This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention. Unless otherwise specified, the embodiments and features in the embodiments of this invention can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0050] The term "comprising" and any variations thereof in the specification and claims of this invention are intended to cover non-exclusive protection. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0051] In this embodiment of the invention, "and / or" describes the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following associated objects have an "or" relationship.
[0052] Furthermore, unless otherwise stated, the ordinal numbers such as "first" and "second" mentioned in the embodiments of this invention are used to distinguish multiple objects and are not used to limit the size, content, order, timing, priority, or importance of multiple objects. For example, "first cache area" and "second cache area" are only used to distinguish cache areas and do not indicate that the two cache areas are different in size, priority, or importance.
[0053] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These are to be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description. It should be noted that in the embodiments of the present invention, references may be made to existing industry solutions such as software, components, and models. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solutions of the present invention, and do not imply that the applicant has already used or necessarily used such solutions.
[0054] In the technical solution of this invention, the collection, dissemination, and use of multimedia files such as video and audio all comply with the requirements of relevant national laws and regulations.
[0055] To facilitate understanding of the technical solutions provided in the embodiments of the present invention, some key terms used in the embodiments of the present invention will be explained here first:
[0056] 1. ffmpeg is an open-source audio and video processing tool that can be used for audio and video acquisition, encoding, decoding, transcoding, and processing.
[0057] 2. GStreamer is a powerful multimedia framework that can be used for audio and video acquisition, encoding, decoding, processing, and transmission.
[0058] 3. Exoplayer is a high-performance open-source media player library provided by Google for the Android and JavaFX platforms.
[0059] As mentioned earlier, video playback is relatively smooth when decoding performance exceeds the actual playback frame rate, and SoC decoding performance generally has a margin of safety. Therefore, under high system operating conditions, SoC hardware or software decoding may not reach its maximum performance, resulting in lower playback smoothness of multimedia file streams. Clearly, improving the smoothness of multimedia file stream playback on embedded device players is a pressing issue that needs to be addressed.
[0060] In view of this, the present invention provides a video playback method. This method receives a multimedia file stream to be played and determines its video frame rate; decodes the multimedia file stream to obtain decoded data and a decoded frame rate; when the video frame rate is determined to be greater than the decoded frame rate, the decoded data is stored in the corresponding cache area according to a preset adaptive caching rule; when the cached amount of decoded data in the cache area reaches a preset threshold, the decoded data in the cache area is played. In other words, in this embodiment of the invention, the appropriate caching method for the multimedia file stream can be accurately and quickly determined based on the difference between the video frame rate and the decoded frame rate, and the playback status of the multimedia file stream can be determined to complete the playback of the multimedia file stream. This solves the problem of low playback smoothness of multimedia file streams caused by decoder performance being slightly weaker than the video frame rate of the multimedia file stream, thus improving the user experience.
[0061] After introducing the design concept of the embodiments of the present invention, the following is a brief introduction to the application scenarios applicable to the technical solutions of the embodiments of the present invention. It should be noted that the application scenarios described in the embodiments of the present invention are for the purpose of more clearly illustrating the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. As those skilled in the art will know, with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
[0062] Please see Figure 1 The diagram shown illustrates a scenario to which the invention's embodiments can be applied. This scenario includes an information acquisition device 101 and an electronic device 102. The video playback method of this embodiment can be achieved through... Figure 1 The information acquisition device 101 and the electronic device 102 work together to achieve this, or it can be achieved solely through the electronic device 102. This embodiment of the invention does not limit the implementation in this way. The electronic device 102 may include one or more processors 1021, a memory 1022, and an I / O interface 1023 that interacts with the information acquisition device 101.
[0063] In this embodiment of the invention, the aforementioned information acquisition device 101 can generate a multimedia file stream. After the information acquisition device 101 generates the multimedia file stream, it can send the multimedia file stream to the electronic device 102 via the network 103. The electronic device 102 can receive the multimedia file stream to be played sent by the information acquisition device 101 through the I / O interface 1023, and then use the processor 1021 to determine the video frame rate of the multimedia file stream to be played; decode the multimedia file stream to be played to obtain the decoded data and the decoded frame rate; when it is determined that the video frame rate is greater than the decoded frame rate, the decoded data is stored in the corresponding cache area according to the preset adaptive caching rules; when it is determined that the cached amount of decoded data in the cache area reaches a preset threshold, the decoded data in the cache area is played.
[0064] In specific implementation, multiple electronic devices 102 may interact with multiple information collection devices 101, or one electronic device 102 may interact with multiple information collection devices 101, or one electronic device 102 may interact with one information collection device 101. No limitation is made in this embodiment of the invention. Figure 1 The example shown is an interaction between an electronic device 102 and an information acquisition device 101.
[0065] In this embodiment of the invention, the electronic device 102 may be, for example, a tablet computer (PAD), a personal computer (PC), a smartphone, a smart TV, a smart in-vehicle device, a wearable device, an electronic photo frame, a children's camera, a door lock, or other devices that can receive and play audio and video. This embodiment of the invention does not limit the scope of the invention.
[0066] In this embodiment of the invention, the information collection device 101 may be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, or it may be a physical server, but it is not limited to these.
[0067] The information acquisition device 101 and the electronic device 102 can communicate with each other through one or more networks 103. The network 103 can be a wired network or a wireless network. For example, the wireless network can be a mobile cellular network or a Wi-Fi (Wi-Fi) network. Of course, it can also be other possible networks. This embodiment of the invention does not limit the types of networks.
[0068] Of course, the method provided in the embodiments of the present invention is not limited to... Figure 1 The application scenarios shown can also be used in other possible scenarios, such as implementing video playback methods only on electronic devices; the embodiments of the present invention do not impose limitations. Figure 1 The functions that each device in the application scenario shown can achieve will be described in subsequent method embodiments, and will not be elaborated on here.
[0069] To further illustrate the video playback method provided in the embodiments of the present invention, a detailed description is provided below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of the present invention provide method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on conventional or non-inventive methods. In steps where there is no logically necessary causal relationship, the execution order of these steps is not limited to the execution order provided in the embodiments of the present invention. In actual processing or when the device executes the method, it may be executed in the order shown in the embodiments or drawings, or in parallel (e.g., in an application environment with parallel processors or multi-threaded processing).
[0070] The following combination Figure 2 The flowchart shown illustrates the video playback method in this embodiment of the invention. The method can be executed by an electronic device, and the specific implementation flow of the method is as follows:
[0071] Step 201: Receive the multimedia file stream to be played and determine the video frame rate of the multimedia file stream to be played.
[0072] In this embodiment of the invention, the electronic device can receive a multimedia file stream to be played transmitted over a network, and then determine the video frame rate of the multimedia file stream to be played. Optionally, the video frame rate can be referred to as the playback frame rate.
[0073] In this embodiment of the invention, a multimedia file stream can be understood as an information stream including video streams and / or audio streams. Optionally, the multimedia file stream can be directly captured by an electronic device or obtained from other information acquisition devices; this embodiment of the invention does not limit this. Optionally, a video stream can be a video with a transmission duration of less than 3 minutes (e.g., short videos in the prior art); a video stream can also be a video with a transmission duration of more than 3 minutes (e.g., long videos in the prior art). Of course, the content of the video stream can be videos generated in various scenarios; this embodiment of the invention does not limit the duration and content of the video stream.
[0074] Step 202: Decode the multimedia file stream to be played to obtain the decoding data and decoding frame rate.
[0075] Step 203: When it is determined that the video frame rate is greater than the decoding frame rate, the decoded data is stored in the corresponding cache area according to the preset adaptive caching rules.
[0076] Step 204: When the amount of decoded data in the buffer area reaches the preset threshold, the decoded data in the buffer area is played.
[0077] In this embodiment of the invention, the electronic device can decode the multimedia file stream to be played, obtaining decoded data and a decoded frame rate. Furthermore, after obtaining the decoded data, the electronic device can also determine its device type.
[0078] In one possible implementation, if the electronic device is an embedded device, the cache region is determined to include a first cache region and a second cache region. Optionally, the first cache region is a memory-based cache region, and the second cache region is a cache region based on flash memory (Flash EEPROM Memory, flash) storage space.
[0079] In this embodiment of the invention, the electronic device can determine the first cache quantity to be cached in the first cache region and the second cache quantity to be cached in the second cache region based on the decoding frame rate, the video frame rate, and the preset adaptive caching rules. Then, the decoded data of the first cache quantity can be cached in the first cache region in a manner that specifies the memory address, and the decoded data of the first cache quantity can be cached in the second cache region in a manner that specifies the file name.
[0080] In the specific implementation process, after it is determined that the first cache area has cached the first cache amount of decoded data, the data in the decoded data other than the first cache amount of decoded data are stored into the second cache area in sequence.
[0081] For example, if the multimedia file stream is a video file, and the actual playback frame rate of the video file is greater than the decoding frame rate, the electronic device can first obtain the video length, and then determine the difference between the playback frame rate and the decoding frame rate, and multiply the difference by the video length as the number of frames that need to be cached in advance. For example, assuming the video file is 10 seconds long, the playback frame rate is 30fps, and the decoding performance of the video at this resolution is 28fps, then it can be determined that the number of frames that need to be cached in advance is 20 frames.
[0082] Furthermore, it can be determined whether the device type of the electronic device is an embedded device.
[0083] Optionally, if the electronic device is a non-embedded device, the electronic device can create a buffer based on runtime memory, and trigger playback of the video file when the number of frames corresponding to the decoded data reaches 20 frames.
[0084] Optionally, if the electronic device is an embedded device, since RAM is relatively scarce in embedded devices, a larger cache is needed when the video file is 20 seconds long or longer, which the embedded device's RAM may not be sufficient for. Therefore, the electronic device can create a second storage area based on flash memory. Furthermore, after determining the first cache size and the second cache size created from RAM, assuming that the first storage area can buffer a maximum of 10 frames (i.e., the first cache size), data can be written to the second storage area, i.e., flash memory.
[0085] In this embodiment of the invention, when the electronic device determines that the playback thread of the player has finished playing the video file, if the cached decoding data is obtained from memory, it is returned to the decoding thread of the decoder; if the cached decoding data is obtained from flash, it can be deleted.
[0086] In this embodiment of the invention, the electronic device includes a player and a decoder. The player executes a playback thread, and the decoder executes a decoding thread; in other words, the playback thread and the decoding thread are two separate threads. Optionally, the communication method between the playback thread and the decoding thread can be a message queue, where the decoder is, for example, a producer, and the player is, for example, a consumer. This allows for simultaneous playback and decoding. Furthermore, due to pre-caching, even if playback follows the original frame rate of the video file, the playback thread will not fail to obtain the decoded data, thereby improving the smoothness of video file playback.
[0087] Based on the same inventive concept, embodiments of the present invention provide a video playback device capable of implementing the functions corresponding to the aforementioned video playback method. This video playback device can be a hardware structure, a software module, or a hardware structure plus a software module. The video playback device can be implemented using a chip system, which can consist of chips or include chips and other discrete components. Please refer to [link to previous text]. Figure 3 As shown, the video playback device includes:
[0088] The processing unit 301 is used to receive the multimedia file stream to be played and determine the video frame rate of the multimedia file stream to be played.
[0089] The obtaining unit 302 is used to decode the multimedia file stream to be played and obtain the decoding data and decoding frame rate;
[0090] The caching unit 303 is used to store the decoded data into the corresponding cache area according to a preset adaptive caching rule when it is determined that the video frame rate is greater than the decoding frame rate.
[0091] The playback unit 304 is used to play the decoded data in the buffer area when it is determined that the amount of decoded data in the buffer area has reached a preset threshold.
[0092] In one possible implementation, after obtaining the decoded data, the apparatus further includes a determining unit for:
[0093] Determine the device type of the electronic device.
[0094] In one possible implementation, the cache unit 303 is specifically used for:
[0095] If the device type of the electronic device is an embedded device, then the cache area is determined to include a first cache area and a second cache area;
[0096] Based on the decoding frame rate, the video frame rate, and the preset adaptive caching rule, determine the first cache quantity to be cached in the first cache region and the second cache quantity to be cached in the second cache region;
[0097] Once it is determined that the first cache area has cached the first cache amount of decoded data, the data other than the first cache amount of decoded data are sequentially stored in the second cache area.
[0098] In one possible implementation, the first cache region is a memory-based cache region, and the second cache region is a cache region based on flash memory storage space.
[0099] In one possible implementation, the cache unit 303 is further configured to:
[0100] The decoded data of the first cache quantity is cached in the first cache area in a manner that describes the memory address.
[0101] In one possible implementation, the cache unit 303 is further configured to:
[0102] The decoded data of the first cache quantity is cached in the second cache area with a descriptive filename.
[0103] All relevant content of each step involved in the aforementioned video playback method embodiments can be referenced to the functional description of the corresponding functional module of the video playback device in the embodiments of the present invention, and will not be repeated here.
[0104] The module division in this embodiment of the invention is illustrative and represents only one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in the various embodiments of the invention can be integrated into a single controller, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0105] Based on the same inventive concept, embodiments of the present invention provide an electronic device, please refer to... Figure 4 As shown, the electronic device includes at least one processor 401 and a memory 402 connected to the at least one processor. In this embodiment of the invention, the specific connection medium between the processor 401 and the memory 402 is not limited. Figure 4 Taking the connection between processor 401 and memory 402 via bus 400 as an example, bus 400 in... Figure 4 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The 400 bus can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 4 The bus is represented by only one thick line, but this does not mean that there is only one bus or one type of bus. In addition, the video playback device also includes a communication interface 403 for receiving or sending data.
[0106] In this embodiment of the invention, the memory 402 stores instructions that can be executed by at least one processor 401. By executing the instructions stored in the memory 402, at least one processor 401 can perform the steps included in the aforementioned video playback method.
[0107] The processor 401 is the control center of the electronic device. It can connect to various parts of the electronic device through various interfaces and lines. By running or executing instructions stored in the memory 402 and calling data stored in the memory 402, it can monitor the various functions and data processing of the electronic device as a whole.
[0108] Optionally, processor 401 may include one or more processing units. Processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into processor 401. In some embodiments, processor 401 and memory 402 may be implemented on the same chip; in some embodiments, they may be implemented separately on independent chips.
[0109] Processor 401 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0110] Memory 402, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 402 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 402 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In embodiments of the present invention, memory 402 may also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0111] By designing and programming the processor 401, the code corresponding to the video playback method described in the foregoing embodiments can be embedded into the chip, so that the chip can execute the steps of the aforementioned video playback method when running. How to design and program the processor 401 is a well-known technique to those skilled in the art, and will not be described in detail here.
[0112] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium including program code, which, when the program product is run on an electronic device, is used to cause the electronic device to perform the steps of the video playback method described above.
[0113] In some possible implementations, various aspects of the video playback method provided by the present invention can also be implemented as a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the steps of the video playback method according to various exemplary embodiments of the present invention described above.
[0114] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0115] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0116] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0117] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0118] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A video playback method, characterized in that, Applied to electronic devices, the method includes: Receive the multimedia file stream to be played and determine the video frame rate of the multimedia file stream to be played; The multimedia file stream to be played is decoded to obtain decoded data and decoding frame rate; When it is determined that the video frame rate is greater than the decoding frame rate, the decoding data is stored in the corresponding cache area according to the preset adaptive caching rules; When the amount of decoded data in the buffer area reaches a preset threshold, the decoded data in the buffer area is played.
2. The method as described in claim 1, characterized in that, After obtaining the decoded data, the method further includes: Determine the device type of the electronic device.
3. The method as described in claim 2, characterized in that, When it is determined that the video frame rate is greater than the decoding frame rate, the decoded data is stored in the corresponding cache area according to a preset adaptive caching rule, including: If the device type of the electronic device is an embedded device, then the cache area is determined to include a first cache area and a second cache area; Based on the decoding frame rate, the video frame rate, and the preset adaptive caching rule, determine the first cache quantity to be cached in the first cache region and the second cache quantity to be cached in the second cache region; Once it is determined that the first cache area has cached the first cache amount of decoded data, the data other than the first cache amount of decoded data are sequentially stored in the second cache area.
4. The method as described in claim 3, characterized in that, The first cache area is a memory-based cache area, and the second cache area is a cache area based on flash memory storage space.
5. The method as described in claim 4, characterized in that, The decoded data of the first cache quantity is cached in the first cache area in a manner that describes the memory address.
6. The method as described in claim 5, characterized in that, The decoded data of the first cache quantity is cached in the second cache area with a descriptive filename.
7. A video playback device, characterized in that, Applied to electronic devices, the device includes: The processing unit is used to receive the multimedia file stream to be played and determine the video frame rate of the multimedia file stream to be played. The obtaining unit is used to decode the multimedia file stream to be played, and obtain the decoded data and the decoded frame rate; A caching unit is used to store the decoded data into the corresponding caching area according to a preset adaptive caching rule when it is determined that the video frame rate is greater than the decoding frame rate. The playback unit is used to play the decoded data in the buffer area when it is determined that the amount of decoded data in the buffer area has reached a preset threshold.
8. An electronic device, characterized in that, The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1-6.
10. A computer program product, characterized in that, The computer program product includes: computer program code, which, when run on an electronic device, causes the electronic device to perform the method described in any one of claims 1-6.