CN109240833A - Resource allocation method, device, terminal and storage medium - Google Patents

Resource allocation method, device, terminal and storage medium Download PDF

Info

Publication number
CN109240833A
CN109240833A CN201811122144.9A CN201811122144A CN109240833A CN 109240833 A CN109240833 A CN 109240833A CN 201811122144 A CN201811122144 A CN 201811122144A CN 109240833 A CN109240833 A CN 109240833A
Authority
CN
China
Prior art keywords
operating system
resource
audio
parameter
audio file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811122144.9A
Other languages
Chinese (zh)
Inventor
陈岩
程杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201811122144.9A priority Critical patent/CN109240833A/en
Publication of CN109240833A publication Critical patent/CN109240833A/en
Priority to PCT/CN2019/094724 priority patent/WO2020063008A1/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

This application discloses a kind of resource allocation method, device, terminal and storage mediums, belong to field of terminal technology.The described method includes: destination application sends the audio frequency parameter of audio file to operating system by the API for calling SDK to provide;Operating system receives the audio frequency parameter that destination application is sent;Operating system determines resource allocation strategy according to audio frequency parameter;Operating system is audio file distributing system resource according to resource allocation strategy.The api interface that the embodiment of the present application calls SDK to provide by destination application, the audio frequency parameter of audio file is sent to operating system, so that operating system is according to audio frequency parameter relevant to the audio quality of audio file, pointedly corresponding system resource is distributed for it, so that the broadcasting that system resource has enough performances to meet the audio file, effectively increases the audio quality of audio file.

Description

