WO2019071680A1 - Plug-in loading method and apparatus - Google Patents

Plug-in loading method and apparatus Download PDF

Info

Publication number
WO2019071680A1
WO2019071680A1 PCT/CN2017/109671 CN2017109671W WO2019071680A1 WO 2019071680 A1 WO2019071680 A1 WO 2019071680A1 CN 2017109671 W CN2017109671 W CN 2017109671W WO 2019071680 A1 WO2019071680 A1 WO 2019071680A1
Authority
WO
WIPO (PCT)
Prior art keywords
plug
master
loading
encoding
plugin
Prior art date
Application number
PCT/CN2017/109671
Other languages
French (fr)
Chinese (zh)
Inventor
杨亮
陈少杰
张文明
Original Assignee
武汉斗鱼网络科技有限公司
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 武汉斗鱼网络科技有限公司 filed Critical 武汉斗鱼网络科技有限公司
Publication of WO2019071680A1 publication Critical patent/WO2019071680A1/en

Links

Images

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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method and apparatus for loading a plug-in.
  • Webcasting has gradually become a mainstream entertainment and communication method in modern life.
  • all run in a single-process mode that is, all the functions of the program are integrated in one process.
  • the single-process mode has the advantages of simple architecture and convenient maintenance, it has low stability. For example, if a plug-in has a problem, it may cause the entire process to crash and must be solved by restarting the program.
  • the prior art has a technical problem of how to improve the running stability of the live broadcast program on the anchor end.
  • the embodiment of the invention provides a method and a device for loading a plug-in, at least for solving the technical problem of how to improve the running stability of a live broadcast program on the anchor end.
  • the present invention provides a method for loading a plug-in, including:
  • the master process creates a plug-in loading process
  • the plug-in loading process loads a target plug-in that needs to be loaded in the live application in the plug-in loading process.
  • the method further includes:
  • the master process creates a plugin enumerator process
  • the plug-in enumerator process enumerates, to the master process, an alternative plug-in that exists in the current load directory and can be loaded;
  • the master process determines to determine the target plugin from the candidate plugin, and notifies the plugin to load the target plugin.
  • the master process creates a plug-in enumerator process, including:
  • the master process calls a process creation function
  • the master process sends the ID of the master process to the process creation function
  • the master process runs the process creation function to create the plug-in enumerator process, after the plug-in enumerator process is initialized, initializes the process environment, and based on the master control of the process creation function The ID of the process is connected to the master process.
  • the plug-in enumerator process initializes the process environment after the creation is completed, and connects to the master process according to the ID of the master process that the process creation function has, including:
  • the plug-in enumerator process enumerates, to the master process, candidate plug-ins that are present in the current loading directory and can be loaded, including:
  • the plug-in enumerator receives an enumeration instruction sent by the master control process, and invokes the enumeration plug-in function process to read all plug-ins in the loading directory;
  • the method further includes:
  • the master process sends an exit instruction to the plug-in enumerator process
  • the plug-in enumerator invokes the enumeration exit function to end the process based on the exit instruction.
  • the method further includes:
  • the master process monitors whether the plug-in loading process crashes
  • the present invention provides a device for loading a plug-in, comprising:
  • a startup unit configured to start a live broadcast application of the anchor
  • a master control process acquiring unit configured to acquire a master control process of the live broadcast application of the anchor end
  • a plug-in loading unit configured to load a target plug-in that needs to be loaded in the live application during the plug-in loading process.
  • the process creation unit is further configured to create a plug-in enumerator process before loading the target plug-in that needs to be loaded in the live application in the plug-in loading process;
  • the device further includes a plug-in enumeration unit, configured to enumerate, to the master process, an optional plug-in existing in the current loading directory and loadable;
  • a determining unit configured to determine that the target plugin is determined from the candidate plugin, and notify the plugin to load the target plugin.
  • the process creation unit is configured to invoke a process creation function, and send the ID of the master process to the process creation function, and run the process creation function to create the plug-in enumerator process, the plug-in After the creation of the enumerator process, the process environment is initialized, and the master process is connected based on the ID of the master process that the process creation function has.
  • the device further includes a plug-in loading process environment initial unit, configured to initialize a process environment after the plug-in enumerator process is created, and based on the master process of the process creation function
  • the ID is connected to the master process, and is specifically configured to register an enumeration plug-in function and an enumeration exit function in the plug-in enumerator process, and obtain an ID connection of the master process that is included in the process creation function. Master process.
  • the plug-in enumeration unit is configured to receive an enumeration instruction sent by the master control process, and invoke the enumeration plug-in function process to read all plug-ins in the loading directory; from all the plug-ins The legal plug-in is filtered out; and the backup plug-in supported by the anchor live application is filtered out from the legal plug-in.
  • the device further includes an exit unit, configured to: after the plug-in enumerator process enumerates, to the master process, an optional plug-in that exists in the current loading directory and can be loaded, The applet process sends an exit instruction, and the enumeration exit function is called to end the process based on the exit instruction.
  • an exit unit configured to: after the plug-in enumerator process enumerates, to the master process, an optional plug-in that exists in the current loading directory and can be loaded, The applet process sends an exit instruction, and the enumeration exit function is called to end the process based on the exit instruction.
  • the device further includes a plug-in loading process monitoring unit, configured to monitor whether the plug-in loading process crashes, and re-create the plug-in loading process if the plug-in loading process is detected to crash.
  • a plug-in loading process monitoring unit configured to monitor whether the plug-in loading process crashes, and re-create the plug-in loading process if the plug-in loading process is detected to crash.
  • the invention provides a computer readable storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the method of any of the first aspects.
  • the present invention provides a computer device comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, the processor implementing the program to implement any of the first aspects The steps of the method.
  • the host broadcast application is first started, and the main control process of the live application of the anchor is obtained, and then the main control process further creates a plug-in loading process, and the live loading process needs to be loaded in the plug-in loading process.
  • the target plugin loaded in the application Since the embodiment of the present invention adopts multiple processes and uses the plug-in loading process to load the plug-in, the abnormality of the plug-in function does not affect the master process, so that the program crashes due to one or more abnormal functions, so that the host-side live application is more The system runs stably, thereby solving the technical problem of how to improve the running stability of the live broadcast program on the anchor end in the prior art.
  • FIG. 1 is a flowchart of a method for performing live broadcast according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a device for playing a live broadcast according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
  • the embodiment of the invention provides a method and a device for loading a plug-in, at least for solving the technical problem of how to improve the running stability of a live broadcast program on the anchor end.
  • the host broadcast application is first started, and the main control process of the live application of the anchor is obtained, and then the main control process further creates a plug-in loading process, and the live loading process needs to be loaded in the plug-in loading process.
  • the target plugin loaded in the application Since the embodiment of the present invention adopts multiple processes and uses the plug-in loading process to load the plug-in, the abnormality of the plug-in function does not affect the master process, so that the program crashes due to one or more abnormal functions, so that the host-side live application is more The system runs stably, thereby solving the technical problem of how to improve the running stability of the live broadcast program on the anchor end in the prior art.
  • the first aspect of the present invention provides a method for performing live broadcast.
  • FIG. 1 it is a flowchart of a method for performing live broadcast according to an embodiment of the present invention. The method includes:
  • the master process creates an encoding process and/or a plug-in loading process, where the encoding process is used to encode a video stream based on the control of the master process, and feed back the video stream to the master process.
  • the plug-in loading process is configured to load a plug-in in the plug-in loading process, and invoke the loaded plug-in according to the control of the master process;
  • S104 The master control process acquires the video stream.
  • the master control process sends the video stream to a live broadcast server, so that the live broadcast service The device forwards the video stream to a viewer device accessing the live server.
  • the anchor live application is started in S101.
  • the live broadcast application of the anchor terminal can be installed in a live broadcast application on a host device such as a mobile phone, a tablet computer or a desktop computer, and the present invention does not impose any specific limitation.
  • the following describes an example of a live broadcast application on a desktop computer installed in a Windows system.
  • the master process will create an encoding process and/or a plugin loading process as needed.
  • the encoding process in the embodiment of the present invention is used to encode a video stream based on the control of the master control process, and feed back the video stream to the master control process. More specifically, the encoding process receives the initialization command and the encoding command of the master process for initialization and encoding, and passes the encoded data to the master process.
  • the plugin loading process is used to load the plugin in the plugin loading process and call the loaded plugin according to the control of the master process. More specifically, the plug-in loading process acts as a loader for the anchor application plug-in of the anchor, and loads the original plug-in to be loaded into the host process into the plug-in loading process, so that the master process no longer needs to load the plug-in, and thus This avoids the situation where the master process crashes due to plugin issues.
  • the plug-in loading process in the embodiment of the present invention simulates the environment of the main control process on which the plug-in is loaded and run, and responds to the command from the main control process to obtain an image, obtain audio, and the feedback generated by the plug-in to the main control process. Image and audio, so that the image from the plug-in and the sound can be played normally in the master process.
  • the master process is the main process of the live broadcast application of the anchor, and manages the plug-in loading process and the encoding process. Moreover, if the encoding process is abnormally exited, the master process will automatically re-create the encoding process, so that the encoding process can be restarted quickly.
  • the processes interact by means of process communication.
  • the manner of the process communication includes the RPC (Remote Procedure Call Protocol) and the named pipe, etc., and the present invention is not limited thereto, and those skilled in the art to which the present invention pertains may select according to the actual situation.
  • RPC Remote Procedure Call Protocol
  • the main control process, the encoding process, and the plug-in loading process run in the background, and interact with the anchor through the interface program in the foreground.
  • the interface program is a program for real human-computer interaction for the main broadcast.
  • the interface program needs to submit the video screen preview window to the main control process for drawing.
  • the call of the anchor on the interface will be forwarded to the master process through RPC.
  • the interface program needs to start and resume the master process in the event that the master process crashes abnormally.
  • the anchor may have different requirements.
  • the anchor may use the single-process mode for maintenance, or use the multi-process mode for the program temperature, and the plug-in loading process will not be created if the plug-in is not needed.
  • the anchor live application in the embodiment of the present invention may operate in at least the following four operating modes.
  • the first mode LIVE_ENCODER_PROXY_WITH_SERVER is specifically a multi-process mode.
  • the master process RpcLiveEncoderServer will be created (the master process can also be named other), and then the host broadcast application will treat the master process RpcLiveEncoderServer as the server, as the client. Access the master process RpcLiveEncoderServer. Then, the call of the host application to the master process is sent to the master process RpcLiveEncoderServer through the RPC request.
  • the master process RpcLiveEncoderServer will further create the encoding process RpcLiveEncoderEncoder (the encoding process can also be named other) and the plug-in loading process RpcPluginLoader (the plug-in loading process can also be named other).
  • the second mode LIVE_ENCODER_PROXY_WITHOUT_SERVER is also in multi-process mode. Different from the first mode, in the second mode, the live broadcast application of the anchor does not need to create the master RpcLiveEncoderServer, but is connected to an existing preset master process. Similarly, the host live application will treat the master process RpcLiveEncoderServer as a server, and access the default master process as the client according to the address of the server.
  • the master process in the second mode may be a process created by an upper layer application.
  • the second mode has the advantage of facilitating the extension of the main control process from the upper layer application; the advantage of the first mode compared to the second mode is that the main broadcast application directly manages the main control process, and the main control process is It is created by the anchor application itself, so the possibility of incompatibility is low.
  • the master process RpcLiveEncoderServer further creates the encoding process RpcLiveEncoderEncoder and the plugin loading process RpcPluginLoader.
  • the third mode is the third mode
  • the third mode LIVE_ENCODER_PROXY_STUB is also in multi-process mode.
  • the master process RpcLiveEncoderServer in the third mode is similar to the master process in the first mode or the second mode.
  • the master process RpcLiveEncoderServer further creates one of the encoding process RpcLiveEncoderServer or the plug-in loading process RpcPluginLoader.
  • the host process RpcLiveEncoderServer is instructed to generate the encoding process RpcLiveEncoderServer or the plug-in loading process RpcPluginLoader by setting a flag bit in advance.
  • the first flag bit LIVE_ENCODER_REMOTE_PLUGIN indicates that a plug-in needs to be created.
  • the RpcPluginLoader is loaded, and the second flag bit LIVE_ENCODER_REMOTE_ENCODER indicates that the encoding process RpcLiveEncoderServer needs to be created.
  • the third mode can be selected and the second flag bit is set in advance.
  • the fourth mode LIVE_ENCODER_LOCAL_SERVICE is a single process mode.
  • the anchor live application creates only one process, the master process.
  • the encoding function of the live broadcast application of the anchor is implemented in the main control process, and the plugin is also loaded in the main control process.
  • the master process RpcLiveEncoderServer does not further create other processes.
  • S102 in the embodiment of the present invention is specifically implemented by the following process:
  • the master process of the anchor live application is created, wherein in the first mode, the master process creates the encoding process and the plugin Loading process
  • the operation mode is the second mode
  • the preset address of the master process is obtained, and the master process is accessed based on the address, where the master process is in the second mode.
  • the encoding process and the plugin loading process will be created.
  • the host control process is created by the anchor live application; if the running mode set by the anchor is the second mode, the live broadcast application of the anchor acquires the address of the preset master process. And then access the preset master process based on the address. Moreover, in the first mode and the second mode, the obtained master process further creates an encoding process and a plug-in loading process.
  • the anchor live application only creates a process of the master process and runs in the single process mode. If the running mode set by the anchor is the third mode, after the anchor live application acquires the master process, the master process further needs to create a process in the encoding process or the plug-in loading process.
  • the method further includes: determining a running mode of the preset broadcast application of the anchor end, and if the running mode is the third mode, further obtaining a flag bit indicating that the encoding process or the plug-in loading process needs to be created, if the marking bit is A flag bit, S103 is specifically: creating a plug-in loading process by the master process; if the flag bit is the second flag bit, S103 Specifically, the encoding process is created by the master process.
  • the anchor broadcast application can be run in a single process or multiple processes to meet different performance requirements. And, by setting different mark bits, one of the plug-in loading function and the encoding function can be separated from the master process.
  • the coding function is usually one of the core functions of the live broadcast application of the main broadcast.
  • each function, interface and parameters for implementing the coding function are encapsulated in the coding module.
  • the main control process runs, the coding module is loaded into the main control process, and the main control process can arbitrarily call various functions, interfaces and parameters of the coding function.
  • the live broadcast application of the anchor end can be run in a single process or in multiple processes. Therefore, in order to enable the live broadcast application of the anchor to be normally encoded, whether it is a single process or a multi-process operation, the embodiment of the present invention At least the following improvements have been made to the encoding module:
  • the LiveEncoderLocalService encoding local service module is connected to the LiveEncoderStub encoding stub module, and the LiveEncoderProxy encoding proxy module is connected to the LiveEncoderLocalService encoding local service module.
  • the LiveEncoderLocalService encoding local service module, the LiveEncoderStub encoding stub module, and the LiveEncoderProxy encoding proxy module are encapsulated in one module, that is, the LiveEncoder encoding module.
  • the master process acquires the video stream in S104.
  • the master process sends an encoding instruction to the encoding stub module to notify the encoding process to encode the video stream;
  • the encoding process calls an encoding local service module connected to the encoding stub module to encode the video stream;
  • the encoding process calls the encoding proxy interface module connected to the encoding local service module to feed back the encoded video stream to the main control process.
  • the encoding function of the live broadcast application of the anchor is implemented independently from the main control process to the encoding process.
  • the master process sends an encoding instruction to the encoding stub module by communicating with the RPC between the encoding processes to notify the encoding process to start encoding.
  • the encoding process in response to the encoding instruction, invokes a related method and function in the encoding local service module to execute the encoding instruction, thereby encoding the video stream.
  • the encoding process calls the encoding proxy module LiveEncoderProxy to feed back the encoded video stream to the main control process through the RPC channel.
  • the main control process sends the video stream to the live broadcast server, and then the live broadcast server forwards the video stream to the viewer device of the viewer watching the anchor. Furthermore, the viewer device decodes the video stream and decodes the live video for viewing by the viewer.
  • the master process obtains the video stream in S104, including:
  • the master process sends an encoding instruction to the encoding stub module
  • the encoding stub module calls an encoding local service module connected to the encoding stub module to encode the video stream;
  • the encoding local service module calls an encoding proxy interface module connected to the encoding local service module to feed back the encoded video stream to the main control process.
  • the encoding function of the live broadcast application of the anchor is still implemented by the master process.
  • an encoding instruction is generated.
  • the master process then sends an encoding instruction to the encoding stub module.
  • the encoding stub module sends an encoding instruction to the encoding local service module to invoke the method and function in the encoding local service module to encode the video stream.
  • the encoding local service module sends the encoded video stream to the encoding proxy module, and then the encoding proxy module transparently transmits the video stream to the main control process.
  • the above is an introduction to how the main control process and the encoding process use the improved encoding module.
  • the following describes how the main control process creates the encoding process and the encoding process specific encoding process.
  • the process of creating a coding process by the master process includes the following processes:
  • the master process calls a process creation function
  • the master process sends the ID of the master process to the process creation function
  • the master process runs the process creation function to create the encoding process, and after the creation process is completed, the process process initializes the process environment, and based on the ID connection of the master process that the process creation function has Master process.
  • the master process calls the Windows system process to create the CreateProcess function to create an encoding process RpcLiveEncoderEncoder.
  • the process ID of the master process is passed to the CreateProcess function as a command line parameter.
  • the process ID of the master process can be obtained from the command line.
  • the master process runs the CreateProcess function to create the encoding process RpcLiveEncoderEncoder.
  • the encoding process initializes the process environment and establishes a connection with the master process. Specifically, the encoding process initializes the process environment and connects to the master process by the following process:
  • the encoding process registers an initialization service function and a video stream encoding service function
  • the encoding process RpcLiveEncoderEncoder creates an RPC communication client instance handle hRpc by calling the RpcCreatelnstance method, and correspondingly, the master process is the server. Then, the RpcRegisterProcedure function is called, the initialization service function init_encoder of the encoding process RpcLiveEncoderEncoder is registered to hRpc, and the video stream encoding service function encode_raw_buffer is registered to hRpc.
  • the initialization service function init_encoder is used to respond to the initialization command of the main control process, and completes the encoding initialization operation according to the rated parameter in the initialization command
  • the encoded stream server function encode_raw_buffer is used to respond to the coding instruction of the main control process, and is The control process specifies the video material and audio material in the memory to be encoded, and returns the encoded data to the master process.
  • the embodiment of the present invention adopts a shared memory manner to optimize performance. Specifically, call the Windows system's CreateFileMapping function to create a video shared memory called RpcLiveEncoderEncoder_video_X, and create an audio shared memory called RpcLiveEncoderEncoder_Audio_X.
  • the naming of the video shared memory and the audio shared memory may be set according to actual conditions, and the present invention does not specifically limit.
  • the encoding process reads the process ID of the master process in the command line, and calls the RpcStartService function to establish an RPC communication channel with the master process. Then, the client_process_ready function of the master process is invoked based on the RPC channel to notify the master process that the encoding process initializes the process environment.
  • the main control process obtains the sessionld session ID of the encoding process in the RPC connection from the RPC channel according to the call of the encoding process to the client_process_ready function, and determines the initialization of the encoding process environment. Completion, and then in the subsequent process, notify the encoding process to encode the video stream as needed.
  • the master process acquires the video shared memory identifier and the audio shared memory identifier created by the encoding process based on the rpc_encoder_sharememory_name function of the encoding process of the sessionld of the encoding process.
  • the master control process sends an initialization command to the encoding process, where the initialization command includes a nominal parameter for guiding the encoding process to determine a decoding header parameter, where the decoding header parameter includes a video decoding header parameter and an audio decoding header parameter;
  • the encoding process runs the initialization service function based on the initial command to obtain the video decoding header parameter and the audio decoding header parameter based on the nominal parameter;
  • the master process sends an initialization init_encoder command to the encoding process.
  • the command includes a nominal parameter for directing the encoding process to determine the decoding header parameters, and the nominal parameter is determined by the master process based on the selection of the anchor.
  • the rated parameters include but are not limited to resolution information (width width and height height), video bit rate videoBitrate, video frame rate fps, video encoder type videoCodec, audio encoder channel number audioChannel, audio
  • the sampling rate is audioSampleRate, the audio bit rate audioBitrate, and the audio encoder type audioCodec.
  • the encoding process receives the initialization init_encoder from the RPC channel, and responds by initializing the service function init_encoder.
  • the CreateMediaFile function is called to create a multimedia file IMediaFile interface.
  • the CreateEncoder method of the IMediaFile interface is used to create a VideoEncoder interface videoEncoder of type videoCodec, and a video encoder interface audioEncoder of type audioCodec according to the audio encoder type audioCodec in the init_encoder command.
  • the Open method that calls the video encoder interface videoEncoder will encode the width of the video.
  • Width, height height, video bit rate videoBitrate, video frame rate fps as parameters to initialize the video encoder interface IMediaEncoder, and call the audio encoder audioEncoder Open method to encode the audio
  • the audio channel audioEncoder is initialized by the audio channel of the device, the audio sample rate audioSampleRate, and the audio bit rate audioBitrate as parameters.
  • the encoding process calls the readVideoHeader of the IMediaFile interface to obtain the video decoding header parameter videoHeader of the video encoder interface IMediaEncoder, and the readAudioHeader method of the IMediaFile interface to obtain the audio decoding header parameter audioHeader of the audio encoder audioEncoder.
  • the encoding process sends the obtained video decoding header parameter videoHeader and the audio decoding header parameter audioHeader to the main control process through the RPC channel.
  • the main control process further sends the video decoding header parameter videoHeader and the audio decoding header parameter audioHeader to the live broadcast server, and the live video server sends the video decoding header parameter videoHeader and the audio decoding header parameter audioHeader to each viewer device. Then, the viewer device can decode and play the video and audio according to the video decoding header parameter videoHeader and the audio decoding header parameter audioHeader.
  • the encoded video stream can be obtained.
  • obtaining an encoded video stream by using an encoding process in S104 is specifically performed by the following process:
  • the encoding process receives an encoding command sent by the master control process
  • the main control process pre-stores the video material to be encoded into the video shared memory according to the identifier of the video shared memory obtained in the foregoing, and pre-stores the audio material to be encoded according to the identifier of the audio shared memory obtained in the foregoing.
  • the content of the video material and the audio material are usually matched, for example, from the same file or collected by the anchor device. Then, when the video stream needs to be encoded, the master process sends an encoding command encode_raw_buffer to the encoding process through the RPC channel between the encoding process.
  • the encoding process After the encoding process receives the encode_raw_buffer command, it responds by the encoding function, specifically: calling the Encode method of the videoEncoder interface, reading the video material in the video shared memory for encoding, returning the video encoded data to the main control process; and calling the Encode of the audioEncoder
  • the method encodes the audio material in the audio shared memory, and returns the audio encoded data to the main control process.
  • the video encoded data and the audio encoded data constitute a video stream, and the two correspond to each other according to a time axis.
  • the above is an introduction to encoding the video stream of the encoding process.
  • the encoding process implements a separately encoded video stream.
  • the master process After receiving the video stream returned by the encoding process, the master process stores the video stream in the sending queue and sends it to the live server. Then, after receiving the video stream, the live broadcast server forwards the video stream to each viewer device, and the viewer device sequentially decodes the received video stream, and then plays the live broadcast video of the anchor to the user, thereby completing the live broadcast.
  • the encoding process may be crashed due to an abnormality.
  • the live broadcast method in the embodiment of the present invention may further include:
  • the master process monitors whether the encoding process crashes
  • the master process monitors that the encoding process crashes, the master process re-creates the encoding process.
  • the master process monitors the running status of the encoding process. If the encoding process crashes, the encoding process is re-created in the manner described above for creating the encoding process, and the description is not repeated here.
  • the plug-in of the live broadcast application of the anchor is loaded inside the plug-in loading process, and even if the plug-in is abnormal, the operation of the master process is not affected. Similar to the encoding process, the plug-in process is also connected to the master process through the RPC channel, and the plug-in process invokes the relevant interface of the master process through the RPC channel in order to simulate the environment in which the plug-in is loaded into the master process, so that the plug-in can be loaded normally. And running.
  • the prior art master process needs to know which plugins are available before loading the plugin, so the plugin needs to be enumerated before the plugin is loaded.
  • the plug-in loading process in the embodiment of the present invention also needs to enumerate the plug-in to the main control process before loading the plug-in.
  • the plugin loading process before the plugin loading process loads the target plugin that needs to be loaded in the live broadcast application in the plugin loading process, the plugin loading process further includes:
  • the master process creates a plugin enumerator process
  • the plug-in enumerator process enumerates, to the master process, an alternative plug-in that exists in the current load directory and can be loaded;
  • the master process determines to determine the target plugin from the candidate plugin, and notifies the plugin to load the target plugin.
  • the master process creates a plug-in enumerator process by:
  • the master process calls a process creation function
  • the master process sends the ID of the master process to the process creation function
  • the master process runs the process creation function to create the plug-in enumerator process, after the plug-in enumerator process is initialized, initializes the process environment, and based on the master control of the process creation function The ID of the process is connected to the master process.
  • the master process loads the RpcPluginManager Remote Plugin Manager module, which is responsible for the creation of the plugin enumerator process RpcPluginFinder and commands the RpcPluginFinder to enumerate the functionality of the plugin.
  • RpcPluginManager module After loading the RpcPluginManager module into the main control process, call the CreatePluginManager function in the module to create a plugin manager interface IPluginManager.
  • the master process calls the initialization init method of the plugin manager interface IPluginManager, so that the init method further calls the Windows system process creation function CreateProcess to create the plugin enumerator process RpcPluginFinder.
  • the master process also passes the process ID of the master process as a command line argument to the CreateProcess function.
  • the master process runs the create function CreateProcess to create the plugin enumerator process RpcPluginFinder.
  • the creation of the plugin enumerator process is completed.
  • the plug-in enumerator process is created, it also needs to initialize the process environment and establish a connection with the master process.
  • the plugin enumerator process initializes the environment through the following process:
  • an RPC communication client instance handle hRpc is created by calling RpcCreatelnstance; the RpcRegisterProcedure function is called, and the function function of the enumeration plug-in, that is, the enumeration plug-in function get_plugins is registered to hRpc, and the enumeration plug-in function is used to respond to the master process.
  • the enumeration plugin instruction enumerates the plugin; calls the RpcRegisterProcedure function, and registers the enumeration exit function to hRpc.
  • the enumeration exit function is used to respond to the enumeration exit instruction sent by the master process after all the plugins are obtained, so that the plugin is The process exits; according to the process ID of the master process in the command line, the RpcStartService function is called to establish an RPC channel with the master process; the client_process_ready function of the master process is called to notify the master process that the plugin enumerator process is initialized. carry out.
  • the main control process obtains the sessionld session ID of the plug-in enumerator process in the RPC connection from the RPC channel according to the call of the plugin enumerator process to the client_process_ready function, and determines that the plug-in enumerator process environment initialization is completed, and then in the subsequent process. Invoke the plugin enumerator process to enumerate plugins as needed.
  • the plugin enumerator process enumerates to the master process the candidate plugins that are present in the current load directory and that can be loaded, including:
  • the plug-in enumerator receives an enumeration instruction sent by the master control process, and invokes the enumeration plug-in function process to read all plug-ins in the loading directory;
  • the candidate plug-in in the embodiment of the present invention refers to a plug-in that is selected and loaded by the master process.
  • the master process When the master process needs to load the plugin, it will first send an enumeration instruction to the plugin enumerator process to get all the alternative plugins.
  • the plug-in enumerator process receives the enumeration sent by the master process from the RPC channel.
  • the enumeration function get_plugins is called to enumerate all the plug-ins in the current load directory.
  • the get_plugins function calls the FindFirstFile function to get the first DLL (Dynamic Link Library) file in the load directory.
  • the get_plugins function calls the FindNextFile function to continue to get the next DLL file in the load directory. If the FindNextFile function returns true, it means that the next DLL file is obtained, then execute the FindNextFile function again and continue to get the next DLL file; if the FindNextFile function returns false, it means that all the DLL files in the loading directory have been obtained. As long as the return value of the FindNextFile function is true, the next DLL file is fetched until the FindNextFile function returns a false value.
  • the anchor may add some illegal plug-ins to the loading directory, but the illegal plug-ins cannot be loaded. Therefore, after obtaining all the plug-ins, it is illegal to further determine whether the obtained plug-ins are legal.
  • the plugin is filtered out.
  • the LoadLibrary function of the calling system loads each DLL file. If the LoadLibrary function can be successfully called, the DLL file is legal. Otherwise, if the LoadLibrary function fails, the DLL file is invalid. After calling the LoadLibrary function for each DLL file, the illegal DLL file is unloaded from the load directory, and the legal DLL file is retained.
  • the anchor-side live application although a plug-in is legal, the anchor-side live application may not support the plug-in. Therefore, in the embodiment of the present invention, in order to ensure an alternative provided for the final control process.
  • the plug-ins are all plug-ins supported by the live broadcast application on the host, and further need to be filtered for the legal DLL file to obtain the plug-in supported by the broadcast application of the anchor.
  • the plug-in enumerator process performs filtering according to different supporting conditions, and the present invention does not specifically limit.
  • the plug-in supported by the host-side live application is specifically a plug-in with an export function.
  • the specific method for determining whether the legal plug-in can be supported is: calling the GetProcAddress function of the system to obtain the export function in a legal DLL file. If the export function can be obtained, it is determined that the plug-in corresponding to the DLL file is a plug-in that the live broadcast application can support, and then the plug-in is reserved as an alternative plug-in; otherwise, if the export function is not obtained, the DLL file is determined.
  • the corresponding plug-in is a plug-in that is not supported by the live broadcast application, and is then loaded from the directory. Uninstall the plugin.
  • the plugin enumerator process provides the name of the determined alternative plugin to the master process through the RPC channel with the master process.
  • the method further includes:
  • the master process sends an exit instruction to the plug-in enumerator process
  • the plug-in enumerator invokes the enumeration exit function to end the process based on the exit instruction.
  • the master process After receiving the plugin enumerated by the plugin enumerator process, the master process sends an exit instruction to the plugin enumeration process. After the plugin enumerator process receives the exit instruction, it calls the enumeration exit function to exit the plugin enumerator process.
  • the master process automatically selects the target plugin from the candidate plugin, or determines the corresponding target plugin according to the selection operation of the anchor, and then notifies the plugin loading process by the name of the target plugin through the RPC channel of the plugin loading process. Further, the plug-in loading process acquires the target plug-in DLL file according to the name of the target process, thereby loading and running the target plug-in.
  • the plug-in loading process calls the adding method of the master process by calling the RPC channel of the master process, so that the plug-in detects the adding method, thereby Can load successfully.
  • the main control process invokes the plug-in to run, and the plug-in loading process receives the instruction that is triggered by the main control process and is triggered by the main control process, and triggers the plug-in to run.
  • the plug-in loading process needs to use the subtraction method.
  • the plug-in loading process calls the subtraction method of the master process by calling the RPC channel of the master process, so that the plug-in uses the subtraction method to process, thereby obtaining the processing result.
  • the plug-in loading process obtains the result of running the plug-in, and feeds back the running result of the plug-in to the main control process through the RPC channel of the main control process.
  • the plug-in loading process needs to transfer the images and audio generated by the plug-in to the master process through the RPC channel of the master process. Then, the master process displays the image according to the image drawing window generated by the plug-in, and plays the audio through the player, thereby displaying the image and sound generated by the plug-in to the anchor.
  • the embodiment of the present invention further includes the following solutions:
  • the master process monitors whether the plug-in loading process crashes
  • the master process monitors the running state of the plug-in loading process. If the plug-in loading process is detected to crash, the plug-in enumerator process and plug-in are recreated by creating a plug-in enumerator process and a plug-in loading process as described above. The loading process is not repeated here.
  • the second aspect of the present invention further provides a live broadcast device, as shown in FIG. 2, including:
  • the startup unit 101 is configured to start a live broadcast application of the anchor end
  • the master control process obtaining unit 102 is configured to acquire a master control process of the live broadcast application of the anchor end;
  • the process creation unit 103 is configured to create an encoding process and/or a plug-in loading process, where the encoding process is used to encode a video stream based on the control of the master process, and feed back the video stream to the master process.
  • the plug-in loading process is configured to load a plug-in in the plug-in loading process, and invoke the loaded plug-in according to the control of the master process;
  • a video stream obtaining unit 104 configured to acquire the video stream
  • the sending unit 105 is configured to send the video stream to a live broadcast server, so that the live broadcast server forwards the video stream to a viewer device that accesses the live broadcast server.
  • the master control process obtaining unit 102 is configured to determine a preset operation mode of the anchor live application, and if the operation mode is the first mode, create the a master process, wherein, in the first mode, the master process creates the encoding process and the plug-in loading process; if the running mode is the second mode, acquiring the preset master An address of the process, and accessing the master process based on the address, wherein, in the second mode, the master process creates the encoding process and the plug-in loading process.
  • the device further includes:
  • a mode determining unit configured to determine, before the creating a coding process or a plug-in loading process by the main control process, a preset operation mode of the live broadcast application of the anchor end;
  • a mark obtaining unit configured to: if the running mode is the third mode, acquire a mark bit indicating that the encoding process and/or the plug-in loading process needs to be created before creating an encoding process and/or a plug-in loading process;
  • the process creation unit 103 is specifically configured to create the plug-in loading process by using the master process
  • the process creation unit 103 is specifically configured to create the encoding process by using the master process.
  • the video stream obtaining unit 104 is configured to send an encoding instruction to the encoding stub module to notify the encoding process to encode a video stream, where the encoding process is invoked and An encoding local service module coupled to the encoding stub module encodes the video stream, and the encoding process invokes an encoding proxy interface module coupled to the encoding local service module to feed back the encoded video stream to the video stream obtaining unit.
  • the video stream obtaining unit 104 is configured to send an encoding instruction to the encoding stub module, where the encoding stub module invokes the encoding stub module.
  • the coupled coded local service module encodes the video stream, and the coded local service module invokes a coded proxy interface module coupled to the coded local service module to feed back the encoded video stream to the video stream acquisition unit.
  • the process creating unit 103 is configured to invoke a process creation function, pass the ID of the master process to the process creation function, and run the process creation function to create The encoding process, after the creation process is completed, initialize the process environment, and connect the master control process based on the ID of the master process that the process creation function has.
  • the device further includes an encoding process environment initial unit, configured to initialize a process environment after the encoding process is completed, and connect the master control based on an ID of the master process that the process creation function has a process, specifically for registering an initialization service function and a video stream encoding service function in the encoding process, creating a video shared memory storing a video material, and storing an audio shared memory of the audio material, acquiring the method that the process creation function has The ID of the master process is connected to the master process, and the identifier of the video shared memory and the identifier of the audio shared memory are sent to the master process based on the connection between the code process and the master process.
  • an encoding process environment initial unit configured to initialize a process environment after the encoding process is completed, and connect the master control based on an ID of the master process that the process creation function has a process, specifically for registering an initialization service function and a video stream encoding service function in the encoding process, creating a video shared memory storing
  • the apparatus further includes an encoding initialization unit, configured to send an initialization command to the encoding process before the encoding the video stream by the encoding process and feeding back to the main control process, where the initialization command includes a nominal parameter for directing the encoding process to determine a decoding header parameter, the decoding header parameter including a video decoding header parameter and an audio decoding header parameter, the initialization service function being executed based on the initial command to obtain based on the nominal parameter Transmitting the video decoding header parameter and the audio decoding header parameter to the main control process, so that the main control process sets the video decoding header parameter and the audio decoding header parameter
  • the audio decoding header parameter is sent to the live broadcast server, and the live broadcast server forwards the video decoding header parameter and the audio decoding header parameter to the audience end device.
  • the video stream obtaining unit 104 is configured to receive an encoding command sent by the master control process, and extract, according to the encoding command, a video material pre-stored by the master control process from the video sharing memory, and from the Extracting audio material pre-stored by the master process in the audio sharing memory; running the video stream encoding service function to encode the video material, obtaining video encoded data, and encoding the audio material to obtain audio encoding Data, the video stream including the video encoded data and the audio encoded data; and the video encoded data and the audio encoded data are fed back to the master process.
  • the apparatus further includes an encoding process monitoring unit configured to monitor whether the encoding process crashes; if the encoding process is detected to crash, re-creating the encoding process.
  • the device further includes:
  • a plug-in loading unit configured to load a target plug-in that needs to be loaded in the live application during the plug-in loading process.
  • the process creation unit 103 is further configured to create a plug-in enumerator process before loading the target plug-in that needs to be loaded in the live application in the plug-in loading process;
  • the device further includes a plug-in enumeration unit, configured to enumerate, to the master process, an optional plug-in existing in the current loading directory and loadable;
  • a determining unit configured to determine that the target plugin is determined from the candidate plugin, and notify the plugin to load the target plugin.
  • the process creation unit 103 is configured to invoke a process creation function, and send the ID of the master process to the process creation function, and run the process creation function to create the plug-in enumerator process. After the plug-in enumerator process is created, the process environment is initialized, and the master process is connected based on the ID of the master process that the process creation function has.
  • the device further includes a plug-in loading process environment initial unit, configured to initialize a process environment after the plug-in enumerator process is created, and based on the ID connection of the master process that the process creation function has
  • the master control process is specifically configured to register an enumeration plug-in function and an enumeration exit function in the plug-in enumerator process, and obtain an ID of the master control process that is included in the process creation function to connect the master control process.
  • the plug-in enumeration unit is configured to receive an enumeration instruction sent by the master control process, invoke the enumeration plug-in function process to read all plug-ins in the loading directory, and filter from all the plug-ins. A legal plug-in is extracted; and the backup plug-in supported by the anchor live application is filtered out from the legal plug-in.
  • the apparatus further includes an exit unit, configured to enumerate the plug-in to the plug-in after the plug-in enumerator process enumerates the candidate plug-in existing in the current load directory and can be loaded to the master process
  • the process sends an exit instruction, and the enumeration exit function is called to end the process based on the exit instruction.
  • the device further includes a plug-in loading process monitoring unit, configured to monitor whether the plug-in loading process crashes, and if the plug-in loading process is detected to crash, re-creating the plug-in loading process.
  • a plug-in loading process monitoring unit configured to monitor whether the plug-in loading process crashes, and if the plug-in loading process is detected to crash, re-creating the plug-in loading process.
  • the present invention further provides a computer readable storage medium having stored thereon a computer program, which is implemented by a processor to implement the foregoing The steps of any method of the method of live broadcast.
  • the present invention further provides a computer device, as shown in FIG. 3, including a memory 204, a processor 202, and being stored on the memory 204 and operable on the processor 202.
  • the computer program, the processor 202 when the program is executed, implements the steps of any of the methods of controlling the progress bar as described above.
  • bus 200 can include any number of interconnected buses and bridges, and bus 200 will include one or more processors and memory 204 represented by processor 202.
  • the various circuits of the memory are linked together.
  • the bus 200 can also link various other circuits, such as peripherals, voltage regulators, and power management circuits, as is known in the art, and therefore, will not be further described herein.
  • Bus interface 206 provides an interface between bus 200 and receiver 201 and transmitter 203.
  • Receiver 201 and transmitter 203 may be the same component, i.e., a transceiver, providing means for communicating with various other devices on a transmission medium.
  • the processor 202 is responsible for managing the bus 200 and the usual processing, and the memory 204 can be used to store data used by the processor 202 when performing operations.
  • the host broadcast application is first started, and the main control process of the live application of the anchor is obtained, and then the main control process further creates a plug-in loading process, and the live loading process needs to be loaded in the plug-in loading process.
  • the target plugin loaded in the application Since the embodiment of the present invention adopts multiple processes and uses the plug-in loading process to load the plug-in, the abnormality of the plug-in function does not affect the master process, so that the program crashes due to one or more abnormal functions, so that the host-side live application is more The system runs stably, thereby solving the technical problem of how to improve the running stability of the live broadcast program on the anchor end in the prior art.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the 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, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Abstract