Resource allocation method, device, terminal and storage medium
Technical field
The invention relates to field of terminal technology, in particular to a kind of resource allocation method, device, terminal and storage Medium.
Background technique
With the continuous development of mobile terminal technology, the type of application program is also more and more in mobile terminal.For example, moving Game class application program, social category application program, video playback class application program, audio broadcast message class are installed simultaneously in dynamic terminal Application program, instant messaging class application program and shopping class application program.
In order to improve the usage experience of application program, mobile terminal manufacturer all in the hardware configuration for constantly promoting itself, with Improve the speed of service and quality of application program.For example, mobile terminal is by configuring high performance central processing unit (Central Processing Unit, CPU) improve the speed of service and audio quality of audio broadcast message class application program.
Summary of the invention
The embodiment of the present application provides a kind of resource allocation method, device, terminal and storage medium, can solve and only passes through The performance of terminal hardware configuration is promoted to improve the audio quality of audio broadcast message class application program, higher cost and promotes effect not Good problem.The technical solution is as follows:
According to the embodiment of the present application in a first aspect, providing a kind of resource allocation method, the method is applied to terminal, The terminal operating has operating system and the destination application for playing audio file, which comprises
The destination application is by calling Software Development Kit (Software Development Kit, SDK) The application programming interface (Application Programming Interface, API) of offer, to the operating system The audio frequency parameter of the audio file is sent, the audio frequency parameter includes ginseng relevant to the audio quality of the audio file Number;
The operating system receives the audio frequency parameter that the destination application is sent;
The operating system determines that resource allocation strategy, the resource allocation strategy are the mesh according to the audio frequency parameter The strategy of distributing system resource when mark application program plays the audio file;
The operating system is that the audio file distributes the system resource according to the resource allocation strategy.
According to the second aspect of the embodiment of the present application, a kind of device for allocating resources is provided, described device includes operation system System module and the destination application module for playing audio file, described device include:
The destination application module is sent for the API by calling SDK to provide to the operating system module The audio frequency parameter of the audio file, the audio frequency parameter include parameter relevant to the audio quality of the audio file;
The operating system module, the audio frequency parameter sent for receiving the destination application module;
The operating system module is also used to determine resource allocation strategy, the resource distribution according to the audio frequency parameter Strategy is the strategy of distributing system resource when the destination application module plays the audio file;
The operating system module is also used to be that the audio file distributes the system according to the resource allocation strategy Resource.
According to the third aspect of the embodiment of the present application, a kind of terminal is provided, the terminal includes processor and memory, It is stored at least one instruction in the memory, described instruction is loaded by the processor and executed to realize such as the application the One side and its any resource allocation method of alternative embodiment.
According to the fourth aspect of the embodiment of the present application, a kind of computer readable storage medium, the storage medium are provided In be stored at least one instruction, described instruction is loaded by processor and is executed to realize such as the application first aspect and its optional Any resource allocation method of embodiment.
Technical solution bring beneficial effect provided by the embodiments of the present application includes at least:
Destination application sends the audio ginseng of audio file to operating system by the api interface for calling SDK to provide Number formulates corresponding resource allocation strategy so that operating system is based on audio frequency parameter, to be mesh according to the resource allocation strategy The audio file that mark application program is played distributes corresponding system resource;Compared to the simple hardware performance for promoting terminal, originally Operating system in embodiment can pointedly be distributed according to audio frequency parameter relevant to the audio quality of audio file for it Corresponding system resource effectively increases audio file so that system resource has enough performances to meet the broadcasting of the audio file Audio quality, and reduce dependence to terminal hardware.
Detailed description of the invention
Fig. 1 is the structural schematic diagram for the terminal that one exemplary embodiment of the application provides;
Fig. 2 is the implementation diagram of application program and operating system communication process in terminal;
Fig. 3 is the structural schematic diagram for the terminal that one exemplary embodiment of the application provides;
Fig. 4 and Fig. 5 is the implementation diagram of application program and operating system communication process in terminal shown in Fig. 3;
Fig. 6 is the structural schematic diagram for the terminal that another exemplary embodiment of the application provides;
Fig. 7 shows the flow chart of the resource allocation method shown in one exemplary embodiment of the application;
Fig. 8 shows the flow chart of the resource allocation method shown in another exemplary embodiment of the application;
Fig. 9 shows the flow chart of the resource allocation method shown in another exemplary embodiment of the application;
Figure 10 shows the flow chart of the resource allocation method shown in another exemplary embodiment of the application;
Figure 11 shows the structural block diagram of the device for allocating resources of the application one embodiment offer.
Specific embodiment
To keep the purposes, technical schemes and advantages of the application clearer, below in conjunction with attached drawing to the application embodiment party Formula is described in further detail.
In the following description when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different attached drawings indicate same or similar Element.Embodiment described in following exemplary embodiment does not represent all embodiment party consistent with the application Formula.On the contrary, they are only the device and side consistent with some aspects as detailed in the attached claim, the application The example of method.
In the description of the present application, it is to be understood that term " first ", " second " etc. are used for description purposes only, without It can be interpreted as indication or suggestion relative importance.In the description of the present application, it should be noted that unless otherwise specific regulation And restriction, term " connected ", " connection " shall be understood in a broad sense, for example, it may be being fixedly connected, may be a detachable connection, Or it is integrally connected;It can be mechanical connection, be also possible to be electrically connected;It can be directly connected, intermediary can also be passed through It is indirectly connected.For the ordinary skill in the art, the tool of above-mentioned term in this application can be understood with concrete condition Body meaning.In addition, unless otherwise indicated, " multiple " refer to two or more in the description of the present application."and/or" is retouched The incidence relation of affiliated partner is stated, indicates may exist three kinds of relationships, for example, A and/or B, can indicate: individualism A, together When there are A and B, these three situations of individualism B.Character "/" typicallys represent the relationship that forward-backward correlation object is a kind of "or".
Referring to FIG. 1, the structural block diagram of the terminal 100 provided it illustrates one exemplary embodiment of the application.It should Terminal 100, which can be smart phone, tablet computer, e-book etc., can run the electronic equipment of application program.In the application Terminal 100 may include one or more such as lower component: processor 110, memory 120 and input/output unit 130.
Processor 110 may include one or more processing core.Processor 110 utilizes various interfaces and connection Various pieces in entire terminal 100, by running or executing the instruction being stored in memory 120, program, code set or refer to Collection is enabled, and calls the data being stored in memory 120, executes the various functions and processing data of terminal 100.Optionally, Processor 110 can use Digital Signal Processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA) at least one of example, in hardware realize.Processor 110 can integrate CPU, image processor (Graphics Processing Unit, GPU) and one or more of modem etc. combination.Wherein, the main processing operation system of CPU System, user interface and application program etc.;GPU is for being responsible for the rendering and drafting of display content;Modem is for handling nothing Line communication.It is understood that above-mentioned modem can not also be integrated into processor 110, communicated separately through one piece Chip is realized.
Memory 120 may include random access memory (Random Access Memory, RAM), also may include read-only Memory (Read-Only Memory).Optionally, which includes non-transient computer-readable medium (non- transitory computer-readable storage medium).Memory 120 can be used for store instruction, program, generation Code, code set or instruction set.Memory 120 may include storing program area and storage data area, wherein storing program area can store Instruction for realizing operating system, the instruction for realizing at least one function (such as touch function, sound-playing function, Image player function etc.), for realizing instruction of following each embodiments of the method etc., which can be Android (Android) system (including the system based on android system deep development), Apple Inc.'s exploitation IOS system (including base In the system of IOS system depth exploitation) or other systems.Storage data area can also store terminal 100 and be created in use Data (such as phone directory, audio, video data, chat record data) etc..
Memory 120 can be divided into operating system space and user's space, and operating system runs on operating system space, former Raw and third party application runs on user's space.It can reach preferable to guarantee different third party applications Operational effect, operating system distribute corresponding system resource for different third party applications for it.However, same third party There is also differences for demand of the different application scene to system resource in application program, for example, under local resource loading scenario, the Tripartite's application program is more demanding to disk reading speed;Under animation render scenes, third party application is then to GPU Can it is more demanding.And it is mutually indepedent between operating system and third party application, operating system tends not to perceive in time The current application scenarios of third party application cause operating system can not be according to the concrete application scene of third party application Targetedly system resource is carried out to be adapted to.
As shown in Fig. 2, needing to get through to enable operating system to distinguish the concrete application scene of third party application Data communication between third party application and operating system, enables operating system to obtain third party application at any time Current scene information, and then targetedly system resource is carried out based on current scene and is adapted to.
By taking operating system is android system as an example, the program and data stored in memory 120 is as shown in figure 3, storage Linux inner core 220, system Runtime Library layer 240, application framework layer 260 and application layer 280 can be stored in device 120, wherein Linux inner core 220, system Runtime Library layer 240 and application framework layer 260 belong to operating system space, and application layer 280 belongs to use Family space.Linux inner core 220 provides the driving of bottom for the various hardware of terminal 100, such as show driving, audio driven, Webcam driver, bluetooth driving, Wi-Fi driving, power management etc..System Runtime Library layer 240 by some libraries C/C++ come for Android system provides main characteristic and supports.If the library SQLite provides the support of database, the library OpenGL/ES is provided The support that 3D draws, the library Webkit provides the support etc. of browser kernel.Peace is also provided in system Runtime Library layer 240 Tall and erect run-time library (English: Android Runtime), it mainly provides some core libraries, and developer can allow for use Java language is applied to write Android.Application framework layer 260 provides the various API that may be used when building application program, Developer can also construct the application program of oneself, such as activity management, window management, view pipe by using these API Reason, content provider, assures reason, call management, resource management, orientation management at notice management.In application layer 280 operation have to A few application program, these application programs can be the included native applications program of operating system, such as contact person's program, short Believe program, timing routine, camera applications etc.;It is also possible to the third party application that third party developer is developed, for example swims Play class application program, instant messaging program, photograph pretty program, shopping program etc..
A kind of feasible communication mode is as shown in figure 4, third-party application journey between operating system and third party application The SDK for being communicated with operating system is embedded in sequence.
Wherein, SDK includes several by abstract API, and is supplied to third party application by operating system developer Developer, and the SDK is embedded into third party application by third party application developer.Such third-party application journey After sequence is installed and operates in operating system, the API that SDK can be called to provide is communicated with operating system.
As shown in figure 4, system Runtime Library layer 240 can additionally include interface communication systems 242.The interface communication systems 242 can be considered as a subsystem in operating system, or be considered as an embedded application program of operating system.Interface communication system SDK interface is provided in system 242, third party application is to call between the API and the SDK interface of SDK through bonding (English Text: Binder) mode carry out data communication.In this way, the relevant data of the application scenarios of third party application can lead to It crosses SDK and is transferred to operating system.By SDK, operating system actively can also transmit data to third party application, alternatively, Bidirectional data transfers can be carried out between operating system and third party application.
In another feasible communication mode, as shown in figure 5, third party application can also use socket (English Text: Socket) the Socket interfaces of mode and interface communication systems 242 establishes long connection, the applied field of third party application The relevant data of scape can be connected by the length and be transferred to operating system.
As shown in Figures 4 and 5, it may be provided with different policy modules in interface communication systems 242, receive third-party application After the data that program is sent, interface communication systems 242 carry out data using the corresponding policy module of third party application Analysis, obtains corresponding resource adaptation optimisation strategy.Based on the resource adaptation optimisation strategy that analysis obtains, interface communication systems 242 notify Linux inner core 220 to carry out system resource adaptation optimization by control interface.Wherein, which can use The mode of Sysfs is communicated with Linux inner core 220.
Optionally, policy module different in interface communication systems 242 can correspond to different third party applications (i.e. For different application program Provisioning Policy modules), alternatively, different policy modules corresponds to different types of third-party application journey Sequence (is directed to different types of application program Provisioning Policy module), alternatively, different policy modules corresponds to different system money Source (is directed to different system resource Provisioning Policy modules), alternatively, different policy modules corresponds to different application scenarios (i.e. needles To different with application scenarios Provisioning Policy module), the embodiment of the present application does not carry out the specific set-up mode of policy module It limits.
Wherein, interface communication systems 242 can also be communicated by way of Binder with application framework layer 260, be used In the prospect application message for receiving the transmission of application framework layer 260, to be based on prospect application message, run only for current foreground Third party application carry out system resource optimization.
By taking operating system is IOS system as an example, the program and data stored in memory 120 is as shown in fig. 6, IOS system It include: kernel operating system layer 320 (English: Core OS layer), (English: Core Services of kernel service layer 340 Layer), Media layer 360 (English: Media layer), tangible layer 380 (English: Cocoa Touch Layer).Core behaviour Making system layer 320 includes operating system nucleus, driver and underlying programs frame, these underlying programs frames provide more Close to the function of hardware, used for being located at the program frame of kernel service layer 340.Kernel service layer 340 is supplied to application System service and/or program frame required for program, such as basis (English: Foundation) frame, account frame, advertisement Frame, data frame memory frame, network connection frame, geographical location frame, moving frame etc..Media layer 360 is application program Interface in terms of providing in relation to audiovisual, as the relevant interface of graph image, the relevant interface of Audiotechnica, video technique are relevant Interface, radio play (English: AirPlay) interface of audio video transmission technology etc..Tangible layer 380 mentions for application development The relevant frame in various common interfaces is supplied, tangible layer 380 is responsible for the touch interactive operation of user on the terminal 100.Than Service, long-range Push Service, advertising framework, game tool frame, message user interface interface (User are notified as local Interface, UI) frame, user interface UIKit frame, map frame etc..
In frame out shown in Fig. 6, frame related with major applications program includes but is not limited to: kernel service layer The UIKit frame in basic framework and tangible layer 380 in 340.Basic framework provides many basic object class and data It is unrelated to provide most basic system service and UI for all application programs for type.And the class that UIKit frame provides is basic UI class libraries, for creating the user interface based on touch, iOS application program can provide UI based on UIKit frame, so it The architecture of application program is provided, for constructing user interface, drawing, processing and user's alternative events, response gesture etc. Deng.
Wherein, realize that the mode of third party application and operating system data communication and principle can in IOS system With reference to android system, details are not described herein by the application.
Input/output unit 130 may include touch display screen, which uses finger, touching for receiving user Touch the touch operation of any suitable object such as pen on it or nearby, and the user interface of each application program of display.Touching Touch the front panel that display screen is generally arranged at terminal 100.Touch display screen is designed to shield comprehensively, Curved screen or abnormal shape Screen.Touch display screen is also designed to shield comprehensively and the combination of Curved screen, the combination of abnormal shape screen and Curved screen, the application reality It applies example and this is not limited.
In addition to this, it will be understood by those skilled in the art that the structure of terminal 100 shown by above-mentioned attached drawing is not constituted Restriction to terminal 100, terminal may include perhaps combining certain components or difference than illustrating more or fewer components Component layout.For example, further including radio circuit, input unit, sensor, voicefrequency circuit, Wireless Fidelity in terminal 100 The components such as (Wireless Fidelity, WiFi) module, power supply, bluetooth module, details are not described herein.
Referring to FIG. 7, it illustrates the flow charts of the resource allocation method shown in one exemplary embodiment of the application.This Embodiment is applied to operation in this way has the terminal 100 of operating system and at least one application program to illustrate.The party Method includes:
Step 701, destination application sends the audio of audio file to operating system by the API for calling SDK to provide Parameter, audio frequency parameter include parameter relevant to the audio quality of audio file.
SDK can be the SDK for being embedded in and being provided in destination application by operating system developer, be also possible to be located at behaviour Make the SDK in the dynamic base (Dynamic Link Library, DLL) of so file of the system Runtime Library layer of system.For side Just illustrate, be only illustrated so that SDK is the SDK being embedded in destination application as an example below.
Optionally, destination application is the third party application for being embedded with the SDK that operating system developer provides.It should Destination application is audio broadcast message class application program.
For destination application by the API for calling SDK to provide, destination application is to establish between operating system Binder connection sends audio frequency parameter to connect by the Binder to operating system.
Optionally, the audio frequency parameter of audio file is used to indicate the attribute of audio file, and audio frequency parameter includes and audio text The relevant parameter of the audio quality of part.Schematically, the audio frequency parameter of audio file includes the file size of audio file, format At least one of information, compression ratio and sample frequency.
Wherein, format information may include MP3, AAC, M4A/MP4, WMA, APE, MPC, OGG, WAVE, CD, FLAC, RM, TTA, AIFF, AU etc..
For the opportunity for the audio frequency parameter for sending audio file, in a kind of possible embodiment, destination application It is spaced the audio frequency parameter that the audio file got is sent to operating system at predetermined time intervals, for example, the predetermined time interval For 5s or 10s;In alternatively possible embodiment, destination application is in operation to specified application scenarios, to operation System sends the audio frequency parameter of collected audio file.Specified application scenarios are applied field relevant to audio file is played Scape.
Step 702, operating system receives the audio frequency parameter that destination application is sent.
As shown in figure 4, operating system passes through the SDK interface of interface communication systems 242, receive what destination application was sent Audio frequency parameter.
In order to avoid unauthorized applications are communicated by the way of embedded SDK with operating system, cause system safe Hidden danger optionally after operating system receives audio frequency parameter, obtains the application identities of destination application.
Optionally, while operating system receives the audio frequency parameter that destination application is sent, destination application is received The application identities of transmission, the application identities are used for the unique identification destination application.
Default application identities list is stored in operating system, comprising supporting to carry out resource in the default application identities list The application identities of the application program of configuration.Optionally, which is arranged by operating system developer, and is stored encrypted in terminal It is interior.
If the application identities of destination application belong to default application identities list, operating system thens follow the steps 703, if The application identities of destination application are not belonging to default application identities list, and operating system is then not responding to audio frequency parameter.
Optionally, when the application identities of destination application are not belonging to default application identities list, operating system is disconnected Connection between destination application.
Step 703, operating system determines that resource allocation strategy, resource allocation strategy are target application journey according to audio frequency parameter The strategy of distributing system resource when sequence plays audio file.
The system resource that operating system can distribute includes hardware resource and software resource, and under different application scenarios, mesh It is different to the desirability of different system resources to mark application program, therefore, different application scenarios are directed in order to realize, for application Program dynamic configuration system resource, the operating system audio frequency parameter current according to destination application, formulates corresponding resource and matches Set strategy.
In a kind of possible embodiment, operating system is determined in destination application and is played according to audio frequency parameter Or the audio quality of audio file to be played, and when audio quality does not meet expected, formulate dynamic configuration related system The resource allocation strategy of resource.Wherein, which refers to system resource relevant to audio quality.
Optionally, it is included at least in the resource allocation strategy: the resource type and resource quantity of system resource to be configured.
Step 704, operating system is audio file distributing system resource according to resource allocation strategy.
Further, according to the resource allocation strategy made, operating system is communicated with inner nuclear layer, thus in instruction Stratum nucleare configures corresponding system resource.
Schematically, as shown in figure 4, interface communication systems 242 pass through control interface and linux kernel in operating system Layer 220 is communicated, and is finally completed system resource and is distributed rationally.
Optionally, for the system resource (such as cpu resource) that can be controlled by way of Direct Communication, operation System calls directly the corresponding abstraction interface of such system resource and completes resource distribution;And operating system can not be accessed directly The system resource of control, operating system are carried out by the way of agency by acting on behalf of subsystem corresponding with such system resource Communication indirectly, to complete system resource configuration.
Optionally, when the destination application end lives period (process of application program terminates), i.e., mesh ought be received When marking the process end signal of application program, operating system disconnects the connection between destination application, and it is logical to clear up data Connection is established with other applications so as to subsequent in road.
In conclusion in the embodiment of the present application, the api interface that destination application is provided by calling SDK, to operation System sends the audio frequency parameter of audio file, formulates corresponding resource allocation strategy so that operating system is based on audio frequency parameter, from And corresponding system resource is distributed according to the audio file that the resource allocation strategy is played by destination application;Compared to list The pure hardware performance for promoting terminal, the operating system in the present embodiment can be according to sound relevant to the audio quality of audio file Frequency parameter pointedly distributes corresponding system resource for it, so that system resource has enough performances to meet the audio file It plays, effectively increases the audio quality of audio file, and reduce the dependence to terminal hardware.
In addition, operating system, which is based on default application identities list, realizes the detection of application program legitimacy, to avoid and SDK Unauthorized applications communicated, improve the safety of operating system.
Comprehensively consider the factors such as power consumption, volume of transmitted data, in a kind of possible embodiment, destination application Only in operation to specific application scene, the audio frequency parameter under the application scenarios can be just acquired, and be sent to operating system, accordingly , operating system is according to the audio frequency parameter received, for the destination application allocating system resource under the application scenarios.Below It is illustrated using schematical embodiment.
Referring to FIG. 8, it illustrates the flow charts of the resource allocation method shown in another exemplary embodiment of the application. The present embodiment is applied to come in terminal 100 in this way for example, operation has operating system to answer at least one in terminal 100 Use program.This method comprises:
Step 801, destination application obtains the audio frequency parameter of audio file to be played or being played on, audio ginseng Number includes at least one of file size, format information, compression ratio and the sample frequency of audio file.
Destination application is audio broadcast message class application program, and destination application is for playing audio file.The audio File is audio file being played in audio file or destination application to be played in destination application.
Optionally, if current application scene is default application scenarios, destination application obtains to be played or The audio frequency parameter of the audio file of broadcasting.Default application scenarios are application scenarios relevant to audio file is played.
In a kind of possible embodiment, developer is in development goal application program, for may need to carry out The scene that system resource is distributed rationally, scene list of the setting comprising at least one default application scenarios.Schematically, for sound Frequency broadcast message class application program may include: that audio account logs in scene, audio main interface scene, audio money in the scene list Source more new scene, audio play scene etc..
Destination application (establishes connection by SDK and operating system) in the process of running, i.e. detection current application Whether scene belongs to the scene list, if belonging to, destination application obtains the sound of the audio file under current Run-time scenario Frequency parameter;If being not belonging to, destination application continues to monitor current application scene, without obtaining audio frequency parameter.Wherein, the sound Frequency parameter includes the index parameter relevant to the audio quality of audio file that operating system can not be got.
Optionally, audio frequency parameter include in file size, format information, compression ratio and the sample frequency of audio file extremely Few one kind.
Optionally, destination application obtains the attribute information of audio file, and attribute information includes the file of audio file Size and/or format information.
Optionally, destination application reads the header information of audio file, and audio file is obtained from header information Compression ratio and/or sample frequency.
Step 802, destination application sends audio frequency parameter to operating system by the API for calling SDK to provide.
After destination application gets the audio frequency parameter of audio file, by the API for calling SDK to provide, by audio Parameter is sent to operating system.
Optionally, destination application is detecting after default application scenarios, persistently obtains the audio of audio file Parameter, and continue to send the audio frequency parameter got to operating system.
Optionally, for the audio frequency parameter got, destination application also needs to carry out data preparation to it, for example closes And duplicate message, deletion redundancy.Meanwhile destination application can also be according to the important journey of application scenarios or audio frequency parameter Degree, is arranged the transmission priority of audio frequency parameter, to preferentially send the audio frequency parameter or important audio ginseng under important application scene Number (such as compression ratio and sample frequency), filtering or delay send the audio frequency parameter under insignificant application scenarios.
Optionally, further include in the audio frequency parameter obtain audio frequency parameter when timestamp, according to the timestamp, operating system It can determine whether audio frequency parameter sends in time, and determine the transmission timing of audio frequency parameter, so that it is super to avoid audio frequency parameter from sending When and the reverse problem of transmission timing.
It should be noted that in actual application, other information can also be carried in the audio frequency parameter according to demand, For example application program identification, the embodiment of the present application are not defined the specifying information for including in audio frequency parameter.
Optionally, destination application sends audio frequency parameter in the form of data packet, and the format of data packet in advance with Operating system is arranged.Wherein, the format of data packet can be java script object tag (JavaScript Object Notation, JSON), agreement buffer area (ProtocolBuffer, Protobuf) or user-defined format etc..
Step 803, operating system receives the audio frequency parameter that destination application is sent.
In a kind of possible embodiment, after operating system receives the data packet of destination application transmission, use The data packet format made an appointment parses the data packet, to obtain audio frequency parameter wherein included.
Step 804, operating system determines target resource configuration parameter, target resource configuration according at least one audio frequency parameter Parameter includes the resource type and resource quantity of system resource.
Optionally, operating system is at least one audio frequency parameter got (for example, the file size of audio file, lattice At least one of formula information, compression ratio and sample frequency) it is analyzed, determine target required when the audio file plays Resource configuration parameter, the target resource configuration parameter are used to indicate the system resource performance required when the audio file plays.
Optionally, the resource type of system resource is the resource type of system hardware resources.Schematically, system resource Resource type includes cpu resource, data-direction register (Data Direction Register, DDR) resource, Embedded Multimedia storage card (Embedded Multi Media Card, eMMC) resource, Common Flash Memory store (Universal Flash Storage, UFS) resource, at least one of audio signal processor (Audio Signal Processor, ASP) resource system Hardware resource.
Schematically, when the resource type of system resource is cpu resource, the corresponding resource quantity of system resource includes At least one of core cpu quantity, cpu frequency and CPU voltage.When system resource resource type be memory source (for example, DDR resource, eMMC resource or UFS resource) when, the corresponding resource quantity of system resource includes memory bandwidth and/or memory frequency Rate.When the resource type of system resource is ASP resource, the corresponding resource quantity of system resource includes ASP frequency.
Optionally, operating system analyzes at least one audio frequency parameter of audio file, obtains playing audio text Required data processing amount when part obtains target resource configuration parameter corresponding with data processing amount according to third corresponding relationship. In one possible implementation, the third corresponding relationship between data processing amount per second and target resource configuration parameter is such as Shown in table one.
Table one
Schematically, destination application is audio broadcast message class application program, and destination application runs to audio and broadcasts When putting scene, the audio frequency parameter of audio file being played on is obtained, audio frequency parameter includes format information (CD format), sampling frequency Rate (44.1KHz), rate 1411K/ seconds and 16 quantization digits, and it is sent to operating system.Operating system is according at least one It is 1411K*16/1024=2.756M/s that audio frequency parameter, which calculates data processing amount per second when playing the audio file, according to The third corresponding relationship that table one provides obtains target resource configuration parameter corresponding with data processing amount are as follows: cpu resource (CPU core Calculation amount is that 3, CPU voltage is 765mV), DDR resource (memory bandwidth 2.7GBps), (clocked memory is eMMC resource 166MHz)。
Schematically, destination application obtains the audio frequency parameter of audio file being played on, and audio frequency parameter includes sound The file size (10MB) and compression ratio (1:5) of frequency file, and it is sent to operating system.Operating system is according at least one sound Frequency parameter determines that the actual file size after audio file decompression is 50MB, if data processing amount per second is 1MB/s, The processing time needed is 50s, i.e. performance boost duration is determined as 50s by operating system.
Step 805, if Current resource configuration parameter miss the mark resource configuration parameter, operating system is according to current money Source configuration parameter and target resource configuration parameter determine that first resource configuration strategy, first resource configuration strategy are used to indicate up-regulation System resource performance.
Optionally, if Current resource configuration parameter miss the mark resource configuration parameter, operating system determine that target is answered Audio quality when playing the audio file with program is bad, needs optimization system resource distribution;If Current resource configuration parameter Reach target resource configuration parameter, then operating system determines that audio quality when destination application plays the audio file is good It is good, it is not necessarily to optimization system resource distribution.
Optionally, if Current resource configuration parameter miss the mark resource configuration parameter, operating system determine in resource Tune amount.Operating system obtains the first resource configuration for being used to indicate up-regulation system resource performance according to the resource up-regulation amount determined Strategy.First resource configuration strategy includes resource up-regulation amount.
For the method for determination of resource up-regulation amount, in a kind of possible embodiment, which is fixed value, After the every progress of operating system is once raised, i.e. whether the current resource configuration parameter of detection destination application reaches target resource Configuration parameter stops raising if reaching, if not up to, continuing to raise according to resource up-regulation amount.
In other possible embodiments, if Current resource configuration parameter miss the mark resource configuration parameter, is grasped Make system to determine the absolute difference between the corresponding Current resource quantity of system resource to be adjusted and target resource quantity For resource up-regulation amount.
In a schematical example, destination application is audio broadcast message class application program, and destination application When operation to audio plays scene, the audio frequency parameter of audio file being played on is obtained, and audio frequency parameter is sent to operation System.Operating system determines target resource configuration parameter according at least one audio frequency parameter, target resource configuration parameter be based on The exemplary target resource configuration parameter of step 804 " cpu resource (core cpu quantity is that 3, CPU voltage is 765mV), DDR resource (memory bandwidth 2.7GBps), eMMC resource (clocked memory 166MHz) ".If the cpu resource in Current resource configuration parameter Miss the mark resource configuration parameter, then operating system determines need according to Current resource configuration parameter and target resource configuration parameter The system resource to be optimized is cpu resource, determines first resource configuration strategy are as follows: increases and enables 1 core cpu, by CPU voltage Increase to 765mV.
Step 806, operating system is carried out according to the system resource that first resource configuration strategy distributes audio file It adjusts.
Further, operating system is destination application distribution system money according to the first resource configuration strategy determined Source, thus by way of optimization system resource distribution, so that destination application reaches during playing audio file Expected audio quality.
Optionally, the audio frequency parameter for the audio file that destination application is sent to operating system is in addition to including and audio text The relevant operating parameter of the audio quality of part, the audio frequency parameter of the audio file further include unrelated with the audio quality of audio file Operating parameter, therefore in order to guarantee destination application play audio file audio quality under the premise of, reduce terminal Power consumption, in a kind of possible embodiment, operating system lower operating parameter correspondence system resource performance.
Optionally, operating system obtain operating parameter object run index, when operating parameter be better than object run index, Then operating system determines the corresponding second goal systems resource of object run index.Operating system is according to the second goal systems resource Determine that Secondary resource configuration strategy, Secondary resource configuration strategy are to be used to indicate the strategy for lowering system resource performance.
Schematically, object run index includes that frame per second index, frame loss rate index, downloading rate index and network delay refer to At least one of mark.
Optionally, when operating parameter unrelated with audio quality in destination application is better than (being more than) object run index When, operating system is determined to lower the performance of corresponding system resource;When operating parameter is lower than object run index, operation system System determines the performance for needing to raise corresponding system resource.
It optionally, further include system resource downward amount in the Secondary resource configuration strategy that operating system is determined.
It is stored in operating system in a kind of possible embodiment for the method for determination of system resource downward amount The corresponding goal systems resource performance index of object run index, when the current operating parameter of destination application is better than to target When operating index, operating system is determined under system resource according to current system resource performance and goal systems resource performance index Tune amount, so that system resource performance is equal to goal systems resource performance index after lowering.
Schematically, the Secondary resource optimisation strategy that operating system is determined are as follows: close 1 GPU core.
Further, operating system is destination application distributing system resource according to Secondary resource configuration strategy, thus By way of optimization system resource distribution, reducing part does not influence the performance of system resource of audio quality, has reached reduction The effect of power consumption of terminal.
In the present embodiment, operating system is directed to the operating parameter by determining the operating parameter unrelated with audio quality It formulates corresponding system resource performance and lowers strategy, guaranteeing the same of the audio quality of destination application broadcasting audio file When, further decrease the power consumption of terminal.
In one possible implementation, the audio frequency parameter of audio file includes the file size of audio file, above-mentioned It further include the following steps after step 803, as shown in Figure 9:
Step 901, operating system obtains preloading data length corresponding with file size according to the first corresponding relationship, First corresponding relationship includes the corresponding relationship between file size and preloading data length.
The first corresponding relationship is stored in terminal.Operating system is obtained according to the first corresponding relationship of storage and audio file The corresponding preloading data length of file size.
Optionally, if file size is greater than the first parameter threshold and less than the second parameter threshold, operating system determines pre- Load data length is the first preloading data length, and the second parameter threshold is greater than the first parameter threshold;If file size is greater than Or being equal to the second parameter threshold, then operating system determines that preloading data length is the second preloading data length, and second is pre- Data length is loaded less than the first preloading data length.
Optionally, if file size is less than or the first parameter threshold, then it represents that the audio file is smaller, and operating system is not It needs to preload it, corresponding preloading data length is zero.Preloading data length can be total with audio file is accounted for Long percentage indicates.
First parameter threshold and the second parameter threshold are terminal default setting or the customized setting of user.Than Such as, when file size includes file size, the first parameter threshold is 100M, and the second parameter threshold is 2G.
Optionally, the file size of audio file and preloading data length negative correlation.The file of audio file Size is bigger, and preloading data length is smaller.
In one possible implementation, first pair between the file size of audio file and preloading data length It should be related to as shown in Table 2.It indicates that the audio file is smaller when the file size of audio file is less than or equal to 100M, grasps It does not need to preload it as system, corresponding preloading data length is 0;When the file size of audio file is greater than Indicate that the audio file is larger when 100M, operating system needs to preload it, and corresponding preloading data length is 80%;It indicates that the file size of the audio file is very big when the file size of audio file is more than or equal to 2G, operates System needs repeatedly to preload audio file, and corresponding preloading data length is 20%.
Table two
File size Preloading data length (percentage for accounting for audio file overall length)
[0,100M] 0
(100M, 2G) 80%
[2G ,+∞) 20%
Step 902, operating system preloads the audio data in audio file with preloading data length.
If audio file is audio file to be played, operating system in audio file from initial position is played to the The audio data of one loading position is preloaded, and the first loading position and the absolute difference for playing initial position are to preload Data length.
If audio file be audio file being played on, operating system in audio file from current play position to The audio data of second loading position is preloaded, and the absolute difference of the second loading position and current play position is pre-add Carry data length.
In a schematical example, operating system receives the audio file to be played that destination application is sent Audio frequency parameter, audio frequency parameter include the file size " 380M " of audio file, operating system provided according to above-mentioned table two first Corresponding relationship obtains preloading data length " 80% " corresponding with file size " 380M ", and operating system is in audio file 80% audio data is preloaded.
In conclusion the embodiment of the present application is by operating system according to the first corresponding relationship, the text of acquisition and audio file The corresponding preloading data length of part size, operating system in audio file with preloading data length audio data into Row preloads;So that audio file biggish for file size, operating system can preload the audio file, avoid by In audio data transmission delay leads to audio Caton the problem of, the play quality of audio file is further improved.
In alternatively possible implementation, when the audio frequency parameter of audio file includes the compression ratio of audio file, It further include the following steps after above-mentioned steps 803, as shown in Figure 10:
Step 903, operating system obtains pre-decode data length corresponding with compression ratio according to the second corresponding relationship, the Two corresponding relationships include the corresponding relationship between compression ratio and pre-decode data length.
The second corresponding relationship is stored in terminal.In one possible implementation, if compression ratio is less than the first compression Threshold value and be greater than the second compression threshold, then operating system determine pre-decode data length be the first pre-decode data length, second Compression threshold is less than the first compression threshold;If compression ratio is less than or equal to the second compression threshold, operating system determines pre- solution Code data length is the second pre-decode data length, and the second pre-decode data length is less than the first pre-decode data length.
Compression ratio is the ratio between the file size after compressing audio files and file size before the compressing audio files.Compression Than smaller, indicate that the compression degree of the audio file is higher, i.e. decompression time needed for the audio file is longer.
Optionally, if compression ratio is more than or equal to the first compression threshold, then it represents that operating system does not need to carry out it Pre decoding, corresponding pre-decode data length is zero.Pre-decode data length can be indicated with percentage.
First compression threshold and the second compression threshold are terminal default setting or the customized setting of user.Than Such as, the first compression threshold is 1/5, and the second parameter threshold is 1/20.
Optionally, the compression ratio of audio file and pre-decode data length correlation.The compression ratio of audio file Smaller, pre-decode data length is smaller.
In one possible implementation, first between the compression ratio of audio file and pre-decode data length is corresponding Relationship is as shown in Table 3.If compression ratio is more than or equal to 1/5, then it represents that the compression degree of the audio file is lower, operation system System does not need to carry out it pre decoding, and corresponding pre-decode data length is 0;If compression ratio is less than 1/5 and is greater than 1/20, table Show that the compression degree of the audio file is higher, corresponding pre-decode data length is 50%;If compression ratio is less than or equal to 1/ 20, then it represents that the compression degree of the audio file is very high, and corresponding pre-decode data length is 30%.
Table three
Compression ratio Pre-decode data length (percentage for accounting for audio file overall length)
[1/5,1) 0
(1/20,1/5) 50%
(- ∞, 1/20] 30%
Step 904, operating system carries out pre decoding to the audio data in audio file with pre-decode data length.
If audio file is audio file to be played, operating system in audio file from initial position is played to the The audio data of one decoded positions carries out pre decoding, and the first decoded positions and the absolute difference for playing initial position are pre decoding Data length.
If audio file be audio file being played on, operating system in audio file from current play position to The absolute difference of the audio data progress pre decoding of second decoded positions, the second decoded positions and current play position is pre- solution Code data length.
In a schematical example, operating system receives the audio file to be played that destination application is sent Audio frequency parameter, audio frequency parameter include the compression ratio " 1/8 " of audio file, and operating system is corresponded to according to second that above-mentioned table three provides Relationship, obtains corresponding with compression ratio " 1/8 " pre-decode data length " 50% ", operating system in audio file 50% sound Frequency is according to progress pre decoding.
It should be noted that preloading scheme, step 903 and step 904 provided by step 901 and step 902 are mentioned System resource allocation plan provided by the pre decoding scheme and step 804 to step 806 of confession is three schemes arranged side by side, this Three schemes may be performed simultaneously, and can also successively execute.These three schemes can select an execution, also can choose two of them Scheme executes.Whether the present embodiment executes these three schemes, and the sequencing of execution is not limited.
In conclusion the embodiment of the present application passes through operating system according to the second corresponding relationship, obtain corresponding with compression ratio Pre-decode data length, operating system carry out pre decoding to the audio data in audio file with pre-decode data length, Sound intermediate frequency parameter includes the compression ratio of audio file;So that audio file lesser for compression ratio, operating system can solve in advance The audio file is pressed, avoids due to the decompression duration of audio file longer the problem of leading to audio Caton, further improves The play quality of audio file.
Due to that may install and run the application program of multiple embedded SDK in terminal, and operating system may simultaneously with Multiple application programs establish connection.In order to guarantee the running quality of foreground application, in a kind of possible embodiment, behaviour Make the foreground application mark that system obtains foreground application.The application identities and foreground application of operating system detection destination application It identifies whether consistent.If the application identities of destination application and foreground application mark are consistent, operating system is executed according to extremely A step of few audio frequency parameter determines target resource configuration parameter.If the application identities of destination application and foreground application mark Know inconsistent, operating system is then not responding to audio frequency parameter.
Optionally, destination application is while sending audio frequency parameter to operating system, also by destination application Application identities are sent to operating system.Corresponding, operating system receives the application identities that destination application is sent.
In one possible implementation, as shown in figure 4, being built between application framework layer 250 and interface communication systems 242 Vertical to have Binder connection, operating system obtains foreground application information from application framework layer 250, is in the foreground application information It is identified comprising foreground application.
After getting foreground application mark, operating system is to detect the application identities and foreground application mark of destination application Whether knowledge is consistent, if the two is consistent, it is determined that send the destination application of audio frequency parameter just in front stage operation, thereby executing behaviour Make the step of system determines target resource configuration parameter according at least one audio frequency parameter;If the two is inconsistent, it is determined that send The destination application of audio frequency parameter executes the step of operating system is not responding to audio frequency parameter in running background.
When destination application is not in front stage operation, operating system is then not responding to the audio frequency parameter of destination application transmission (continuing to the connection between destination application), and the audio frequency parameter that preferential answering foreground application is sent.
Further, when the destination application for operating in foreground switches to backstage, destination application stops to behaviour Make system and sends audio frequency parameter.
Optionally, in order to avoid long-time occupies the data channel between operating system, destination application is by foreground When operation switches to running background, it is automatically stopped to operating system and sends audio frequency parameter, and maintain the company between operating system It connects.
Logical foreground application testing mechanism is increased in the present embodiment, in operating system, realizes the target of only front stage operation Application providing system optimizing resource allocation service.
Following is the application Installation practice, can be used for executing the application embodiment of the method.It is real for the application device Undisclosed details in example is applied, the application embodiment of the method is please referred to.
Figure 11 is please referred to, it illustrates the structural schematic diagrams for the device for allocating resources that the application one embodiment provides.It should Device for allocating resources can by special hardware circuit, alternatively, software and hardware be implemented in combination with as the terminal in Fig. 1 whole or A part, the device for allocating resources include: operating system module 1120 and the destination application mould for playing audio file Block 1110.
Destination application module 1110 sends audio to operating system module for the API by calling SDK to provide The audio frequency parameter of file, audio frequency parameter include parameter relevant to the audio quality of audio file;
Operating system module 1120, for receiving the audio frequency parameter of destination application module transmission;
Operating system module 1120 is also used to determine that resource allocation strategy, resource allocation strategy are mesh according to audio frequency parameter Mark the strategy of distributing system resource when application program module plays audio file;
Operating system module 1120 is also used to according to resource allocation strategy be audio file distributing system resource.
Optionally, destination application module 1110 is also used to obtain audio file to be played or being played on Audio frequency parameter, audio frequency parameter include at least one in file size, format information, compression ratio and the sample frequency of audio file Kind;By the API for calling SDK to provide, audio frequency parameter is sent to operating system module 1120.
Optionally, operating system module 1120 are also used to determine target resource configuration ginseng according at least one audio frequency parameter Number, target resource configuration parameter includes the resource type and resource quantity of system resource;If Current resource configuration parameter is not up to Target resource configuration parameter then determines that first resource configures plan according to Current resource configuration parameter and target resource configuration parameter Slightly, first resource configuration strategy is used to indicate up-regulation system resource performance;
Operating system module 1120 is also used to the system resource distributed according to first resource configuration strategy audio file It is raised.
Optionally, the resource type of system resource include cpu resource, DDR resource, eMMC resource, UFS card resource, at ASP Manage at least one of device resource system hardware resources.
Optionally, the audio frequency parameter of audio file includes the file size of audio file, and operating system module 1120 is also used According to the first corresponding relationship, preloading data length corresponding with audio frequency parameter is obtained, the first corresponding relationship includes audio ginseng Corresponding relationship between several and preloading data length;Audio data in audio file with preloading data length is carried out It preloads.
Optionally, operating system module 1120, if being also used to audio frequency parameter greater than the first parameter threshold and less than the second ginseng Number threshold value, it is determined that preloading data length is the first preloading data length, and the second parameter threshold is greater than the first parameter threshold; If audio frequency parameter is more than or equal to the second parameter threshold, it is determined that preloading data length is the second preloading data length, Second preloading data length is less than the first preloading data length.
Optionally, the audio frequency parameter of audio file includes the compression ratio of audio file, and operating system module 1120 is also used to According to the second corresponding relationship, obtain pre-decode data length corresponding with compression ratio, the second corresponding relationship include compression ratio in advance Corresponding relationship between decoding data length;Audio data in audio file with pre-decode data length is solved in advance Code.
Optionally, operating system module 1120, if being also used to compression ratio less than the first compression threshold and being greater than the second compression Threshold value, it is determined that pre-decode data length is the first pre-decode data length, and the second compression threshold is less than the first compression threshold;If Compression ratio be less than or equal to the second compression threshold, it is determined that pre-decode data length be the second pre-decode data length, second Pre-decode data length is less than the first pre-decode data length.
Optionally, the audio frequency parameter of audio file further includes the operating parameter unrelated with the audio quality of audio file;Behaviour Make system module 1120, is also used to obtain the object run index of operating parameter;When operating parameter be better than object run index, then Determine the corresponding second goal systems resource of object run index;Determine that Secondary resource configures plan according to the second goal systems resource Slightly, Secondary resource configuration strategy is to be used to indicate the strategy for lowering system resource performance.
Correlative detail is in combination with reference to Fig. 7 to embodiment of the method shown in Fig. 10.Wherein, operating system module 1110 is also used In realizing the relevant function of any other implicit or disclosed step as performed by operating system in above method embodiment;Mesh Mark application program module 1120 is also used to realize any other implicit or disclosed by target application journey in above method embodiment The relevant function of step performed by sequence.
It should be noted that device provided by the above embodiment, when realizing its function, only with above-mentioned each functional module It divides and carries out for example, can according to need in practical application and be completed by different functional modules above-mentioned function distribution, The internal structure of equipment is divided into different functional modules, to complete all or part of the functions described above.In addition, Apparatus and method embodiment provided by the above embodiment belongs to same design, and specific implementation process is detailed in embodiment of the method, this In repeat no more.
The application also provides a kind of computer-readable medium, is stored thereon with program instruction, and program instruction is held by processor The resource allocation method that above-mentioned each embodiment of the method provides is realized when row.
Present invention also provides a kind of computer program products comprising instruction, when run on a computer, so that Computer executes resource allocation method described in above-mentioned each embodiment.
Above-mentioned the embodiment of the present application serial number is for illustration only, does not represent the advantages or disadvantages of the embodiments.
Those of ordinary skill in the art will appreciate that completely or partially being walked in the resource allocation method of realization above-described embodiment Suddenly may be implemented by hardware, relevant hardware can also be instructed to complete by program, the program can store in In a kind of computer readable storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..More than Described is only that the preferred embodiment of the application within the spirit and principles of this application, is made not to limit the application Any modification, equivalent substitution, improvement and etc., should be included within the scope of protection of this application.

Claims (12)

1. a kind of resource allocation method, which is characterized in that the method be applied to terminal, the terminal operating have operating system and For playing the destination application of audio file, which comprises
The destination application is by the application programming interface API that calls Software Development Kit SDK to provide, to described Operating system sends the audio frequency parameter of the audio file, and the audio frequency parameter includes the audio quality phase with the audio file The parameter of pass;
The operating system receives the audio frequency parameter that the destination application is sent;
The operating system determines that resource allocation strategy, the resource allocation strategy are that the target is answered according to the audio frequency parameter The strategy of distributing system resource when playing the audio file with program;
The operating system is that the audio file distributes the system resource according to the resource allocation strategy.
2. the method according to claim 1, wherein the destination application is by calling SDK to provide API sends the audio frequency parameter of the audio file to the operating system, comprising:
The destination application obtains the audio frequency parameter of the audio file to be played or being played on, the audio ginseng Number includes at least one of file size, format information, compression ratio and the sample frequency of the audio file;
The destination application sends the audio frequency parameter to the operating system by the API for calling the SDK to provide.
3. according to the method described in claim 2, it is characterized in that, the operating system determines resource according to the audio frequency parameter Configuration strategy, comprising:
The operating system determines target resource configuration parameter, the target resource configuration according at least one audio frequency parameter Parameter includes the resource type and resource quantity of the system resource;
If Current resource configuration parameter is not up to the target resource configuration parameter, the operating system is according to the current money Source configuration parameter and the target resource configuration parameter determine that first resource configuration strategy, the first resource configuration strategy are used for Instruction up-regulation system resource performance;
The operating system is that the audio file distributes the system resource according to the resource allocation strategy, comprising:
The system resource that the operating system distributes the audio file according to the first resource configuration strategy into Row up-regulation.
4. according to the method described in claim 3, it is characterized in that,
The resource type of the system resource includes central processor CPU resource, data-direction register DDR resource, embedded Multimedia storage card eMMC resource, Common Flash Memory storage UFS card resource, at least one of audio signal processor ASP resource System hardware resources.
5. the method according to claim 1, wherein the audio frequency parameter of the audio file includes the audio text The file size of part, the method also includes:
The operating system obtains preloading data length corresponding with the file size according to the first corresponding relationship, described First corresponding relationship includes the corresponding relationship between the file size and the preloading data length;
The operating system preloads the audio data in the audio file with the preloading data length.
6. according to the method described in claim 5, it is characterized in that, the operating system according to the first corresponding relationship, obtain with The corresponding preloading data length of the file size, comprising:
If the file size is greater than the first parameter threshold and less than the second parameter threshold, the operating system determines described pre- Load data length is the first preloading data length, and second parameter threshold is greater than the first parameter threshold;
If the file size is more than or equal to second parameter threshold, the operating system determines the preloading number It is the second preloading data length according to length, the second preloading data length is less than the first preloading data length.
7. the method according to claim 1, wherein the audio frequency parameter of the audio file includes the audio text The compression ratio of part, the method also includes:
The operating system obtains pre-decode data length corresponding with the compression ratio according to the second corresponding relationship, and described the Two corresponding relationships include the corresponding relationship between the compression ratio and the pre-decode data length;
The operating system carries out pre decoding to the audio data in the audio file with the pre-decode data length.
8. the method according to the description of claim 7 is characterized in that the operating system according to the second corresponding relationship, obtain with The corresponding pre-decode data length of the compression ratio, comprising:
If the compression ratio is less than the first compression threshold and is greater than the second compression threshold, the operating system determines the pre- solution Code data length is the first pre-decode data length, and second compression threshold is less than the first compression threshold;
If the compression ratio is less than or equal to second compression threshold, the operating system determines the pre-decode data Length is the second pre-decode data length, and the second pre-decode data length is less than the first pre-decode data length.
9. method according to any one of claims 1 to 8, which is characterized in that the audio frequency parameter of the audio file further includes The operating parameter unrelated with the audio quality of the audio file;The method also includes:
The operating system obtains the object run index of the operating parameter;
When the operating parameter is better than the object run index, the operating system then determines that the object run index is corresponding The second goal systems resource;
The operating system determines Secondary resource configuration strategy, the Secondary resource configuration according to the second goal systems resource Strategy lowers the strategy of system resource performance to be used to indicate.
10. a kind of device for allocating resources, which is characterized in that described device includes operating system module and for playing audio file Destination application module, described device includes:
The destination application module, for the application programming interface by calling Software Development Kit SDK to provide API, the audio frequency parameter of the audio file is sent to the operating system module, and the audio frequency parameter includes and the audio text The relevant parameter of the audio quality of part;
The operating system module, the audio frequency parameter sent for receiving the destination application module;
The operating system module is also used to determine resource allocation strategy, the resource allocation strategy according to the audio frequency parameter The strategy of distributing system resource when playing the audio file for the destination application module;
The operating system module is also used to be that the audio file distributes the system money according to the resource allocation strategy Source.
11. a kind of terminal, which is characterized in that the terminal includes processor, the memory that is connected with the processor, Yi Jicun The program instruction on the memory is stored up, the processor is realized when executing described program instruction as claim 1 to 9 is any The resource allocation method.
12. a kind of computer readable storage medium, which is characterized in that be stored thereon with program instruction, described program instruction is located Reason device realizes resource allocation method as described in any one of claim 1 to 9 when executing.
CN201811122144.9A 2018-09-26 2018-09-26 Resource allocation method, device, terminal and storage medium Pending CN109240833A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201811122144.9A CN109240833A (en) 2018-09-26 2018-09-26 Resource allocation method, device, terminal and storage medium
PCT/CN2019/094724 WO2020063008A1 (en) 2018-09-26 2019-07-04 Resource configuration method and apparatus, terminal, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811122144.9A CN109240833A (en) 2018-09-26 2018-09-26 Resource allocation method, device, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN109240833A true CN109240833A (en) 2019-01-18