A plug-in loading method and apparatus, at least used for solving the technical problem in the prior art of how to improve the running stability of a live broadcasting program at an anchor end. The method comprises: starting an anchor end live broadcast application program (S101); acquiring a master control process of the anchor end live broadcast application program (S102); the master control process creates a plug-in loading process; and the plug-in loading process loads a target plug-in to be loaded into the live broadcast application program during the plug-in loading process (S103).

Description

一种插件加载的方法和装置Method and device for loading plug-in 技术领域Technical field
本发明涉及计算机技术领域,尤其涉及一种插件加载的方法和装置。The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for loading a plug-in.
背景技术Background technique
网络直播已经逐渐成为现代生活一种主流的娱乐和交流方式。纵观目前各个平台的主播端直播应用程序,乃至其他类型的应用程序,都是采用单进程模式运行的,即,程序所有的功能都集成在一个进程中执行。Webcasting has gradually become a mainstream entertainment and communication method in modern life. Throughout the current broadcast of the main broadcast application of each platform, and even other types of applications, all run in a single-process mode, that is, all the functions of the program are integrated in one process.
尽管单进程模式具有架构简单、方便维护的优点,但是却存在稳定性低的问题,例如如果某插件出现问题,就可能导致整个进程崩溃,必须通过重启程序才能解决。Although the single-process mode has the advantages of simple architecture and convenient maintenance, it has low stability. For example, if a plug-in has a problem, it may cause the entire process to crash and must be solved by restarting the program.
因此,现有技术存在如何提高主播端直播程序运行稳定性的技术问题。Therefore, the prior art has a technical problem of how to improve the running stability of the live broadcast program on the anchor end.
发明内容Summary of the invention
本发明实施例提供了一种插件加载的方法和装置,至少用于解决现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。The embodiment of the invention provides a method and a device for loading a plug-in, at least for solving the technical problem of how to improve the running stability of a live broadcast program on the anchor end.
第一方面,本发明提供了一种插件加载的方法,包括:In a first aspect, the present invention provides a method for loading a plug-in, including:
启动主播端直播应用程序;Start the live broadcast application on the anchor side;
获取所述主播端直播应用程序的主控进程;Obtaining a master control process of the broadcast application of the anchor end;
所述主控进程创建插件加载进程;The master process creates a plug-in loading process;
所述插件加载进程在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件。The plug-in loading process loads a target plug-in that needs to be loaded in the live application in the plug-in loading process.
可选的,在所述插件加载进程在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件之前,还包括:Optionally, before the plug-in loading process loads the target plug-in that needs to be loaded in the live application in the plug-in loading process, the method further includes:
所述主控进程创建插件枚举器进程;The master process creates a plugin enumerator process;
所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件;The plug-in enumerator process enumerates, to the master process, an alternative plug-in that exists in the current load directory and can be loaded;
所述主控进程确定从所述备选插件中确定出所述目标插件,并通知所述插件加载进程所述目标插件。The master process determines to determine the target plugin from the candidate plugin, and notifies the plugin to load the target plugin.
可选的,所述主控进程创建插件枚举器进程,包括:Optionally, the master process creates a plug-in enumerator process, including:
所述主控进程调用进程创建函数; The master process calls a process creation function;
所述主控进程将所述主控进程的ID传入所述进程创建函数;The master process sends the ID of the master process to the process creation function;
所述主控进程运行所述进程创建函数创建所述插件枚举器进程,所述插件枚举器进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。The master process runs the process creation function to create the plug-in enumerator process, after the plug-in enumerator process is initialized, initializes the process environment, and based on the master control of the process creation function The ID of the process is connected to the master process.
可选的,所述插件枚举器进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,包括:Optionally, the plug-in enumerator process initializes the process environment after the creation is completed, and connects to the master process according to the ID of the master process that the process creation function has, including:
在所述插件枚举器进程中注册枚举插件函数和枚举退出函数;Registering the enumeration plugin function and the enumeration exit function in the plugin enumerator process;
获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。Obtaining an ID of the master process that the process creation function has is connected to the master process.
可选的,所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件,包括:Optionally, the plug-in enumerator process enumerates, to the master process, candidate plug-ins that are present in the current loading directory and can be loaded, including:
所述插件枚举器接收所述主控进程发送的枚举指令,调用所述枚举插件函数进程读取所述加载目录下的所有插件;The plug-in enumerator receives an enumeration instruction sent by the master control process, and invokes the enumeration plug-in function process to read all plug-ins in the loading directory;
从所有的所述插件中过滤出合法插件;Filter out legitimate plugins from all of the plugins;
从所述合法插件中过滤出所述主播端直播应用程序支持的所述备用插件。Extracting the backup plug-in supported by the anchor live application from the legal plug-in.
可选的,在所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件之后,还包括:Optionally, after the plug-in enumerator process enumerates, to the master process, an optional plug-in that exists in the current loading directory and can be loaded, the method further includes:
所述主控进程向所述插件枚举器进程发送退出指令;The master process sends an exit instruction to the plug-in enumerator process;
所述插件枚举器基于所述退出指令调用所述枚举退出函数结束进程。The plug-in enumerator invokes the enumeration exit function to end the process based on the exit instruction.
可选的,所述方法还包括:Optionally, the method further includes:
所述主控进程监控所述插件加载进程是否崩溃;The master process monitors whether the plug-in loading process crashes;
如果所述主控进程监控到所述插件加载进程崩溃,重新创建所述插件加载进程。If the master process monitors that the plugin loading process crashes, re-create the plugin loading process.
第二方面,本发明提供了一种插件加载的装置,包括:In a second aspect, the present invention provides a device for loading a plug-in, comprising:
启动单元,用于启动主播端直播应用程序;a startup unit, configured to start a live broadcast application of the anchor;
主控进程获取单元,用于获取所述主播端直播应用程序的主控进程;a master control process acquiring unit, configured to acquire a master control process of the live broadcast application of the anchor end;
进程创建单元,用于创建插件加载进程;a process creation unit for creating a plugin loading process;
插件加载单元,用于在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件。a plug-in loading unit, configured to load a target plug-in that needs to be loaded in the live application during the plug-in loading process.
可选的,所述进程创建单元还用于在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件之前,创建插件枚举器进程;Optionally, the process creation unit is further configured to create a plug-in enumerator process before loading the target plug-in that needs to be loaded in the live application in the plug-in loading process;
所述装置还包括插件枚举单元,用于向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件;The device further includes a plug-in enumeration unit, configured to enumerate, to the master process, an optional plug-in existing in the current loading directory and loadable;
确定单元,用于确定从所述备选插件中确定出所述目标插件,并通知所述插件加载进程所述目标插件。 a determining unit, configured to determine that the target plugin is determined from the candidate plugin, and notify the plugin to load the target plugin.
可选的,所述进程创建单元用于调用进程创建函数,将所述主控进程的ID传入所述进程创建函数,运行所述进程创建函数创建所述插件枚举器进程,所述插件枚举器进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。Optionally, the process creation unit is configured to invoke a process creation function, and send the ID of the master process to the process creation function, and run the process creation function to create the plug-in enumerator process, the plug-in After the creation of the enumerator process, the process environment is initialized, and the master process is connected based on the ID of the master process that the process creation function has.
可选的,所述装置还包括插件加载进程环境初始单元,用于在所述插件枚举器进程创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,具体用于在所述插件枚举器进程中注册枚举插件函数和枚举退出函数,获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。Optionally, the device further includes a plug-in loading process environment initial unit, configured to initialize a process environment after the plug-in enumerator process is created, and based on the master process of the process creation function The ID is connected to the master process, and is specifically configured to register an enumeration plug-in function and an enumeration exit function in the plug-in enumerator process, and obtain an ID connection of the master process that is included in the process creation function. Master process.
可选的,所述插件枚举单元用于接收所述主控进程发送的枚举指令,调用所述枚举插件函数进程读取所述加载目录下的所有插件;从所有的所述插件中过滤出合法插件;从所述合法插件中过滤出所述主播端直播应用程序支持的所述备用插件。Optionally, the plug-in enumeration unit is configured to receive an enumeration instruction sent by the master control process, and invoke the enumeration plug-in function process to read all plug-ins in the loading directory; from all the plug-ins The legal plug-in is filtered out; and the backup plug-in supported by the anchor live application is filtered out from the legal plug-in.
可选的,所述装置还包括退出单元,用于在所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件之后,向所述插件枚举器进程发送退出指令,基于所述退出指令调用所述枚举退出函数结束进程。Optionally, the device further includes an exit unit, configured to: after the plug-in enumerator process enumerates, to the master process, an optional plug-in that exists in the current loading directory and can be loaded, The applet process sends an exit instruction, and the enumeration exit function is called to end the process based on the exit instruction.
可选的,所述装置还包括插件加载进程监控单元,用于监控所述插件加载进程是否崩溃,如果监控到所述插件加载进程崩溃,重新创建所述插件加载进程。Optionally, the device further includes a plug-in loading process monitoring unit, configured to monitor whether the plug-in loading process crashes, and re-create the plug-in loading process if the plug-in loading process is detected to crash.
第三方面,本发明提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现第一方面任一项所述方法的步骤。In a third aspect, the invention provides a computer readable storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the method of any of the first aspects.
第四方面,本发明提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现第一方面任一项所述方法的步骤。In a fourth aspect, the present invention provides a computer device comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, the processor implementing the program to implement any of the first aspects The steps of the method.
本申请实施例中的上述一个或多个技术方案,至少具有如下一种或多种技术效果:The above one or more technical solutions in the embodiments of the present application have at least one or more of the following technical effects:
在本发明实施例的技术方案中,首先启动主播端直播应用程序,并获取主播端直播应用程序的主控进程,然后主控进程进一步创建插件加载进程,并在插件加载进程中加载需要在直播应用程序中加载的目标插件。由于本发明实施例采用多进程,利用插件加载进程加载插件,故而插件功能的异常不会影响主控进程,所以避免了由于一个或多个功能异常而导致程序崩溃,使得主播端直播应用程序更稳定地运行,由此解决了现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。 In the technical solution of the embodiment of the present invention, the host broadcast application is first started, and the main control process of the live application of the anchor is obtained, and then the main control process further creates a plug-in loading process, and the live loading process needs to be loaded in the plug-in loading process. The target plugin loaded in the application. Since the embodiment of the present invention adopts multiple processes and uses the plug-in loading process to load the plug-in, the abnormality of the plug-in function does not affect the master process, so that the program crashes due to one or more abnormal functions, so that the host-side live application is more The system runs stably, thereby solving the technical problem of how to improve the running stability of the live broadcast program on the anchor end in the prior art.
附图说明DRAWINGS
图1为本发明实施例中直播的方法流程图;1 is a flowchart of a method for performing live broadcast according to an embodiment of the present invention;
图2为本发明实施例中直播的装置结构示意图;2 is a schematic structural diagram of a device for playing a live broadcast according to an embodiment of the present invention;
图3为本发明实施例中计算机设备的结构示意图。FIG. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
具体实施方式Detailed ways
本发明实施例提供了一种插件加载的方法和装置,至少用于解决现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。The embodiment of the invention provides a method and a device for loading a plug-in, at least for solving the technical problem of how to improve the running stability of a live broadcast program on the anchor end.
为了解决上述技术问题,本发明提供的技术方案思路如下:In order to solve the above technical problem, the technical solution provided by the present invention is as follows:
在本发明实施例的技术方案中,首先启动主播端直播应用程序,并获取主播端直播应用程序的主控进程,然后主控进程进一步创建插件加载进程,并在插件加载进程中加载需要在直播应用程序中加载的目标插件。由于本发明实施例采用多进程,利用插件加载进程加载插件,故而插件功能的异常不会影响主控进程,所以避免了由于一个或多个功能异常而导致程序崩溃,使得主播端直播应用程序更稳定地运行,由此解决了现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。In the technical solution of the embodiment of the present invention, the host broadcast application is first started, and the main control process of the live application of the anchor is obtained, and then the main control process further creates a plug-in loading process, and the live loading process needs to be loaded in the plug-in loading process. The target plugin loaded in the application. Since the embodiment of the present invention adopts multiple processes and uses the plug-in loading process to load the plug-in, the abnormality of the plug-in function does not affect the master process, so that the program crashes due to one or more abnormal functions, so that the host-side live application is more The system runs stably, thereby solving the technical problem of how to improve the running stability of the live broadcast program on the anchor end in the prior art.
下面通过附图以及具体实施例对本发明技术方案做详细的说明,应当理解本申请实施例以及实施例中的具体特征是对本申请技术方案的详细的说明,而不是对本申请技术方案的限定,在不冲突的情况下,本申请实施例以及实施例中的技术特征可以相互组合。The technical solutions of the present invention are described in detail below with reference to the accompanying drawings and specific embodiments. It is understood that the specific features of the embodiments and the embodiments of the present application are the detailed description of the technical solutions of the present application, and are not limited to the technical solutions of the present application. In the case of no conflict, the technical features in the embodiments of the present application and the embodiments may be combined with each other.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。The term "and/or" in this context is merely an association describing the associated object, indicating that there may be three relationships, for example, A and/or B, which may indicate that A exists separately, and both A and B exist, respectively. B these three situations. In addition, the character "/" in this article generally indicates that the contextual object is an "or" relationship.
本发明第一方面提供了一种直播的方法,请参考图1,为本发明实施例中直播的方法流程图。该方法包括:The first aspect of the present invention provides a method for performing live broadcast. Referring to FIG. 1 , it is a flowchart of a method for performing live broadcast according to an embodiment of the present invention. The method includes:
S101:启动主播端直播应用程序;S101: Start the broadcast application of the anchor end;
S102:获取所述主播端直播应用程序的主控进程;S102: Acquire a master control process of the live broadcast application of the anchor end;
S103:所述主控进程创建编码进程和/或插件加载进程,所述编码进程用于基于所述主控进程的控制编码出视频流,并向所述主控进程反馈所述视频流,所述插件加载进程用于在所述插件加载进程中加载插件,并根据所述主控进程的控制调用加载的插件;S103: The master process creates an encoding process and/or a plug-in loading process, where the encoding process is used to encode a video stream based on the control of the master process, and feed back the video stream to the master process. The plug-in loading process is configured to load a plug-in in the plug-in loading process, and invoke the loaded plug-in according to the control of the master process;
S104:所述主控进程获取所述视频流;S104: The master control process acquires the video stream.
S105:所述主控进程将所述视频流发送至直播服务器,以使所述直播服务 器将所述视频流转发给接入所述直播服务器的观众端设备。S105: The master control process sends the video stream to a live broadcast server, so that the live broadcast service The device forwards the video stream to a viewer device accessing the live server.
具体来讲,在S101中启动主播端直播应用程序。在具体实现过程中,主播端直播应用程序可以安装在手机、平板电脑或台式电脑等主播端设备上的直播应用,本发明不做具体限制。为了方便介绍本发明实施例中的技术方案,下文将以安装在Windows系统的台式电脑上的主播端直播应用程序为例来进行介绍。Specifically, the anchor live application is started in S101. In the specific implementation process, the live broadcast application of the anchor terminal can be installed in a live broadcast application on a host device such as a mobile phone, a tablet computer or a desktop computer, and the present invention does not impose any specific limitation. In order to facilitate the introduction of the technical solution in the embodiment of the present invention, the following describes an example of a live broadcast application on a desktop computer installed in a Windows system.
在S102中,随着主播端直播应用程序的启动,相应创建主播端直播应用程序的主控进程。接下来,在S103中,主控进程将按照需要创建编码进程和/或插件加载进程。In S102, with the activation of the live broadcast application of the anchor end, the main control process of the live broadcast application of the anchor end is created accordingly. Next, in S103, the master process will create an encoding process and/or a plugin loading process as needed.
具体来讲,本发明实施例中的编码进程用于基于主控进程的控制编码出视频流,并向主控进程反馈视频流。更具体地,编码进程接收主控进程的初始化命令和编码命令进行初始化和编码,并将编码后的数据传递给主控进程。Specifically, the encoding process in the embodiment of the present invention is used to encode a video stream based on the control of the master control process, and feed back the video stream to the master control process. More specifically, the encoding process receives the initialization command and the encoding command of the master process for initialization and encoding, and passes the encoded data to the master process.
插件加载进程用于在插件加载进程中加载插件,并根据主控进程的控制调用加载的插件。更具体地,插件加载进程充当主播端直播应用程序插件的装载器,将原有的要加载进主控进程中的插件加载到插件加载进程中,进而使主控进程不再需要加载插件,进而避免了因为插件的问题导致主控进程崩溃的情况。本发明实施例中的插件加载进程一方面模拟出插件加载和运行所依赖的主控进程的环境,另一方面响应来自主控进程获取图像、获取音频等命令,向主控进程反馈插件生成的图像和音频,使主控进程中可以正常绘制来自插件的图像以及播放声音。The plugin loading process is used to load the plugin in the plugin loading process and call the loaded plugin according to the control of the master process. More specifically, the plug-in loading process acts as a loader for the anchor application plug-in of the anchor, and loads the original plug-in to be loaded into the host process into the plug-in loading process, so that the master process no longer needs to load the plug-in, and thus This avoids the situation where the master process crashes due to plugin issues. The plug-in loading process in the embodiment of the present invention simulates the environment of the main control process on which the plug-in is loaded and run, and responds to the command from the main control process to obtain an image, obtain audio, and the feedback generated by the plug-in to the main control process. Image and audio, so that the image from the plug-in and the sound can be played normally in the master process.
主控进程是主播端直播应用程序的主进程,管理插件加载进程和编码进程。并且,如果监控到编码进程异常退出,主控进程将自动重新创建编码进程,使得编码进程能够快速的重启。The master process is the main process of the live broadcast application of the anchor, and manages the plug-in loading process and the encoding process. Moreover, if the encoding process is abnormally exited, the master process will automatically re-create the encoding process, so that the encoding process can be restarted quickly.
进一步,由于主控进程、编码进程和插件加载进程为不同的进程,为了使多条进程协同提供主播端直播应用程序的各种服务,进程间通过进程通信的方式进行交互。进程通信的方式包括RPC(远程过程调用协议,Remote Procedure Call Protocol)和命名管道等等,本发明不做具体限制,本发明所属领域的普通技术人员可以根据实际进行选择。后文中则以RPC为例来进行介绍。Further, since the main control process, the encoding process, and the plug-in loading process are different processes, in order to enable multiple processes to cooperatively provide various services of the live broadcast application of the anchor, the processes interact by means of process communication. The manner of the process communication includes the RPC (Remote Procedure Call Protocol) and the named pipe, etc., and the present invention is not limited thereto, and those skilled in the art to which the present invention pertains may select according to the actual situation. In the following text, RPC is taken as an example to introduce.
对于本发明实施例中的主播端直播应用程序而言,主控进程、编码进程和插件加载进程运行于后台,在前台则通过界面程序与主播交互。界面程序为主播真正进行人机交互的程序,在实现上,界面程序需要将视频画面预览窗口交给主控进程来绘制。主播在界面上的调用会通过RPC转发到主控进程中处理。并且,界面程序还需在主控进程异常崩溃的情况下,启动和恢复主控进程。For the anchor live application in the embodiment of the present invention, the main control process, the encoding process, and the plug-in loading process run in the background, and interact with the anchor through the interface program in the foreground. The interface program is a program for real human-computer interaction for the main broadcast. In the implementation, the interface program needs to submit the video screen preview window to the main control process for drawing. The call of the anchor on the interface will be forwarded to the master process through RPC. Moreover, the interface program needs to start and resume the master process in the event that the master process crashes abnormally.
以上是对本发明多进程模式中每个进程的介绍。在具体实现过程中,在不 同的情况下主播可能有不同的需求,例如主播为了便于维护可能倾会使用单进程模式,或者为了程序温度会使用多进程模式,以及在不需要使用插件的情况下会不创建插件加载进程等,为了满足不同的需求,本发明实施例中的主播端直播应用程序可以按照至少以下4种运行模式运行。The above is an introduction to each process in the multi-process mode of the present invention. In the specific implementation process, not in In the same situation, the anchor may have different requirements. For example, the anchor may use the single-process mode for maintenance, or use the multi-process mode for the program temperature, and the plug-in loading process will not be created if the plug-in is not needed. In order to meet different requirements, the anchor live application in the embodiment of the present invention may operate in at least the following four operating modes.
第一模式:First mode:
第一模式LIVE_ENCODER_PROXY_WITH_SERVER具体为多进程模式。在第一模式下,主播端直播应用程序启动后将创建主控进程RpcLiveEncoderServer(主控进程也可以命名为其他),然后主播端直播应用程序会将主控进程RpcLiveEncoderServer视为服务器,以客户端的身份接入主控进程RpcLiveEncoderServer。然后,主播端直播应用程序对主控进程的调用,会通过RPC请求发送给主控进程RpcLiveEncoderServer。The first mode LIVE_ENCODER_PROXY_WITH_SERVER is specifically a multi-process mode. In the first mode, after the host broadcast application starts, the master process RpcLiveEncoderServer will be created (the master process can also be named other), and then the host broadcast application will treat the master process RpcLiveEncoderServer as the server, as the client. Access the master process RpcLiveEncoderServer. Then, the call of the host application to the master process is sent to the master process RpcLiveEncoderServer through the RPC request.
在第一模式下,主控进程RpcLiveEncoderServer会进一步创建编码进程RpcLiveEncoderEncoder(编码进程的命名也可以为其他)和插件加载进程RpcPluginLoader(插件加载进程的命名也可以为其他)。In the first mode, the master process RpcLiveEncoderServer will further create the encoding process RpcLiveEncoderEncoder (the encoding process can also be named other) and the plug-in loading process RpcPluginLoader (the plug-in loading process can also be named other).
第二模式:Second mode:
第二模式LIVE_ENCODER_PROXY_WITHOUT_SERVER也为多进程模式。与第一模式不同的是,在第二模式下主播端直播应用程序不需要自行创建主控进程RpcLiveEncoderServer,而是连接到一个已有的预设主控进程中。类似地,主播端直播应用程序会将主控进程RpcLiveEncoderServer视为服务器,根据服务器的地址以客户端的身份接入预设的主控进程。The second mode LIVE_ENCODER_PROXY_WITHOUT_SERVER is also in multi-process mode. Different from the first mode, in the second mode, the live broadcast application of the anchor does not need to create the master RpcLiveEncoderServer, but is connected to an existing preset master process. Similarly, the host live application will treat the master process RpcLiveEncoderServer as a server, and access the default master process as the client according to the address of the server.
在具体实现过程中,第二模式中的主控进程可以为上层应用创建的进程。第二模式相较于第一模式,优势在于便于从上层应用扩展主控进程;第一模式相较于第二模式,优势在于便于主播端直播应用程序直接管理主控进程,并且主控进程是由主播端应用程序自己创建的,因此不兼容的可能性低。In a specific implementation process, the master process in the second mode may be a process created by an upper layer application. Compared with the first mode, the second mode has the advantage of facilitating the extension of the main control process from the upper layer application; the advantage of the first mode compared to the second mode is that the main broadcast application directly manages the main control process, and the main control process is It is created by the anchor application itself, so the possibility of incompatibility is low.
在第二模式下,主控进程RpcLiveEncoderServer也会进一步创建编码进程RpcLiveEncoderEncoder和插件加载进程RpcPluginLoader。In the second mode, the master process RpcLiveEncoderServer further creates the encoding process RpcLiveEncoderEncoder and the plugin loading process RpcPluginLoader.
第三模式:The third mode:
第三模式LIVE_ENCODER_PROXY_STUB也为多进程模式。其中,第三模式中的主控进程RpcLiveEncoderServer类似于第一模式或第二模式中的主控进程。在第三模式下,主控进程RpcLiveEncoderServer进一步会创建编码进程RpcLiveEncoderServer或插件加载进程RpcPluginLoader中的一个。在本发明实施例中,通过预先设置标记位来指示主控进程RpcLiveEncoderServer生成编码进程RpcLiveEncoderServer还是插件加载进程RpcPluginLoader。The third mode LIVE_ENCODER_PROXY_STUB is also in multi-process mode. The master process RpcLiveEncoderServer in the third mode is similar to the master process in the first mode or the second mode. In the third mode, the master process RpcLiveEncoderServer further creates one of the encoding process RpcLiveEncoderServer or the plug-in loading process RpcPluginLoader. In the embodiment of the present invention, the host process RpcLiveEncoderServer is instructed to generate the encoding process RpcLiveEncoderServer or the plug-in loading process RpcPluginLoader by setting a flag bit in advance.
具体来讲,第一标记位LIVE_ENCODER_REMOTE_PLUGIN表示需要创建插件加 载进程RpcPluginLoader,第二标记位LIVE_ENCODER_REMOTE_ENCODER表示需要创建编码进程RpcLiveEncoderServer。Specifically, the first flag bit LIVE_ENCODER_REMOTE_PLUGIN indicates that a plug-in needs to be created. The RpcPluginLoader is loaded, and the second flag bit LIVE_ENCODER_REMOTE_ENCODER indicates that the encoding process RpcLiveEncoderServer needs to be created.
那么,在具体实现过程中,如果需要添加插件,并且降低插件对主控进程的影响,则可以选择第三模式,且预先设置第一标记位;如果需要单独进程编码,避免编码功能对主控进程影响,且不需要添加插件时,则可以选择第三模式,且预先设置第二标记位。Then, in the specific implementation process, if you need to add a plug-in and reduce the impact of the plug-in on the master process, you can select the third mode and set the first flag bit in advance; if you need separate process coding, avoid the coding function to master When the process affects and does not need to add a plug-in, the third mode can be selected and the second flag bit is set in advance.
第四模式:The fourth mode:
第四模式LIVE_ENCODER_LOCAL_SERVICE为单进程模式。在第四模式下,主播端直播应用程序仅创建一个进程,即主控进程。主播端直播应用的编码功能在主控进程中实现,插件也加载在主控进程中。The fourth mode LIVE_ENCODER_LOCAL_SERVICE is a single process mode. In the fourth mode, the anchor live application creates only one process, the master process. The encoding function of the live broadcast application of the anchor is implemented in the main control process, and the plugin is also loaded in the main control process.
在第四模式下,主控进程RpcLiveEncoderServer不会进一步创建其他进程。In the fourth mode, the master process RpcLiveEncoderServer does not further create other processes.
基于以上对四种运行模式的介绍,可以看出主播端直播应用程序在不同运行模式下将按照不同的方式获取主控进程,因此本发明实施例中的S102具体通过如下过程实现:Based on the above descriptions of the four modes of operation, it can be seen that the host-end live application obtains the master process in different modes in different modes. Therefore, S102 in the embodiment of the present invention is specifically implemented by the following process:
判断预先设置的所述主播端直播应用程序的运行模式;Determining a preset operation mode of the anchor live application;
如果所述运行模式为第一模式,创建所述主播端直播应用程序的所述主控进程,其中,在所述第一模式下,所述主控进程将创建所述编码进程和所述插件加载进程;If the operating mode is the first mode, the master process of the anchor live application is created, wherein in the first mode, the master process creates the encoding process and the plugin Loading process
如果所述运行模式为第二模式,获取预设的所述主控进程的地址,并基于所述地址接入所述主控进程,其中,在所述第二模式下,所述主控进程将创建所述编码进程和所述插件加载进程。If the operation mode is the second mode, the preset address of the master process is obtained, and the master process is accessed based on the address, where the master process is in the second mode. The encoding process and the plugin loading process will be created.
具体来讲,首先判断预先设置的运行模式为以上四种模式中的哪一种。如果主播设置的运行模式为第一模式,则由主播端直播应用程序创建出主控进程;如果主播设置的运行模式为第二模式,则主播端直播应用程序获取预设的主控进程的地址,然后基于该地址接入预设的主控进程。并且,在第一模式和第二模式下,获取到的主控进程将进一步创建编码进程和插件加载进程。Specifically, it is first determined which of the above four modes is set in advance. If the running mode set by the anchor is the first mode, the host control process is created by the anchor live application; if the running mode set by the anchor is the second mode, the live broadcast application of the anchor acquires the address of the preset master process. And then access the preset master process based on the address. Moreover, in the first mode and the second mode, the obtained master process further creates an encoding process and a plug-in loading process.
另外,如果主播设置的运行模式为第四模式,则主播端直播应用程序仅创建主控进程一条进程,以单进程模式运行。如果主播设置的运行模式为第三模式,则主播端直播应用程序获取主控进程后,主控进程进一步还需创建编码进程或插件加载进程中的一个进程。具体地,S103之前还包括:判断预先设置的主播端直播应用程序的运行模式,如果运行模式为第三模式,则进一步获取表示需要创建编码进程或插件加载进程的标记位,如果标记位为第一标记位,S103具体为:通过主控进程创建插件加载进程;如果标记位为第二标记位,S103 具体为:通过主控进程创建编码进程。In addition, if the running mode set by the anchor is the fourth mode, the anchor live application only creates a process of the master process and runs in the single process mode. If the running mode set by the anchor is the third mode, after the anchor live application acquires the master process, the master process further needs to create a process in the encoding process or the plug-in loading process. Specifically, before S103, the method further includes: determining a running mode of the preset broadcast application of the anchor end, and if the running mode is the third mode, further obtaining a flag bit indicating that the encoding process or the plug-in loading process needs to be created, if the marking bit is A flag bit, S103 is specifically: creating a plug-in loading process by the master process; if the flag bit is the second flag bit, S103 Specifically, the encoding process is created by the master process.
由上述描述可以看出,通过设置不同的运行模式可以使主播端直播应用程序以单进程或多进程运行,满足不同的性能需求。并且,通过设置不同的标记位还可以将插件加载功能和编码功能中的一个从主控进程中独立出来。It can be seen from the above description that by setting different operating modes, the anchor broadcast application can be run in a single process or multiple processes to meet different performance requirements. And, by setting different mark bits, one of the plug-in loading function and the encoding function can be separated from the master process.
进一步,编码功能通常为主播端直播应用程序最为核心的功能之一,在现有技术中,实现编码功能的各个函数、接口和参数等封装在编码模块中。主控进程运行时将编码模块加载到主控进程中,进而主控进程可以任意调用编码功能的各个函数、接口和参数。在本发明实施例中,由于主播端直播应用程序既可以单进程运行又可以多进程运行,因此,为了使主播端直播应用程序无论单进程运行还是多进程运行均可以正常编码,本发明实施例对编码模块至少作出了以下改进:Further, the coding function is usually one of the core functions of the live broadcast application of the main broadcast. In the prior art, each function, interface and parameters for implementing the coding function are encapsulated in the coding module. When the main control process runs, the coding module is loaded into the main control process, and the main control process can arbitrarily call various functions, interfaces and parameters of the coding function. In the embodiment of the present invention, the live broadcast application of the anchor end can be run in a single process or in multiple processes. Therefore, in order to enable the live broadcast application of the anchor to be normally encoded, whether it is a single process or a multi-process operation, the embodiment of the present invention At least the following improvements have been made to the encoding module:
将现有技术中的编码模块的编码功能封装在一个模块中,即LiveEncoderLocalService编码本地服务模块中;添加用于接收指令,以及将接收到的指令转发到编码本地服务模块中的模块,即LiveEncoderStub编码存根模块;添加一个用于模拟编码模块原有的输出接口,以及透明传输编码本地服务模块处理结果的模块,即LiveEncoderProxy编码代理模块。今LiveEncoderLocalService编码本地服务模块连接LiveEncoderStub编码存根模块,以及今LiveEncoderProxy编码代理模块连接LiveEncoderLocalService编码本地服务模块。可选的,将LiveEncoderLocalService编码本地服务模块、LiveEncoderStub编码存根模块和LiveEncoderProxy编码代理模块封装在一个模块中,即LiveEncoder编码模块。Encapsulating the encoding function of the encoding module in the prior art in a module, that is, the LiveEncoderLocalService encoding local service module; adding a module for receiving the instruction and forwarding the received instruction to the encoding local service module, that is, LiveEncoderStub encoding Stub module; add a module for simulating the original output interface of the encoding module, and transparently transmitting the result of the local service module processing, that is, the LiveEncoderProxy encoding proxy module. The LiveEncoderLocalService encoding local service module is connected to the LiveEncoderStub encoding stub module, and the LiveEncoderProxy encoding proxy module is connected to the LiveEncoderLocalService encoding local service module. Optionally, the LiveEncoderLocalService encoding local service module, the LiveEncoderStub encoding stub module, and the LiveEncoderProxy encoding proxy module are encapsulated in one module, that is, the LiveEncoder encoding module.
基于以上对编码模块改进的介绍,下面就对本发明实施例如何应用改进后的编码模块编码进行介绍。Based on the above description of the improvement of the coding module, how to apply the improved coding module coding in the embodiment of the present invention will be described below.
(1)如果主控进程创建了编码进程,即主播端直播应用程序运行在第一模式、第二模式和(第二标记位下的)第三模式下,S104中主控进程获取视频流包括:(1) If the master process creates the encoding process, that is, the anchor live application runs in the first mode, the second mode, and the third mode (under the second flag bit), the master process acquires the video stream in S104. :
所述主控进程向编码存根模块发送编码指令,以通知所述编码进程编码视频流;The master process sends an encoding instruction to the encoding stub module to notify the encoding process to encode the video stream;
所述编码进程调用与所述编码存根模块连接的编码本地服务模块编码出所述视频流;The encoding process calls an encoding local service module connected to the encoding stub module to encode the video stream;
所述编码进程调用与所述编码本地服务模块连接的编码代理接口模块向所述主控进程反馈编码出的所述视频流。The encoding process calls the encoding proxy interface module connected to the encoding local service module to feed back the encoded video stream to the main control process.
具体来讲,如果主控进程调用编码模块创建了编码进程,那么就将主播端直播应用程序的编码功能从主控进程中独立到编码进程中实现。编码进程从属 于编码模块。当需要编码时,主控进程通过与编码进程间的RPC通过通信向编码存根模块发送编码指令来通知编码进程开始编码。编码进程响应于编码指令,调用编码本地服务模块中的相关方法和函数执行编码指令,从而编码出视频流。然后,编码进程再调用编码代理模块LiveEncoderProxy通过RPC通道向主控进程反馈编码好的视频流。Specifically, if the main control process calls the encoding module to create the encoding process, the encoding function of the live broadcast application of the anchor is implemented independently from the main control process to the encoding process. Encoding process slave In the coding module. When encoding is required, the master process sends an encoding instruction to the encoding stub module by communicating with the RPC between the encoding processes to notify the encoding process to start encoding. The encoding process, in response to the encoding instruction, invokes a related method and function in the encoding local service module to execute the encoding instruction, thereby encoding the video stream. Then, the encoding process calls the encoding proxy module LiveEncoderProxy to feed back the encoded video stream to the main control process through the RPC channel.
进而,在S105中,主控进程将视频流发送至直播服务器,然后直播服务器将视频流转发给观看该主播的观众的观众端设备上。进而,观众端设备对视频流解码,解码出直播视频供观众观看。Further, in S105, the main control process sends the video stream to the live broadcast server, and then the live broadcast server forwards the video stream to the viewer device of the viewer watching the anchor. Furthermore, the viewer device decodes the video stream and decodes the live video for viewing by the viewer.
(2)如果主控进程未创建了编码进程,即主播端直播应用程序运行在第三模式和(第一标记位的)第三模式下,S104中主控进程获取视频流包括:(2) If the master process does not create the encoding process, that is, the anchor live application runs in the third mode and the third mode (the first flag bit), the master process obtains the video stream in S104, including:
所述主控进程向编码存根模块发送编码指令;The master process sends an encoding instruction to the encoding stub module;
所述编码存根模块调用与所述编码存根模块连接的编码本地服务模块编码出所述视频流;The encoding stub module calls an encoding local service module connected to the encoding stub module to encode the video stream;
所述编码本地服务模块调用与所述编码本地服务模块连接的编码代理接口模块向所述主控进程反馈编码出的所述视频流。The encoding local service module calls an encoding proxy interface module connected to the encoding local service module to feed back the encoded video stream to the main control process.
具体来讲,如果主控进程未创建编码进程,那么主播端直播应用程序的编码功能则仍然由主控进程实现。具体地,当主控进程需要编码视频流时,生成编码指令。然后,主控进程向编码存根模块发送编码指令。接着,编码存根模块向编码本地服务模块发送编码指令,以调用编码本地服务模块中的方法和函数编码视频流。接着,编码本地服务模块将编码完成的视频流发送给编码代理模块,进而编码代理模块再将视频流透明传输给主控进程。Specifically, if the encoding process is not created by the master process, the encoding function of the live broadcast application of the anchor is still implemented by the master process. Specifically, when the master process needs to encode the video stream, an encoding instruction is generated. The master process then sends an encoding instruction to the encoding stub module. Next, the encoding stub module sends an encoding instruction to the encoding local service module to invoke the method and function in the encoding local service module to encode the video stream. Then, the encoding local service module sends the encoded video stream to the encoding proxy module, and then the encoding proxy module transparently transmits the video stream to the main control process.
以上是对主控进程和编码进程如何利用改进后的编码模块进行编码的介绍,下面则对主控进程如何创建编码进程,以及编码进程具体的编码过程进行介绍。The above is an introduction to how the main control process and the encoding process use the improved encoding module. The following describes how the main control process creates the encoding process and the encoding process specific encoding process.
首先对主控进程创建编码进程的过程进行介绍。在本发明实施例中,主控进程创建编码进程包括如下过程:First, the process of creating a coding process by the master process is introduced. In the embodiment of the present invention, the process of creating a coding process by the master process includes the following processes:
所述主控进程调用进程创建函数;The master process calls a process creation function;
所述主控进程将所述主控进程的ID传入所述进程创建函数;The master process sends the ID of the master process to the process creation function;
所述主控进程运行所述进程创建函数创建所述编码进程,所述编码进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。The master process runs the process creation function to create the encoding process, and after the creation process is completed, the process process initializes the process environment, and based on the ID connection of the master process that the process creation function has Master process.
具体来讲,主控进程调用Windows系统的进程创建CreateProcess函数创建一个编码进程RpcLiveEncoderEncoder。主控进程在调用CreateProcess函数时,会将主控进程的进程ID当做命令行参数传递给CreateProcess函数,进而 由CreateProcess函数创建的编码进程RpcLiveEncoderEncoder启动后就可以在命令行中获取主控进程的进程ID。接着,主控进程运行CreateProcess函数创建出编码进程RpcLiveEncoderEncoder。接下来,编码进程初始化进程环境,并建立与主控进程的连接,具体地,编码进程通过如下过程初始化进程环境并连接主控进程:Specifically, the master process calls the Windows system process to create the CreateProcess function to create an encoding process RpcLiveEncoderEncoder. When the main control process calls the CreateProcess function, the process ID of the master process is passed to the CreateProcess function as a command line parameter. After the encoding process RpcLiveEncoderEncoder created by the CreateProcess function is started, the process ID of the master process can be obtained from the command line. Then, the master process runs the CreateProcess function to create the encoding process RpcLiveEncoderEncoder. Next, the encoding process initializes the process environment and establishes a connection with the master process. Specifically, the encoding process initializes the process environment and connects to the master process by the following process:
所述编码进程注册初始化服务函数和视频流编码服务函数;The encoding process registers an initialization service function and a video stream encoding service function;
创建存储视频材料的视频共享内存以及存储音频材料的音频共享内存;Creating a video shared memory that stores video material and an audio shared memory that stores audio material;
获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程;Obtaining an ID of the master control process that is included in the process creation function, and connecting the master control process;
基于与所述主控进程的连接,向所述主控进程发送所述视频共享内存的标识和所述音频共享内存的标识。And sending, according to the connection with the master process, an identifier of the video shared memory and an identifier of the audio shared memory to the master process.
具体来讲,编码进程RpcLiveEncoderEncoder通过调用RpcCreatelnstance方法创建一个RPC通信客户端实例句柄hRpc,对应地,主控进程为服务器。然后,调用RpcRegisterProcedure函数,将编码进程RpcLiveEncoderEncoder的初始化服务函数init_encoder注册到hRpc中,以及将视频流编码服务函数encode_raw_buffer注册到hRpc中。在本发明实施例中,初始化服务函数init_encoder用于响应主控进程的初始化命令,根据初始化命令中的额定参数完成编码初始化工作,编码流服务器函数encode_raw_buffer用于响应主控进程的编码指令,对主控进程指定内存中的视频材料和音频材料进行编码,并将编码后所获取的数据返回给主控进程。Specifically, the encoding process RpcLiveEncoderEncoder creates an RPC communication client instance handle hRpc by calling the RpcCreatelnstance method, and correspondingly, the master process is the server. Then, the RpcRegisterProcedure function is called, the initialization service function init_encoder of the encoding process RpcLiveEncoderEncoder is registered to hRpc, and the video stream encoding service function encode_raw_buffer is registered to hRpc. In the embodiment of the present invention, the initialization service function init_encoder is used to respond to the initialization command of the main control process, and completes the encoding initialization operation according to the rated parameter in the initialization command, and the encoded stream server function encode_raw_buffer is used to respond to the coding instruction of the main control process, and is The control process specifies the video material and audio material in the memory to be encoded, and returns the encoded data to the master process.
接下来,创建存储视频材料和音频材料的内存。在本发明实施例中,考虑到如果需要编码清晰度较高的视频流,例如1080p的视频流,那么每帧图像的数据量都比较大;同时,如果采用RPC传输进程之间的数据,也会带来较大的性能消耗,因此为了避免编码数据不必要的传输,本发明实施例采用共享内存的方式来优化性能。具体地,调用Windows系统的CreateFileMapping函数创建一个名为RpcLiveEncoderEncoder_video_X的视频共享内存,以及创建一个名为RpcLiveEncoderEncoder_Audio_X的音频共享内存。当然,在具体实现过程中,视频共享内存和音频共享内存的命名可以根据实际进行设置,本发明不做具体限制。Next, create a memory that stores the video material and audio material. In the embodiment of the present invention, considering that if a video stream with a higher resolution, such as a 1080p video stream, is required, the data amount of each frame of the image is relatively large; and, if the data between the processes is used by the RPC, In order to avoid unnecessary transmission of encoded data, the embodiment of the present invention adopts a shared memory manner to optimize performance. Specifically, call the Windows system's CreateFileMapping function to create a video shared memory called RpcLiveEncoderEncoder_video_X, and create an audio shared memory called RpcLiveEncoderEncoder_Audio_X. Of course, in the specific implementation process, the naming of the video shared memory and the audio shared memory may be set according to actual conditions, and the present invention does not specifically limit.
接下来,编码进程读取命令行中的主控进程的进程ID,调用RpcStartService函数建立与主控进程之间的RPC通信通道。然后,基于RPC通道调用主控进程的client_process_ready函数,以通知主控进程编码进程初始化进程环境完成。Next, the encoding process reads the process ID of the master process in the command line, and calls the RpcStartService function to establish an RPC communication channel with the master process. Then, the client_process_ready function of the master process is invoked based on the RPC channel to notify the master process that the encoding process initializes the process environment.
主控进程根据编码进程对client_process_ready函数的调用,从RPC通道内获取编码进程在RPC连接中的sessionld会话ID,并确定编码进程环境初始化 完成,进而在后续过程中根据需要通知编码进程编码视频流。The main control process obtains the sessionld session ID of the encoding process in the RPC connection from the RPC channel according to the call of the encoding process to the client_process_ready function, and determines the initialization of the encoding process environment. Completion, and then in the subsequent process, notify the encoding process to encode the video stream as needed.
另外,主控进程基于编码进程的sessionld调用编码进程的rpc_encoder_sharememory_name函数获取编码进程所创建的视频共享内存标识和音频共享内存标识。In addition, the master process acquires the video shared memory identifier and the audio shared memory identifier created by the encoding process based on the rpc_encoder_sharememory_name function of the encoding process of the sessionld of the encoding process.
通过上述过程,就完成了对编码进程的创建。接下来,对编码进程具体的编码过程进行介绍。Through the above process, the creation of the encoding process is completed. Next, the specific encoding process of the encoding process is introduced.
首先,为了使得观众端设备能够顺利获取并解码视频流,需要先向观众端设备提供解码头参数。因此,在通过编码进程编码出视频流并反馈给主控进程之前,还包括:First, in order to enable the viewer device to successfully acquire and decode the video stream, it is necessary to first provide the decoding header parameter to the viewer device. Therefore, before the video stream is encoded by the encoding process and fed back to the master process, it also includes:
所述主控进程向所述编码进程发送初始化命令,所述初始化命令包括用于指导所述编码进程确定解码头参数的额定参数,所述解码头参数包括视频解码头参数和音频解码头参数;The master control process sends an initialization command to the encoding process, where the initialization command includes a nominal parameter for guiding the encoding process to determine a decoding header parameter, where the decoding header parameter includes a video decoding header parameter and an audio decoding header parameter;
所述编码进程基于所述初始命令运行所述初始化服务函数,以基于所述额定参数获得所述视频解码头参数和所述音频解码头参数;The encoding process runs the initialization service function based on the initial command to obtain the video decoding header parameter and the audio decoding header parameter based on the nominal parameter;
所述编码进程向所述主控进程反馈所述视频解码头参数和所述音频解码头参数,以使所述主控进程将所述视频解码头参数和所述音频解码头参数发送至所述直播服务器,所述直播服务器再将所述视频解码头参数和所述音频解码头参数转发给所述观众端设备。Transmitting, by the encoding process, the video decoding header parameter and the audio decoding header parameter to the main control process, so that the main control process sends the video decoding header parameter and the audio decoding header parameter to the The live broadcast server forwards the video decoding header parameter and the audio decoding header parameter to the audience end device.
具体来讲,主控进程向编码进程发送初始化init_encoder命令。该命令包括用于指导编码进程确定解码头参数的额定参数,而额定参数则由主控进程根据主播的选择确定。在本发明实施例中,额定参数包括但不限于分辨率信息(宽度width和高度height),视频码率videoBitrate,视频帧率fps,视频编码器类型videoCodec,音频编码器的声道数audioChannel,音频采样率audioSampleRate,音频码率audioBitrate,以及音频编码器类型audioCodec。Specifically, the master process sends an initialization init_encoder command to the encoding process. The command includes a nominal parameter for directing the encoding process to determine the decoding header parameters, and the nominal parameter is determined by the master process based on the selection of the anchor. In the embodiment of the present invention, the rated parameters include but are not limited to resolution information (width width and height height), video bit rate videoBitrate, video frame rate fps, video encoder type videoCodec, audio encoder channel number audioChannel, audio The sampling rate is audioSampleRate, the audio bit rate audioBitrate, and the audio encoder type audioCodec.
编码进程从RPC通道接收初始化init_encoder命今后,通过初始化服务函数init_encoder响应,具体地:调用CreateMediaFile函数创建一个多媒体文件IMediaFile接口;然后根据init_encoder命令中的视频编码器类型videoCodec调用IMediaFile接口的CreateEncoder方法创建一个类型为videoCodec的视频编码器接口videoEncoder,以及根据init_encoder命令中的音频编码器类型audioCodec调用CreateEncoder方法创建一个类型为audioCodec的视频编码器接口audioEncoder;调用视频编码器接口videoEncoder的Open方法将编码视频的宽度width、高度height、视频码率videoBitrate、视频帧率fps作为参数来初始化视频编码器接口IMediaEncoder,以及调用音频编码器audioEncoder的Open方法,将音频编码 器的声道数audioChannel、音频采样率audioSampleRate、音频码率audioBitrate作为参数来初始化音频编码器audioEncoder。The encoding process receives the initialization init_encoder from the RPC channel, and responds by initializing the service function init_encoder. Specifically, the CreateMediaFile function is called to create a multimedia file IMediaFile interface. Then, according to the video encoder type videoCodec in the init_encoder command, the CreateEncoder method of the IMediaFile interface is used to create a VideoEncoder interface videoEncoder of type videoCodec, and a video encoder interface audioEncoder of type audioCodec according to the audio encoder type audioCodec in the init_encoder command. The Open method that calls the video encoder interface videoEncoder will encode the width of the video. Width, height height, video bit rate videoBitrate, video frame rate fps as parameters to initialize the video encoder interface IMediaEncoder, and call the audio encoder audioEncoder Open method to encode the audio The audio channel audioEncoder is initialized by the audio channel of the device, the audio sample rate audioSampleRate, and the audio bit rate audioBitrate as parameters.
接着,编码进程调用IMediaFile接口的readVideoHeader获取到视频编码器接口IMediaEncoder的视频解码头参数videoHeader,以及调用IMediaFile接口的readAudioHeader方法获取音频编码器audioEncoder的音频解码头参数audioHeader。Then, the encoding process calls the readVideoHeader of the IMediaFile interface to obtain the video decoding header parameter videoHeader of the video encoder interface IMediaEncoder, and the readAudioHeader method of the IMediaFile interface to obtain the audio decoding header parameter audioHeader of the audio encoder audioEncoder.
然后,编码进程将获取到的视频解码头参数videoHeader和音频解码头参数audioHeader通过RPC通道发送给主控进程。而主控进程则会进一步将的视频解码头参数videoHeader和音频解码头参数audioHeader发送给直播服务器,进而直播服务器将的视频解码头参数videoHeader和音频解码头参数audioHeader发送给各个观众端设备。那么,观众端设备就可以根据的视频解码头参数videoHeader和音频解码头参数audioHeader对视频和音频进行解码播放。Then, the encoding process sends the obtained video decoding header parameter videoHeader and the audio decoding header parameter audioHeader to the main control process through the RPC channel. The main control process further sends the video decoding header parameter videoHeader and the audio decoding header parameter audioHeader to the live broadcast server, and the live video server sends the video decoding header parameter videoHeader and the audio decoding header parameter audioHeader to each viewer device. Then, the viewer device can decode and play the video and audio according to the video decoding header parameter videoHeader and the audio decoding header parameter audioHeader.
获得解码头参数后,就可以获取编码的视频流了。在本发明实施例中,S104中通过编码进程获得编码视频流具体通过如下过程:After obtaining the decoding header parameters, the encoded video stream can be obtained. In the embodiment of the present invention, obtaining an encoded video stream by using an encoding process in S104 is specifically performed by the following process:
所述编码进程接收所述主控进程发送的编码命令;The encoding process receives an encoding command sent by the master control process;
基于所述编码命令,从所述视频分享内存中提取由所述主控进程预先存储的视频材料,以及从所述音频分享内存中提取由所述主控进程预先存储的音频材料;Extracting, according to the encoding command, the video material pre-stored by the master control process from the video sharing memory, and extracting audio material pre-stored by the master control process from the audio sharing memory;
运行所述视频流编码服务函数对所述视频材料进行编码,获得视频编码数据,以及对所述音频材料进行编码,获取音频编码数据,所述视频流包括所述视频编码数据和所述音频编码数据;Running the video stream encoding service function to encode the video material, obtain video encoded data, and encoding the audio material to obtain audio encoded data, the video stream including the video encoded data and the audio encoding data;
将所述视频编码数据和所述音频编码数据反馈给所述主控进程。And feeding back the video encoded data and the audio encoded data to the master process.
具体来讲,主控进程根据前文获得的视频共享内存的标识,将需要编码的视频材料预先存储到视频共享内存中,以及根据前文获得的音频共享内存的标识,将需要编码的音频材料预先存储到音频共享内存中。在具体实现过程中,视频材料和音频材料的内容通常是匹配的,例如来源于同一个文件或者均有主播端设备采集。然后,在需要编码出视频流时,主控进程通过与编码进程间的RPC通道向编码进程发送编码命令encode_raw_buffer。Specifically, the main control process pre-stores the video material to be encoded into the video shared memory according to the identifier of the video shared memory obtained in the foregoing, and pre-stores the audio material to be encoded according to the identifier of the audio shared memory obtained in the foregoing. Into the audio shared memory. In the specific implementation process, the content of the video material and the audio material are usually matched, for example, from the same file or collected by the anchor device. Then, when the video stream needs to be encoded, the master process sends an encoding command encode_raw_buffer to the encoding process through the RPC channel between the encoding process.
编码进程接收到encode_raw_buffer命今后,通过编码函数响应,具体地:调用videoEncoder接口的Encode方法,读取视频共享内存中的视频材料进行编码,将视频编码数据返回给主控进程;以及调用audioEncoder的Encode方法,对音频共享内存中的音频材料进行编码,将音频编码数据返回给主控进程。其中,视频编码数据和音频编码数据构成视频流,二者根据时间轴对应。 After the encoding process receives the encode_raw_buffer command, it responds by the encoding function, specifically: calling the Encode method of the videoEncoder interface, reading the video material in the video shared memory for encoding, returning the video encoded data to the main control process; and calling the Encode of the audioEncoder The method encodes the audio material in the audio shared memory, and returns the audio encoded data to the main control process. The video encoded data and the audio encoded data constitute a video stream, and the two correspond to each other according to a time axis.
以上就是对编码进程编码视频流的介绍。通过上述过程,编码进程就实现了单独编码视频流。The above is an introduction to encoding the video stream of the encoding process. Through the above process, the encoding process implements a separately encoded video stream.
主控进程接收到来自编码进程返回的视频流后,将视频流存入发送队列中发送到直播服务器。进而,直播服务器在接收视频流后,再将视频流转发给各个观众端设备,观众端设备对接收到的视频流依次解码,进而向用户播放主播的直播视频,由此完成直播。After receiving the video stream returned by the encoding process, the master process stores the video stream in the sending queue and sends it to the live server. Then, after receiving the video stream, the live broadcast server forwards the video stream to each viewer device, and the viewer device sequentially decodes the received video stream, and then plays the live broadcast video of the anchor to the user, thereby completing the live broadcast.
另外,在具体实现过程中,编码进程可能由于异常的而崩溃,为了使主播端直播应用程序能够继续编码进而继续直播,本发明实施例中的直播方法还可以进一步包括:In addition, in the specific implementation process, the encoding process may be crashed due to an abnormality. In order to enable the broadcast application to continue to be encoded and continue to be broadcasted, the live broadcast method in the embodiment of the present invention may further include:
所述主控进程监控所述编码进程是否崩溃;The master process monitors whether the encoding process crashes;
如果所述主控进程监控到所述编码进程崩溃,所述主控进程重新创建所述编码进程。If the master process monitors that the encoding process crashes, the master process re-creates the encoding process.
具体来讲,主控进程监控编码进程的运行状态,如果监控到编码进程崩溃,则按照上文介绍的创建编码进程的方式重新创建编码进程,此处就不再重复赘述了。Specifically, the master process monitors the running status of the encoding process. If the encoding process crashes, the encoding process is re-created in the manner described above for creating the encoding process, and the description is not repeated here.
以上是对编码进程的介绍,下面对插件加载进程以及插件加载的方法进行介绍。The above is an introduction to the encoding process. The following describes the plugin loading process and the method of plugin loading.
在本发明实施例中,主播端直播应用程序的插件加载在插件加载进程内部,进而即使插件异常也不会影响主控进程的运行。类似于编码进程,插件进程也通过RPC通道与主控进程连接,并且,插件进程为了模拟出插件加载到主控进程的环境,会通过RPC通道调用主控进程的相关接口,使插件可以正常加载和运行。In the embodiment of the present invention, the plug-in of the live broadcast application of the anchor is loaded inside the plug-in loading process, and even if the plug-in is abnormal, the operation of the master process is not affected. Similar to the encoding process, the plug-in process is also connected to the master process through the RPC channel, and the plug-in process invokes the relevant interface of the master process through the RPC channel in order to simulate the environment in which the plug-in is loaded into the master process, so that the plug-in can be loaded normally. And running.
现有技术的主控进程在加载插件之前,需要知道有哪些插件,所以在加载插件之前,需要枚举插件。本发明实施例中的插件加载进程在加载插件之前,也需要向主控进程枚举插件。具体地,在插件加载进程在插件加载进程中加载需要在主播端直播应用程序中加载的目标插件之前,还包括:The prior art master process needs to know which plugins are available before loading the plugin, so the plugin needs to be enumerated before the plugin is loaded. The plug-in loading process in the embodiment of the present invention also needs to enumerate the plug-in to the main control process before loading the plug-in. Specifically, before the plugin loading process loads the target plugin that needs to be loaded in the live broadcast application in the plugin loading process, the plugin loading process further includes:
所述主控进程创建插件枚举器进程;The master process creates a plugin enumerator process;
所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件;The plug-in enumerator process enumerates, to the master process, an alternative plug-in that exists in the current load directory and can be loaded;
所述主控进程确定从所述备选插件中确定出所述目标插件,并通知所述插件加载进程所述目标插件。The master process determines to determine the target plugin from the candidate plugin, and notifies the plugin to load the target plugin.
首先对主控进程创建插件枚举器进程的过程进行介绍,主控进程通过如下方式创建插件枚举器进程:First, the process of creating a plug-in enumerator process by the master process is introduced. The master process creates a plug-in enumerator process by:
所述主控进程调用进程创建函数; The master process calls a process creation function;
所述主控进程将所述主控进程的ID传入所述进程创建函数;The master process sends the ID of the master process to the process creation function;
所述主控进程运行所述进程创建函数创建所述插件枚举器进程,所述插件枚举器进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。The master process runs the process creation function to create the plug-in enumerator process, after the plug-in enumerator process is initialized, initializes the process environment, and based on the master control of the process creation function The ID of the process is connected to the master process.
主控进程加载RpcPluginManager远程插件管理器模块,该模块负责插件枚举器进程RpcPluginFinder的创建,并且命令RpcPluginFinder枚举插件的功能。将RpcPluginManager模块加载到主控进程中后,调用该模块中的CreatePluginManager函数,创建一个插件管理器接口IPluginManager。The master process loads the RpcPluginManager Remote Plugin Manager module, which is responsible for the creation of the plugin enumerator process RpcPluginFinder and commands the RpcPluginFinder to enumerate the functionality of the plugin. After loading the RpcPluginManager module into the main control process, call the CreatePluginManager function in the module to create a plugin manager interface IPluginManager.
接下来,主控进程调用插件管理器接口IPluginManager的初始化init方法,使init方法进一步调用Windows系统的进程创建函数CreateProcess创建插件枚举器进程RpcPluginFinder。在调用CreateProcess函数时,主控进程也会将主控进程的进程ID当做命令行参数传递给CreateProcess函数。Next, the master process calls the initialization init method of the plugin manager interface IPluginManager, so that the init method further calls the Windows system process creation function CreateProcess to create the plugin enumerator process RpcPluginFinder. When the CreateProcess function is called, the master process also passes the process ID of the master process as a command line argument to the CreateProcess function.
接下来,主控进程运行创建函数CreateProcess就可以创建出插件枚举器进程RpcPluginFinder了。Next, the master process runs the create function CreateProcess to create the plugin enumerator process RpcPluginFinder.
通过上述过程就完成了插件枚举器进程的创建。而插件枚举器进程在创建完成后,也需要初始化进程环境,以及建立与主控进程的连接。具体来讲,插件枚举器进程通过如下过程初始化环境:Through the above process, the creation of the plugin enumerator process is completed. After the plug-in enumerator process is created, it also needs to initialize the process environment and establish a connection with the master process. Specifically, the plugin enumerator process initializes the environment through the following process:
在所述插件枚举器进程中注册枚举插件函数和枚举退出函数;Registering the enumeration plugin function and the enumeration exit function in the plugin enumerator process;
获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。Obtaining an ID of the master process that the process creation function has is connected to the master process.
具体来讲,通过调用RpcCreatelnstance创建一个RPC通信客户端实例句柄hRpc;调用RpcRegisterProcedure函数,将枚举插件的功能函数,即枚举插件函数get_plugins注册到hRpc中,枚举插件函数用于响应主控进程的枚举插件指令去枚举插件;调用RpcRegisterProcedure函数,将枚举退出函数也注册到hRpc中,枚举退出函数用于响应主控进程获取到所有插件后发送的枚举退出指令,使插件枚举进程退出;根据命令行中的主控进程的进程ID,调用RpcStartService函数,建立与主控进程之间的RPC通道;调用主控进程的client_process_ready函数,以通知主控进程插件枚举器进程初始化完成。Specifically, an RPC communication client instance handle hRpc is created by calling RpcCreatelnstance; the RpcRegisterProcedure function is called, and the function function of the enumeration plug-in, that is, the enumeration plug-in function get_plugins is registered to hRpc, and the enumeration plug-in function is used to respond to the master process. The enumeration plugin instruction enumerates the plugin; calls the RpcRegisterProcedure function, and registers the enumeration exit function to hRpc. The enumeration exit function is used to respond to the enumeration exit instruction sent by the master process after all the plugins are obtained, so that the plugin is The process exits; according to the process ID of the master process in the command line, the RpcStartService function is called to establish an RPC channel with the master process; the client_process_ready function of the master process is called to notify the master process that the plugin enumerator process is initialized. carry out.
主控进程根据插件枚举器进程对client_process_ready函数的调用,从RPC通道内获取到插件枚举器进程在RPC连接中的sessionld会话ID,并确定插件枚举器进程环境初始化完成,进而在后续过程中根据需要通知插件枚举器进程枚举插件。The main control process obtains the sessionld session ID of the plug-in enumerator process in the RPC connection from the RPC channel according to the call of the plugin enumerator process to the client_process_ready function, and determines that the plug-in enumerator process environment initialization is completed, and then in the subsequent process. Invoke the plugin enumerator process to enumerate plugins as needed.
通过上述过程,就完成了对插件枚举器进程的创建。接下来,对插件枚举器进程具体的枚举过程进行介绍。插件枚举器进程向主控进程枚举当前加载目录中存在的且能够加载的备选插件,包括: Through the above process, the creation of the plugin enumerator process is completed. Next, the specific enumeration process of the plug-in enumerator process is introduced. The plugin enumerator process enumerates to the master process the candidate plugins that are present in the current load directory and that can be loaded, including:
所述插件枚举器接收所述主控进程发送的枚举指令,调用所述枚举插件函数进程读取所述加载目录下的所有插件;The plug-in enumerator receives an enumeration instruction sent by the master control process, and invokes the enumeration plug-in function process to read all plug-ins in the loading directory;
从所有的所述插件中过滤出合法插件;Filter out legitimate plugins from all of the plugins;
从所述合法插件中过滤出所述主播端直播应用程序支持的所述备用插件。Extracting the backup plug-in supported by the anchor live application from the legal plug-in.
具体来讲,本发明实施例中的备选插件指的是供主控进程选择加载的插件。当主控进程需要加载插件时,会先向插件枚举器进程发送枚举指令,获得所有备选插件。插件枚举器进程从RPC通道接收到主控进程发送的枚举指今后,调用枚举函数get_plugins枚举当前加载目录下的所有插件。Specifically, the candidate plug-in in the embodiment of the present invention refers to a plug-in that is selected and loaded by the master process. When the master process needs to load the plugin, it will first send an enumeration instruction to the plugin enumerator process to get all the alternative plugins. The plug-in enumerator process receives the enumeration sent by the master process from the RPC channel. In the future, the enumeration function get_plugins is called to enumerate all the plug-ins in the current load directory.
具体来讲,get_plugins函数调用FindFirstFile函数,获取加载目录下的第一个DLL(动态链接库,Dynamic Link Library)文件。接着,get_plugins函数调用FindNextFile函数继续获取加载目录下的下一个DLL文件。如果FindNextFile函数返回值为真,表示获取到了下一个DLL文件,则再次执行FindNextFile函数,继续获取下一个DLL文件;如果FindNextFile函数返回值为假时,表示已经获取完加载目录下的所有DLL文件。只要FindNextFile函数的返回值为真,则进行获取下一个DLL文件,直到FindNextFile函数返回值为假。Specifically, the get_plugins function calls the FindFirstFile function to get the first DLL (Dynamic Link Library) file in the load directory. Next, the get_plugins function calls the FindNextFile function to continue to get the next DLL file in the load directory. If the FindNextFile function returns true, it means that the next DLL file is obtained, then execute the FindNextFile function again and continue to get the next DLL file; if the FindNextFile function returns false, it means that all the DLL files in the loading directory have been obtained. As long as the return value of the FindNextFile function is true, the next DLL file is fetched until the FindNextFile function returns a false value.
在具体实现过程中,主播有可能会将一些不合法的插件添加到加载目录中,但是不合法的插件是不能加载的,因此获取到所有插件后,进一步判断获取的插件是否合法,将不合法的插件过滤掉。In the specific implementation process, the anchor may add some illegal plug-ins to the loading directory, but the illegal plug-ins cannot be loaded. Therefore, after obtaining all the plug-ins, it is illegal to further determine whether the obtained plug-ins are legal. The plugin is filtered out.
具体来讲,调用系统的LoadLibrary函数加载每个DLL文件,如果能够成功调用LoadLibrary函数,那么表示该DLL文件合法;反之,如果LoadLibrary函数调用失败,那么表示该DLL文件不合法。针对每个DLL文件调用LoadLibrary函数后,将不合法的DLL文件从加载目录中卸载,将合法DLL文件保留。Specifically, the LoadLibrary function of the calling system loads each DLL file. If the LoadLibrary function can be successfully called, the DLL file is legal. Otherwise, if the LoadLibrary function fails, the DLL file is invalid. After calling the LoadLibrary function for each DLL file, the illegal DLL file is unloaded from the load directory, and the legal DLL file is retained.
进一步,对于主播端直播应用程序而言,尽管一个插件是合法的,但是主播端直播应用程序也有可能不支持该插件,因此在本发明实施例中,为了保证最终为主控进程提供的备选插件均为主播端直播应用程序支持的插件,还需要进一步针对合法DLL文件进行过滤,从而得到主播端直播应用程序支持的插件。Further, for the anchor-side live application, although a plug-in is legal, the anchor-side live application may not support the plug-in. Therefore, in the embodiment of the present invention, in order to ensure an alternative provided for the final control process. The plug-ins are all plug-ins supported by the live broadcast application on the host, and further need to be filtered for the legal DLL file to obtain the plug-in supported by the broadcast application of the anchor.
在具体实现过程中,插件枚举器进程按照不同的支持条件进行过滤,本发明不做具体限制。举例来说,主播端直播应用程序所支持的插件具体为具备导出函数的插件,那么,具体判断合法插件是否能够被支持的方法为:调用系统的GetProcAddress函数获取一个合法DLL文件中的导出函数,如果能够获取到导出函数,则确定该DLL文件对应的插件为主播端直播应用程序可以支持的插件,进而将该插件保留为备选插件;反之,如果未获取到导出函数,则确定该DLL文件对应的插件为主播端直播应用程序不支持的插件,进而从加载目录中 卸载该插件。In the specific implementation process, the plug-in enumerator process performs filtering according to different supporting conditions, and the present invention does not specifically limit. For example, the plug-in supported by the host-side live application is specifically a plug-in with an export function. Then, the specific method for determining whether the legal plug-in can be supported is: calling the GetProcAddress function of the system to obtain the export function in a legal DLL file. If the export function can be obtained, it is determined that the plug-in corresponding to the DLL file is a plug-in that the live broadcast application can support, and then the plug-in is reserved as an alternative plug-in; otherwise, if the export function is not obtained, the DLL file is determined. The corresponding plug-in is a plug-in that is not supported by the live broadcast application, and is then loaded from the directory. Uninstall the plugin.
通过上述过程,就获得了一个或多个备选插件。接下来,插件枚举器进程通过与主控进程的RPC通道,将确定出的备选插件的名称提供给主控进程。Through the above process, one or more alternative plugins are obtained. Next, the plugin enumerator process provides the name of the determined alternative plugin to the master process through the RPC channel with the master process.
进一步,为了节约主播端设备的系统资源,在插件枚举器进程向主控进程枚举当前加载目录中存在的且能够加载的备选插件之后,还包括:Further, in order to save system resources of the anchor device, after the plug-in enumerator process enumerates the candidate plug-ins existing in the current loading directory and can be loaded to the main control process, the method further includes:
所述主控进程向所述插件枚举器进程发送退出指令;The master process sends an exit instruction to the plug-in enumerator process;
所述插件枚举器基于所述退出指令调用所述枚举退出函数结束进程。The plug-in enumerator invokes the enumeration exit function to end the process based on the exit instruction.
具体来讲,主控进程在接收到插件枚举器进程枚举的插件后,向插件枚举进程发送退出指令。插件枚举器进程接收退出指令后,调用枚举退出函数退出插件枚举器进程。Specifically, after receiving the plugin enumerated by the plugin enumerator process, the master process sends an exit instruction to the plugin enumeration process. After the plugin enumerator process receives the exit instruction, it calls the enumeration exit function to exit the plugin enumerator process.
接下来,主控进程自动从备选插件中选取目标插件,或者根据主播的选取操作确定对应的目标插件,然后通过与插件加载进程的RPC通道,将目标插件的名称通知插件加载进程。进而,插件加载进程根据目标进程的名称获取目标插件的DLL文件,从而加载并运行目标插件。Next, the master process automatically selects the target plugin from the candidate plugin, or determines the corresponding target plugin according to the selection operation of the anchor, and then notifies the plugin loading process by the name of the target plugin through the RPC channel of the plugin loading process. Further, the plug-in loading process acquires the target plug-in DLL file according to the name of the target process, thereby loading and running the target plug-in.
一个具体的例子,假设当前加载的插件需要调用主控进程的加法方法才能加载,那么,插件加载进程通过与主控进程的RPC通道调用主控进程的加法方法,使插件检测到加法方法,从而能够成功加载。进一步,主控进程调用插件运行,插件加载进程通过与主控进程的RPC通道接收主控进程发送的触发该插件运行的指令,进而触发该插件运行。该插件运行过程中需要使用减法方法,那么,插件加载进程通过与主控进程的RPC通道调用主控进程的减法方法,使该插件使用减法方法进行处理,从而获得处理结果。插件加载进程获取该插件运行的结果,通过与主控进程的RPC通道将该插件的运行结果反馈给主控进程。A specific example, assuming that the currently loaded plug-in needs to call the adding method of the master process to load, then the plug-in loading process calls the adding method of the master process by calling the RPC channel of the master process, so that the plug-in detects the adding method, thereby Can load successfully. Further, the main control process invokes the plug-in to run, and the plug-in loading process receives the instruction that is triggered by the main control process and is triggered by the main control process, and triggers the plug-in to run. The plug-in loading process needs to use the subtraction method. Then, the plug-in loading process calls the subtraction method of the master process by calling the RPC channel of the master process, so that the plug-in uses the subtraction method to process, thereby obtaining the processing result. The plug-in loading process obtains the result of running the plug-in, and feeds back the running result of the plug-in to the main control process through the RPC channel of the main control process.
另外,如果加载的插件会产生图像和音频,即插件需要向主播展示图像和声音,那么插件加载进程则需要通过与主控进程的RPC通道将插件产生的图像和音频传输到主控进程。然后,主控进程再根据插件产生的图像绘制窗口展示图像,以及通过播放器播放音频,从而将插件产生的图像和声音展示给主播。In addition, if the loaded plug-in generates images and audio, that is, the plug-in needs to display images and sounds to the anchor, the plug-in loading process needs to transfer the images and audio generated by the plug-in to the master process through the RPC channel of the master process. Then, the master process displays the image according to the image drawing window generated by the plug-in, and plays the audio through the player, thereby displaying the image and sound generated by the plug-in to the anchor.
当然,主控进程同样也需要监控插件加载进程,因此本发明实施例还包括以下方案:Of course, the master process also needs to monitor the plug-in loading process. Therefore, the embodiment of the present invention further includes the following solutions:
所述主控进程监控所述插件加载进程是否崩溃;The master process monitors whether the plug-in loading process crashes;
如果所述主控进程监控到所述插件加载进程崩溃,重新创建所述插件加载进程。If the master process monitors that the plugin loading process crashes, re-create the plugin loading process.
具体来讲,主控进程监控插件加载进程的运行状态,如果监控到插件加载进程崩溃,则按照上文介绍的创建插件枚举器进程和插件加载进程的方式重新创建插件枚举器进程和插件加载进程,此处就不再重复赘述了。 Specifically, the master process monitors the running state of the plug-in loading process. If the plug-in loading process is detected to crash, the plug-in enumerator process and plug-in are recreated by creating a plug-in enumerator process and a plug-in loading process as described above. The loading process is not repeated here.
基于与前述实施例中直播的方法同样的发明构思,本发明第二方面还提供一种直播的装置,如图2所示,包括:Based on the same inventive concept as the method of the live broadcast in the foregoing embodiment, the second aspect of the present invention further provides a live broadcast device, as shown in FIG. 2, including:
启动单元101,用于启动主播端直播应用程序;The startup unit 101 is configured to start a live broadcast application of the anchor end;
主控进程获取单元102,用于获取所述主播端直播应用程序的主控进程;The master control process obtaining unit 102 is configured to acquire a master control process of the live broadcast application of the anchor end;
进程创建单元103,用于创建编码进程和/或插件加载进程,所述编码进程用于基于所述主控进程的控制编码出视频流,并向所述主控进程反馈所述视频流,所述插件加载进程用于在所述插件加载进程中加载插件,并根据所述主控进程的控制调用加载的插件;The process creation unit 103 is configured to create an encoding process and/or a plug-in loading process, where the encoding process is used to encode a video stream based on the control of the master process, and feed back the video stream to the master process. The plug-in loading process is configured to load a plug-in in the plug-in loading process, and invoke the loaded plug-in according to the control of the master process;
视频流获取单元104,用于获取所述视频流;a video stream obtaining unit 104, configured to acquire the video stream;
发送单元105,用于将所述视频流发送至直播服务器,以使所述直播服务器将所述视频流转发给接入所述直播服务器的观众端设备。The sending unit 105 is configured to send the video stream to a live broadcast server, so that the live broadcast server forwards the video stream to a viewer device that accesses the live broadcast server.
具体来讲,所述主控进程获取单元102用于判断预先设置的所述主播端直播应用程序的运行模式;如果所述运行模式为第一模式,创建所述主播端直播应用程序的所述主控进程,其中,在所述第一模式下,所述主控进程将创建所述编码进程和所述插件加载进程;如果所述运行模式为第二模式,获取预设的所述主控进程的地址,并基于所述地址接入所述主控进程,其中,在所述第二模式下,所述主控进程将创建所述编码进程和所述插件加载进程。Specifically, the master control process obtaining unit 102 is configured to determine a preset operation mode of the anchor live application, and if the operation mode is the first mode, create the a master process, wherein, in the first mode, the master process creates the encoding process and the plug-in loading process; if the running mode is the second mode, acquiring the preset master An address of the process, and accessing the master process based on the address, wherein, in the second mode, the master process creates the encoding process and the plug-in loading process.
进一步,所述装置还包括:Further, the device further includes:
模式判断单元,用于在所述通过所述主控进程创建编码进程或插件加载进程之前,判断预先设置的所述主播端直播应用程序的运行模式;a mode determining unit, configured to determine, before the creating a coding process or a plug-in loading process by the main control process, a preset operation mode of the live broadcast application of the anchor end;
标记获取单元,用于如果所述运行模式为第三模式,在创建编码进程和/或插件加载进程之前,获取表示需要创建所述编码进程和/或所述插件加载进程的标记位;a mark obtaining unit, configured to: if the running mode is the third mode, acquire a mark bit indicating that the encoding process and/or the plug-in loading process needs to be created before creating an encoding process and/or a plug-in loading process;
如果所述标记位为第一标记位,所述进程创建单元103具体用于通过所述主控进程创建所述插件加载进程;If the flag bit is the first tag bit, the process creation unit 103 is specifically configured to create the plug-in loading process by using the master process;
如果所述标记位为第二标记位,所述进程创建单元103具体用于通过所述主控进程创建所述编码进程。If the flag bit is the second flag bit, the process creation unit 103 is specifically configured to create the encoding process by using the master process.
进一步,如果所述主控进程创建了所述编码进程,所述视频流获取单元104用于向编码存根模块发送编码指令,以通知所述编码进程编码视频流,所述编码进程调用与所述编码存根模块连接的编码本地服务模块编码出所述视频流,所述编码进程调用与所述编码本地服务模块连接的编码代理接口模块向所述视频流获取单元反馈编码出的所述视频流。Further, if the master process creates the encoding process, the video stream obtaining unit 104 is configured to send an encoding instruction to the encoding stub module to notify the encoding process to encode a video stream, where the encoding process is invoked and An encoding local service module coupled to the encoding stub module encodes the video stream, and the encoding process invokes an encoding proxy interface module coupled to the encoding local service module to feed back the encoded video stream to the video stream obtaining unit.
而如果所述主控进程未创建所述编码进程,所述视频流获取单元104则用于向编码存根模块发送编码指令,所述编码存根模块调用与所述编码存根模块 连接的编码本地服务模块编码出所述视频流,所述编码本地服务模块调用与所述编码本地服务模块连接的编码代理接口模块向所述视频流获取单元反馈编码出的所述视频流。If the master process does not create the encoding process, the video stream obtaining unit 104 is configured to send an encoding instruction to the encoding stub module, where the encoding stub module invokes the encoding stub module. The coupled coded local service module encodes the video stream, and the coded local service module invokes a coded proxy interface module coupled to the coded local service module to feed back the encoded video stream to the video stream acquisition unit.
(1)如果本发明实施例需要创建编码进程,那么所述进程创建单元103用于调用进程创建函数,将所述主控进程的ID传入所述进程创建函数,运行所述进程创建函数创建所述编码进程,所述编码进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。(1) If the embodiment of the present invention needs to create an encoding process, the process creating unit 103 is configured to invoke a process creation function, pass the ID of the master process to the process creation function, and run the process creation function to create The encoding process, after the creation process is completed, initialize the process environment, and connect the master control process based on the ID of the master process that the process creation function has.
进一步,所述装置还包括编码进程环境初始单元,用于在所述编码进程创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,具体用于在所述编码进程中注册初始化服务函数和视频流编码服务函数,创建存储视频材料的视频共享内存以及存储音频材料的音频共享内存,获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,基于所述编码进程与所述主控进程的连接,向所述主控进程发送所述视频共享内存的标识和所述音频共享内存的标识。Further, the device further includes an encoding process environment initial unit, configured to initialize a process environment after the encoding process is completed, and connect the master control based on an ID of the master process that the process creation function has a process, specifically for registering an initialization service function and a video stream encoding service function in the encoding process, creating a video shared memory storing a video material, and storing an audio shared memory of the audio material, acquiring the method that the process creation function has The ID of the master process is connected to the master process, and the identifier of the video shared memory and the identifier of the audio shared memory are sent to the master process based on the connection between the code process and the master process.
更进一步,所述装置还包括编码初始化单元,用于在所述通过所述编码进程编码出视频流并反馈给所述主控进程之前,向所述编码进程发送初始化命令,所述初始化命令包括用于指导所述编码进程确定解码头参数的额定参数,所述解码头参数包括视频解码头参数和音频解码头参数,基于所述初始命令运行所述初始化服务函数,以基于所述额定参数获得所述视频解码头参数和所述音频解码头参数,向所述主控进程反馈所述视频解码头参数和所述音频解码头参数,以使所述主控进程将所述视频解码头参数和所述音频解码头参数发送至所述直播服务器,所述直播服务器再将所述视频解码头参数和所述音频解码头参数转发给所述观众端设备。Further, the apparatus further includes an encoding initialization unit, configured to send an initialization command to the encoding process before the encoding the video stream by the encoding process and feeding back to the main control process, where the initialization command includes a nominal parameter for directing the encoding process to determine a decoding header parameter, the decoding header parameter including a video decoding header parameter and an audio decoding header parameter, the initialization service function being executed based on the initial command to obtain based on the nominal parameter Transmitting the video decoding header parameter and the audio decoding header parameter to the main control process, so that the main control process sets the video decoding header parameter and the audio decoding header parameter The audio decoding header parameter is sent to the live broadcast server, and the live broadcast server forwards the video decoding header parameter and the audio decoding header parameter to the audience end device.
所述视频流获取单元104用于接收所述主控进程发送的编码命令;基于所述编码命令,从所述视频分享内存中提取由所述主控进程预先存储的视频材料,以及从所述音频分享内存中提取由所述主控进程预先存储的音频材料;运行所述视频流编码服务函数对所述视频材料进行编码,获得视频编码数据,以及对所述音频材料进行编码,获取音频编码数据,所述视频流包括所述视频编码数据和所述音频编码数据;将所述视频编码数据和所述音频编码数据反馈给所述主控进程。The video stream obtaining unit 104 is configured to receive an encoding command sent by the master control process, and extract, according to the encoding command, a video material pre-stored by the master control process from the video sharing memory, and from the Extracting audio material pre-stored by the master process in the audio sharing memory; running the video stream encoding service function to encode the video material, obtaining video encoded data, and encoding the audio material to obtain audio encoding Data, the video stream including the video encoded data and the audio encoded data; and the video encoded data and the audio encoded data are fed back to the master process.
更进一步,所述装置还包括编码进程监控单元,用于监控所述编码进程是否崩溃;如果监控到所述编码进程崩溃,重新创建所述编码进程。Further, the apparatus further includes an encoding process monitoring unit configured to monitor whether the encoding process crashes; if the encoding process is detected to crash, re-creating the encoding process.
(2)如果所述主控进程创建了所述插件加载进程,所述装置还包括: (2) If the master process creates the plug-in loading process, the device further includes:
插件加载单元,用于在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件。a plug-in loading unit, configured to load a target plug-in that needs to be loaded in the live application during the plug-in loading process.
那么,所述进程创建单元103还用于在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件之前,创建插件枚举器进程;Then, the process creation unit 103 is further configured to create a plug-in enumerator process before loading the target plug-in that needs to be loaded in the live application in the plug-in loading process;
所述装置还包括插件枚举单元,用于向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件;The device further includes a plug-in enumeration unit, configured to enumerate, to the master process, an optional plug-in existing in the current loading directory and loadable;
确定单元,用于确定从所述备选插件中确定出所述目标插件,并通知所述插件加载进程所述目标插件。a determining unit, configured to determine that the target plugin is determined from the candidate plugin, and notify the plugin to load the target plugin.
具体来讲,所述进程创建单元103用于调用进程创建函数,将所述主控进程的ID传入所述进程创建函数,运行所述进程创建函数创建所述插件枚举器进程,所述插件枚举器进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。Specifically, the process creation unit 103 is configured to invoke a process creation function, and send the ID of the master process to the process creation function, and run the process creation function to create the plug-in enumerator process. After the plug-in enumerator process is created, the process environment is initialized, and the master process is connected based on the ID of the master process that the process creation function has.
进一步,所述装置还包括插件加载进程环境初始单元,用于在所述插件枚举器进程创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,具体用于在所述插件枚举器进程中注册枚举插件函数和枚举退出函数,获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。Further, the device further includes a plug-in loading process environment initial unit, configured to initialize a process environment after the plug-in enumerator process is created, and based on the ID connection of the master process that the process creation function has The master control process is specifically configured to register an enumeration plug-in function and an enumeration exit function in the plug-in enumerator process, and obtain an ID of the master control process that is included in the process creation function to connect the master control process.
更进一步,所述插件枚举单元用于接收所述主控进程发送的枚举指令,调用所述枚举插件函数进程读取所述加载目录下的所有插件;从所有的所述插件中过滤出合法插件;从所述合法插件中过滤出所述主播端直播应用程序支持的所述备用插件。Further, the plug-in enumeration unit is configured to receive an enumeration instruction sent by the master control process, invoke the enumeration plug-in function process to read all plug-ins in the loading directory, and filter from all the plug-ins. A legal plug-in is extracted; and the backup plug-in supported by the anchor live application is filtered out from the legal plug-in.
更进一步,所述装置还包括退出单元,用于在所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件之后,向所述插件枚举器进程发送退出指令,基于所述退出指令调用所述枚举退出函数结束进程。Further, the apparatus further includes an exit unit, configured to enumerate the plug-in to the plug-in after the plug-in enumerator process enumerates the candidate plug-in existing in the current load directory and can be loaded to the master process The process sends an exit instruction, and the enumeration exit function is called to end the process based on the exit instruction.
更进一步,所述装置还包括插件加载进程监控单元,用于监控所述插件加载进程是否崩溃,如果监控到所述插件加载进程崩溃,重新创建所述插件加载进程。Further, the device further includes a plug-in loading process monitoring unit, configured to monitor whether the plug-in loading process crashes, and if the plug-in loading process is detected to crash, re-creating the plug-in loading process.
前述图1实施例中的直播的方法的各种变化方式和具体实例同样适用于本实施例的直播的装置,通过前述对直播的方法的详细描述,本领域技术人员可以清楚的知道本实施例中直播的装置的实施方法,所以为了说明书的简洁,在此不再详述。The various changes and specific examples of the method for performing the live broadcast in the foregoing embodiment of FIG. 1 are also applicable to the live broadcast device of the present embodiment. The foregoing description of the live broadcast method can be clearly known to those skilled in the art. The implementation method of the live broadcast device, so for the sake of brevity of the description, it will not be described in detail here.
基于与前述实施例中直播的方法同样的发明构思,本发明还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现前文所 述直播的方法的任一方法的步骤。Based on the same inventive concept as the method of live broadcast in the foregoing embodiment, the present invention further provides a computer readable storage medium having stored thereon a computer program, which is implemented by a processor to implement the foregoing The steps of any method of the method of live broadcast.
基于与前述实施例中直播的方法同样的发明构思,本发明还提供一种计算机设备,如图3所示,包括存储器204、处理器202及存储在存储器204上并可在处理器202上运行的计算机程序,所述处理器202执行所述程序时实现前文所述控制进度条的方法的任一方法的步骤。Based on the same inventive concept as the live broadcast method in the foregoing embodiment, the present invention further provides a computer device, as shown in FIG. 3, including a memory 204, a processor 202, and being stored on the memory 204 and operable on the processor 202. The computer program, the processor 202, when the program is executed, implements the steps of any of the methods of controlling the progress bar as described above.
其中,在图3中,总线架构(用总线200来代表),总线200可以包括任意数量的互联的总线和桥,总线200将包括由处理器202代表的一个或多个处理器和存储器204代表的存储器的各种电路链接在一起。总线200还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口206在总线200和接收器201和发送器203之间提供接口。接收器201和发送器203可以是同一个元件,即收发机,提供用于在传输介质上与各种其他装置通信的单元。Wherein, in FIG. 3, a bus architecture (represented by bus 200), bus 200 can include any number of interconnected buses and bridges, and bus 200 will include one or more processors and memory 204 represented by processor 202. The various circuits of the memory are linked together. The bus 200 can also link various other circuits, such as peripherals, voltage regulators, and power management circuits, as is known in the art, and therefore, will not be further described herein. Bus interface 206 provides an interface between bus 200 and receiver 201 and transmitter 203. Receiver 201 and transmitter 203 may be the same component, i.e., a transceiver, providing means for communicating with various other devices on a transmission medium.
处理器202负责管理总线200和通常的处理,而存储器204可以被用于存储处理器202在执行操作时所使用的数据。The processor 202 is responsible for managing the bus 200 and the usual processing, and the memory 204 can be used to store data used by the processor 202 when performing operations.
本申请实施例中的上述一个或多个技术方案,至少具有如下一种或多种技术效果:The above one or more technical solutions in the embodiments of the present application have at least one or more of the following technical effects:
在本发明实施例的技术方案中,首先启动主播端直播应用程序,并获取主播端直播应用程序的主控进程,然后主控进程进一步创建插件加载进程,并在插件加载进程中加载需要在直播应用程序中加载的目标插件。由于本发明实施例采用多进程,利用插件加载进程加载插件,故而插件功能的异常不会影响主控进程,所以避免了由于一个或多个功能异常而导致程序崩溃,使得主播端直播应用程序更稳定地运行,由此解决了现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。In the technical solution of the embodiment of the present invention, the host broadcast application is first started, and the main control process of the live application of the anchor is obtained, and then the main control process further creates a plug-in loading process, and the live loading process needs to be loaded in the plug-in loading process. The target plugin loaded in the application. Since the embodiment of the present invention adopts multiple processes and uses the plug-in loading process to load the plug-in, the abnormality of the plug-in function does not affect the master process, so that the program crashes due to one or more abnormal functions, so that the host-side live application is more The system runs stably, thereby solving the technical problem of how to improve the running stability of the live broadcast program on the anchor end in the prior art.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the 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, CD-ROM, optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一 个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. 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 device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Implemented in flowchart one Means of a process or a plurality of processes and/or block diagrams of a function specified in a block or blocks.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。 It is apparent that those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. Thus, it is intended that the present invention cover the modifications and modifications of the invention