Family

ID=65056723

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811122144.9A Pending CN109240833A (en) 2018-09-26 2018-09-26 Resource allocation method, device, terminal and storage medium

Country Status (2)

Country Link
CN (1) CN109240833A (en)
WO (1) WO2020063008A1 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110270096A (en) * 2019-06-19 2019-09-24 杭州绝地科技股份有限公司 Audio resource configuration method, device, equipment and storage medium in game application
WO2020063008A1 (en) * 2018-09-26 2020-04-02 Oppo广东移动通信有限公司 Resource configuration method and apparatus, terminal, and storage medium
CN111294551A (en) * 2020-02-25 2020-06-16 广州华多网络科技有限公司 Method, device and equipment for audio and video transmission and storage medium
CN111580776A (en) * 2020-04-28 2020-08-25 广州市百果园信息技术有限公司 Audio function recovery method, device, terminal and storage medium
CN112948003A (en) * 2019-11-26 2021-06-11 成都鼎桥通信技术有限公司 Method and equipment for switching operating systems of dual-android terminal
CN114760283A (en) * 2022-03-03 2022-07-15 阿里巴巴(中国)有限公司 Playing parameter configuration method and device

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112770184B (en) * 2020-12-24 2023-03-24 上海掌门科技有限公司 Method and equipment for providing video resources

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107515787A (en) * 2017-08-31 2017-12-26 广东欧珀移动通信有限公司 Resource allocation method and Related product
CN107577536A (en) * 2017-08-31 2018-01-12 广东欧珀移动通信有限公司 Optimizing application method and Related product
CN107589998A (en) * 2017-08-31 2018-01-16 广东欧珀移动通信有限公司 Resource allocation method and Related product
CN108521608A (en) * 2018-03-13 2018-09-11 Oppo广东移动通信有限公司 Processing method, device, terminal and the storage medium of video file

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630518A (en) * 2014-10-28 2016-06-01 北京娜迦信息科技发展有限公司 Method and device for updating resources of Android application software
US20160127255A1 (en) * 2014-10-30 2016-05-05 Diana Cobb Method and system for capacity planning of system resources
CN104333808B (en) * 2014-11-14 2017-10-10 复旦大学 For the universal player on Android and Linux smart television machine
CN109240833A (en) * 2018-09-26 2019-01-18 Oppo广东移动通信有限公司 Resource allocation method, device, terminal and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107515787A (en) * 2017-08-31 2017-12-26 广东欧珀移动通信有限公司 Resource allocation method and Related product
CN107577536A (en) * 2017-08-31 2018-01-12 广东欧珀移动通信有限公司 Optimizing application method and Related product
CN107589998A (en) * 2017-08-31 2018-01-16 广东欧珀移动通信有限公司 Resource allocation method and Related product
CN108521608A (en) * 2018-03-13 2018-09-11 Oppo广东移动通信有限公司 Processing method, device, terminal and the storage medium of video file
CN108536461A (en) * 2018-03-13 2018-09-14 Oppo广东移动通信有限公司 Resource regeneration method, device, terminal and storage medium
CN108536524A (en) * 2018-03-13 2018-09-14 Oppo广东移动通信有限公司 Resource regeneration method, device, terminal and storage medium

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020063008A1 (en) * 2018-09-26 2020-04-02 Oppo广东移动通信有限公司 Resource configuration method and apparatus, terminal, and storage medium
CN110270096A (en) * 2019-06-19 2019-09-24 杭州绝地科技股份有限公司 Audio resource configuration method, device, equipment and storage medium in game application
CN110270096B (en) * 2019-06-19 2022-10-04 杭州绝地科技股份有限公司 Audio resource allocation method, device, equipment and storage medium in game application
CN112948003A (en) * 2019-11-26 2021-06-11 成都鼎桥通信技术有限公司 Method and equipment for switching operating systems of dual-android terminal
CN112948003B (en) * 2019-11-26 2022-07-29 成都鼎桥通信技术有限公司 Method and equipment for switching operating systems of dual-android terminal
CN111294551A (en) * 2020-02-25 2020-06-16 广州华多网络科技有限公司 Method, device and equipment for audio and video transmission and storage medium
CN111294551B (en) * 2020-02-25 2021-06-08 广州华多网络科技有限公司 Method, device and equipment for audio and video transmission and storage medium
CN111580776A (en) * 2020-04-28 2020-08-25 广州市百果园信息技术有限公司 Audio function recovery method, device, terminal and storage medium
CN114760283A (en) * 2022-03-03 2022-07-15 阿里巴巴(中国)有限公司 Playing parameter configuration method and device

Also Published As

Publication number Publication date
WO2020063008A1 (en) 2020-04-02

Similar Documents

Publication Publication Date Title
CN109240833A (en) Resource allocation method, device, terminal and storage medium
CN111240837B (en) Resource allocation method, device, terminal and storage medium
CN109582463B (en) Resource allocation method, device, terminal and storage medium
US10014030B2 (en) Method, device and system for playing video
CN108900855B (en) Live content recording method and device, computer readable storage medium and server
CN103905835A (en) Progress preview method, device and system for video player
CN108769816B (en) Video playing method, device and storage medium
CN109379548A (en) Multi-media recording method, apparatus, terminal and storage medium
CN109522131A (en) Resource allocation method, device and equipment
CN103915033A (en) Method and apparatus for rendering map, and mobile terminal
CN104615432B (en) Splash screen information processing method and client
CN109683760B (en) Recent content display method, device, terminal and storage medium
US20230412723A1 (en) Method and apparatus for generating imagery record, electronic device, and storage medium
CN112565870A (en) Content caching and reading method, client and storage medium
CN112291602B (en) Video playing method, electronic equipment and storage medium
CN114339308A (en) Video stream loading method, electronic equipment and storage medium
CN108989703B (en) Memory video creating method and related device
CN110913384A (en) Dial card switching method and device, storage medium and terminal
WO2024113999A1 (en) Game management method and terminal device
CN107800618B (en) Picture recommendation method and device, terminal and computer-readable storage medium
KR20170019819A (en) Electronic device and method for playing moving image
CN116456131A (en) Special effect rendering method and device, electronic equipment and storage medium
CN116957671A (en) Interactive content display method, interactive popularization page configuration method and device
CN113420246A (en) Processing method and device for page transition animation and electronic equipment
CN110321453A (en) Display methods, device, readable storage medium storing program for executing and the system of radio channels cover

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190118