Claims (10)

  1. 一种插件加载的方法,其特征在于,包括:A method for loading a plug-in, comprising:
    启动主播端直播应用程序;Start the live broadcast application on the anchor side;
    获取所述主播端直播应用程序的主控进程;Obtaining a master control process of the broadcast application of the anchor end;
    所述主控进程创建插件加载进程;The master process creates a plug-in loading process;
    所述插件加载进程在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件。The plug-in loading process loads a target plug-in that needs to be loaded in the live application in the plug-in loading process.
  2. 如权利要求1所述的方法,其特征在于,在所述插件加载进程在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件之前,还包括:The method of claim 1, wherein before the plug-in loading process loads the target plug-in to be loaded in the live application, the plug-in loading process further includes:
    所述主控进程创建插件枚举器进程;The master process creates a plugin enumerator process;
    所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件;The plug-in enumerator process enumerates, to the master process, an alternative plug-in that exists in the current load directory and can be loaded;
    所述主控进程确定从所述备选插件中确定出所述目标插件,并通知所述插件加载进程所述目标插件。The master process determines to determine the target plugin from the candidate plugin, and notifies the plugin to load the target plugin.
  3. 如权利要求2所述的方法,其特征在于,所述主控进程创建插件枚举器进程,包括:The method of claim 2 wherein said master process creates a plugin enumerator process comprising:
    所述主控进程调用进程创建函数;The master process calls a process creation function;
    所述主控进程将所述主控进程的ID传入所述进程创建函数;The master process sends the ID of the master process to the process creation function;
    所述主控进程运行所述进程创建函数创建所述插件枚举器进程,所述插件枚举器进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。The master process runs the process creation function to create the plug-in enumerator process, after the plug-in enumerator process is initialized, initializes the process environment, and based on the master control of the process creation function The ID of the process is connected to the master process.
  4. 如权利要求3所述的方法,其特征在于,所述插件枚举器进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,包括:The method according to claim 3, wherein the plug-in enumerator process initializes a process environment after the creation is completed, and connects the host based on an ID of the master process that the process creation function has Control process, including:
    在所述插件枚举器进程中注册枚举插件函数和枚举退出函数;Registering the enumeration plugin function and the enumeration exit function in the plugin enumerator process;
    获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。Obtaining an ID of the master process that the process creation function has is connected to the master process.
  5. 如权利要求4所述的方法,其特征在于,所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件,包括:The method of claim 4, wherein the plug-in enumerator process enumerates, to the master process, candidate plug-ins that are present in the current load directory and that can be loaded, including:
    所述插件枚举器接收所述主控进程发送的枚举指令,调用所述枚举插件函数进程读取所述加载目录下的所有插件;The plug-in enumerator receives an enumeration instruction sent by the master control process, and invokes the enumeration plug-in function process to read all plug-ins in the loading directory;
    从所有的所述插件中过滤出合法插件;Filter out legitimate plugins from all of the plugins;
    从所述合法插件中过滤出所述主播端直播应用程序支持的所述备用插件。Extracting the backup plug-in supported by the anchor live application from the legal plug-in.
  6. 如权利要求5所述的方法,其特征在于,在所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件之后,还包括: The method of claim 5, further comprising: after the plug-in enumerator process enumerates, to the master process, an optional plug-in that is present in the current load directory and can be loaded,
    所述主控进程向所述插件枚举器进程发送退出指令;The master process sends an exit instruction to the plug-in enumerator process;
    所述插件枚举器基于所述退出指令调用所述枚举退出函数结束进程。The plug-in enumerator invokes the enumeration exit function to end the process based on the exit instruction.
  7. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 wherein the method further comprises:
    所述主控进程监控所述插件加载进程是否崩溃;The master process monitors whether the plug-in loading process crashes;
    如果所述主控进程监控到所述插件加载进程崩溃,重新创建所述插件加载进程。If the master process monitors that the plugin loading process crashes, re-create the plugin loading process.
  8. 一种插件加载的装置,其特征在于,包括:A device for loading a plug-in, comprising:
    启动单元,用于启动主播端直播应用程序;a startup unit, configured to start a live broadcast application of the anchor;
    主控进程获取单元,用于获取所述主播端直播应用程序的主控进程;a master control process acquiring unit, configured to acquire a master control process of the live broadcast application of the anchor end;
    进程创建单元,用于创建插件加载进程;a process creation unit for creating a plugin loading process;
    插件加载单元,用于在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件。a plug-in loading unit, configured to load a target plug-in that needs to be loaded in the live application during the plug-in loading process.
  9. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现权利要求1-7任一项所述方法的步骤。A computer readable storage medium having stored thereon a computer program, characterized in that the program, when executed by a processor, implements the steps of the method of any of claims 1-7.
  10. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现权利要求1-7任一项所述方法的步骤。 A computer apparatus comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, wherein the processor executes the program to implement any one of claims 1-7 The steps of the method.
PCT/CN2017/109671 2017-10-09 2017-11-07 Plug-in loading method and apparatus WO2019071680A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710930088.0 2017-10-09
CN201710930088.0A CN107678801B (en) 2017-10-09 2017-10-09 A kind of method and apparatus of plug-in unit load

Publications (1)

Publication Number Publication Date
WO2019071680A1 true WO2019071680A1 (en) 2019-04-18

Family

ID=61139910

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/109671 WO2019071680A1 (en) 2017-10-09 2017-11-07 Plug-in loading method and apparatus

Country Status (2)

Country Link
CN (1) CN107678801B (en)
WO (1) WO2019071680A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110708366A (en) * 2019-09-24 2020-01-17 深圳市迅雷网络技术有限公司 Plug-in process management method, related method and related device

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108804082A (en) * 2018-05-10 2018-11-13 北京酷我科技有限公司 A kind of implementation method of plug-in unit JSBridge
CN109361591B (en) * 2018-07-27 2022-03-22 北京联合大学 Personal message aggregation system based on plug-in
CN109344035A (en) * 2018-09-30 2019-02-15 北京奇虎科技有限公司 A kind of progress control method of application program, device, equipment and storage medium
CN109408155B (en) * 2018-11-07 2021-11-02 北京奇艺世纪科技有限公司 Application starting method and device
CN112243140B (en) * 2019-07-16 2023-03-24 腾讯科技(北京)有限公司 Information processing method and device
CN112463335A (en) * 2020-12-03 2021-03-09 Oppo广东移动通信有限公司 Application program running method and device and storage medium
CN113656091A (en) * 2021-07-28 2021-11-16 广州虎牙科技有限公司 Method for realizing independent broadcasting process, related device and equipment
CN117076159B (en) * 2023-10-10 2024-01-05 统信软件技术有限公司 Plug-in calling method and device, electronic equipment and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102081709A (en) * 2009-12-01 2011-06-01 联想(北京)有限公司 Method and device for disabling browser plug-in and terminal
CN102156663A (en) * 2011-03-22 2011-08-17 北京书生国际信息技术有限公司 Implementation method and device of plugin
CN102426537A (en) * 2011-11-02 2012-04-25 北京数码大方科技有限公司 Method and device for calling main program progress by external integration progress in CAD (Computer - Aided Design)
CN103793224A (en) * 2014-01-17 2014-05-14 北京奇虎科技有限公司 Window display method and device
CN107613312A (en) * 2017-10-09 2018-01-19 武汉斗鱼网络科技有限公司 A kind of live method and apparatus

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100514300C (en) * 2006-06-29 2009-07-15 腾讯科技(深圳)有限公司 Progress invoking method of shared windows
US9792716B2 (en) * 2014-06-13 2017-10-17 Arcsoft Inc. Enhancing video chatting
US11595702B2 (en) * 2014-08-15 2023-02-28 Tfcf Digital Enterprises, Inc. Data repository for sports and entertainment information
CN106686420A (en) * 2016-12-09 2017-05-17 广州华多网络科技有限公司 Live streaming application program management method and apparatus
CN106713304A (en) * 2016-12-19 2017-05-24 北京星辰美豆文化传播有限公司 Webcast method, apparatus and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102081709A (en) * 2009-12-01 2011-06-01 联想(北京)有限公司 Method and device for disabling browser plug-in and terminal
CN102156663A (en) * 2011-03-22 2011-08-17 北京书生国际信息技术有限公司 Implementation method and device of plugin
CN102426537A (en) * 2011-11-02 2012-04-25 北京数码大方科技有限公司 Method and device for calling main program progress by external integration progress in CAD (Computer - Aided Design)
CN103793224A (en) * 2014-01-17 2014-05-14 北京奇虎科技有限公司 Window display method and device
CN107613312A (en) * 2017-10-09 2018-01-19 武汉斗鱼网络科技有限公司 A kind of live method and apparatus

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110708366A (en) * 2019-09-24 2020-01-17 深圳市迅雷网络技术有限公司 Plug-in process management method, related method and related device

Also Published As

Publication number Publication date
CN107678801A (en) 2018-02-09
CN107678801B (en) 2018-09-04

Similar Documents

Publication Publication Date Title
WO2019071680A1 (en) Plug-in loading method and apparatus
WO2019071678A1 (en) Live broadcasting method and device
US7441020B2 (en) Media plug-in registration and dynamic loading
US10547657B2 (en) System and method for video gathering and processing
WO2017124842A1 (en) Method and device for taking screenshots
WO2021185302A1 (en) Live streaming and configuration method based on cloud phones, and related apparatus and system
CN113542757B (en) Image transmission method and device for cloud application, server and storage medium
CN111510780B (en) Video live broadcast control, bridging, flow control and broadcast control method and client
WO2014089793A1 (en) Method, device, and system for video redirection and computer readable medium
KR101931514B1 (en) Apparatus and method for simultaneous playback and backup of media in a web browser
WO2020151660A1 (en) Stb cloudification method and system, thin stb, virtual stb and platform, and storage medium
US10178170B2 (en) Browser-based virtual media administration
EP3474559B1 (en) Smart-television playback method and apparatus
WO2022022174A1 (en) Data processing method and apparatus for virtual scene, and electronic device and storage medium
CN104349177A (en) Method for turning to play multimedia file under desktop cloud, virtual machine and system
CN114040251A (en) Audio and video playing method, system, storage medium and computer program product
WO2019071679A1 (en) Method and device for live streaming
US20130282916A1 (en) Automation framework to remotely control devices and process asynchronous events
US11838589B2 (en) Port-connected television upgrader device
US11245885B2 (en) Method and system for playing media data
US20200112768A1 (en) Network-based media device upgrading system
US11089381B2 (en) Apparatus and method for simultaneous playback and backup of media in a web browser
WO2021078208A1 (en) Information acquisition method, cloudified set top box system, entity set top box, and storage medium
US11190842B2 (en) USB-based media device upgrading system
CN112333529A (en) Live streaming loading method and device, equipment and medium thereof

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17928122

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17928122

Country of ref document: EP

Kind code of ref document: A1