WO2019071679A1 - 一种直播的方法和装置 - Google Patents

一种直播的方法和装置 Download PDF

Info

Publication number
WO2019071679A1
WO2019071679A1 PCT/CN2017/109670 CN2017109670W WO2019071679A1 WO 2019071679 A1 WO2019071679 A1 WO 2019071679A1 CN 2017109670 W CN2017109670 W CN 2017109670W WO 2019071679 A1 WO2019071679 A1 WO 2019071679A1
Authority
WO
WIPO (PCT)
Prior art keywords
encoding
master
video
video stream
audio
Prior art date
Application number
PCT/CN2017/109670
Other languages
English (en)
French (fr)
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 WO2019071679A1 publication Critical patent/WO2019071679A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/24Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/241Operating system [OS] processes, e.g. server setup

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method and apparatus for live broadcast.
  • 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, there is a problem of low stability. For example, if a module has a problem, the entire process may be crashed 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 performing live broadcast, at least for 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 present invention provides a live broadcast method, including:
  • the master process creates an encoding process
  • the master process sends the video stream to the live broadcast server, so that the live broadcast server forwards the video stream to the audience device that accesses the live broadcast server.
  • the video stream is encoded by the encoding process and fed back to the master process, including:
  • 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 master process creates an encoding 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 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 process environment is initialized, and the master control process is connected based on the ID of the master process that the process creation function has, including:
  • the encoding process registers an initialization service function and a video stream encoding service function
  • the method further 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;
  • the video stream is encoded by the encoding process and fed back to the master process, including:
  • the encoding process receives an encoding command sent by the master control process
  • the method further includes:
  • the master process monitors whether the encoding process crashes
  • the present invention provides a live broadcast apparatus, including:
  • 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 video stream obtaining unit configured to encode a video stream by the encoding process and feed back to the master control process
  • a sending unit 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 video stream obtaining unit 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 invokes an encoding local service module that is connected to the encoding stub module to encode the output.
  • 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 video stream acquiring unit.
  • 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, run the process creation function to create the encoding process, and the encoding 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 an encoding process environment initial unit, configured to initialize the process environment after the encoding process is completed, and connect the ID based on the ID of the master process that the process creation function has
  • the master control process is specifically configured to register an initialization service function and a video stream encoding service function in the encoding process, create a video shared memory storing the video material, and store an audio shared memory of the audio material, and obtain the process creation function.
  • the ID of the master control process is connected to the master control process, and based on the connection between the encoding process and the master control process, the identifier of the video shared memory and the identifier of the audio shared memory are sent to the master control process. .
  • the device 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, the initialization command Included is 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 operated based on the initial command to be based on the nominal parameter Obtaining the video decoding header parameter and the audio decoding header parameter, and feeding back 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 is sent to the live broadcast server, where the live broadcast server further uses the video decoding header parameter and the audio decoding header The number is forwarded to the viewer device.
  • 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 video stream obtaining unit 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 Extracting audio material pre-stored by the master process from 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, Obtaining audio encoded data, the video stream including the video encoded data and the audio encoded data; feeding the video encoded data and the audio encoded data to the master process.
  • the device further includes an encoding process monitoring unit, configured to monitor whether the encoding process is crashed; if the encoding process is detected to crash, re-creating the encoding process.
  • an encoding process monitoring unit configured to monitor whether the encoding process is crashed; if the encoding process is detected to crash, re-creating the encoding process.
  • 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 an encoding process, and the video stream is encoded by the encoding process and fed back to the main
  • the main control process sends the video stream to the live broadcast server, so that the live broadcast server forwards the video stream to the viewer device accessing the live broadcast server.
  • the embodiment of the present invention adopts multiple processes and encodes the video stream by using the encoding process, the abnormality of the encoding function does not affect the main control process, so that the program crashes due to one or more functional abnormalities is avoided, so that the broadcast application of the anchor end 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 performing live broadcast, at least for 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 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 an encoding process, and the video stream is encoded by the encoding process and fed back to the main
  • the main control process sends the video stream to the live broadcast server, so that the live broadcast server forwards the video stream to the viewer device accessing the live broadcast server.
  • the embodiment of the present invention adopts multiple processes and encodes the video stream by using the encoding process, the abnormality of the encoding function does not affect the main control process, so that the program crashes due to one or more functional abnormalities is avoided, so that the broadcast application of the anchor end 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 server forwards the video stream to a viewer device that accesses the live broadcast 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 live broadcast application of the anchor end starts, the live broadcast application of the anchor end is created accordingly.
  • the master process of the order Next, in S103, 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 in different situations.
  • the anchor may use the single-process mode for maintenance, or use the multi-process mode for the program temperature, and if the plug-in is not needed.
  • the host-side live application in the embodiment of the present invention can be operated in at least the following four operating modes, in order to meet different requirements.
  • the first mode LIVE_ENCODER_PROXY_WITH_SERVER is specifically a multi-process mode.
  • the host process RpcLiveEncoderServer will be created after the host broadcast application starts.
  • the control process can also be named as other), and then the host broadcast application will treat the master process RpcLiveEncoderServer as a server and access the master process RpcLiveEncoderServer as the client. 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 the plug-in loading process RpcPluginLoader needs to be created
  • 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 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 first mode.
  • the encoding process and the plugin loading process will be created.
  • the running mode set by the anchor is the first mode
  • the host control process is created by the anchor live application
  • 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.
  • 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 is specifically: creating an encoding process by the master process. 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 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 coding module is loaded into the main control process, and the main control process can call the coding function arbitrarily.
  • the various functions, interfaces and parameters that can be.
  • 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, 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 encoding process is subordinate to the encoding module.
  • 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 is facing the video. Stream decoding, decoding live video for viewers to watch.
  • 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, and then the code process RpcLiveEncoderEncoder created by the CreateProcess function is started, and 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 RpcStartServie 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, and determines that the encoding process environment initialization is completed, and then notifies the encoding process to encode the video stream according to the need in the subsequent process.
  • 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 device provides decoding header parameters. 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;
  • 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 After the encoding process receives the initialization init_encoder command from the RPC channel, it responds by initializing the service function init_encoder. Specifically, it calls the CreateMediaFile function 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 code. 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, the audio encoder channel number audioChannel, audio sampling rate audioSampleRate, audio The code rate audioBitrate is used as a parameter to initialize the audio encoder audioEncoder.
  • 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 will obtain the video decoding header parameter videoHeader and the audio decoding header.
  • the number of audioHeaders is sent to the master 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 receiving the encode_raw_buffer command, the encoding process 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 crash due to anomalies, in order to make the anchor
  • the live broadcast application can continue to be encoded to continue the live broadcast.
  • 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 Remote Plugin Manager module
  • 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 After the plug-in enumerator process receives the enumeration instruction sent by the master process from the RPC channel, Call the enumeration function get_plugins to enumerate all the plugins 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 then the plug-in is uninstalled from the loading directory.
  • 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 according to the master control The control of the process calls the loaded plugin;
  • 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 and/or a plug-in loading process by the master 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 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 calls the encoding local service module connected to the encoding stub module. Encoding the video stream, the encoding local service module invoking an encoding proxy interface module connected to the encoding local service module to feed back the encoded video stream to the video stream obtaining 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 based on the ID of the master process that the process creation function has Cheng.
  • 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 plug-in is determined from the candidate plug-in, and notify the The plugin loads the target plugin for the process.
  • 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, the program being executed by the processor to implement any of the methods described above for live broadcast The steps of the method.
  • 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 represented by processor 202.
  • the various circuits of the memory represented by memory 204 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 an encoding process, and the video stream is encoded by the encoding process and fed back to the main
  • the main control process sends the video stream to the live broadcast server, so that the live broadcast server forwards the video stream to the viewer device accessing the live broadcast server.
  • the embodiment of the present invention adopts multiple processes and encodes the video stream by using the encoding process, the abnormality of the encoding function does not affect the main control process, so that the program crashes due to one or more functional abnormalities is avoided, so that the broadcast application of the anchor end 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 such that instructions executed on a computer or other programmable device are provided for implementing one or more processes and/or block diagrams in the flowchart The steps of a function specified in a box or multiple boxes.

Abstract

本发明实施例提供了一种直播的方法和装置,至少用于解决现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。所述方法包括:启动主播端直播应用程序;获取所述主播端直播应用程序的主控进程;所述主控进程创建编码进程;通过所述编码进程编码出视频流并反馈给所述主控进程;所述主控进程将所述视频流发送至直播服务器,以使所述直播服务器将所述视频流转发给接入所述直播服务器的观众端设备。

Description

一种直播的方法和装置 技术领域
本发明涉及计算机技术领域,尤其涉及一种直播的方法和装置。
背景技术
网络直播已经逐渐成为现代生活一种主流的娱乐和交流方式。纵观目前各个平台的主播端直播应用程序,乃至其他类型的应用程序,都是采用单进程模式运行的,即,程序所有的功能都集成在一个进程中执行。
尽管单进程模式具有架构简单、方便维护的优点,但是却存在稳定性低的问题,例如如果某模块出现问题,就可能导致整个进程崩溃,必须通过重启程序才能解决。
因此,现有技术存在如何提高主播端直播程序运行稳定性的技术问题。
发明内容
本发明实施例提供了一种直播的方法和装置,至少用于解决现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。
第一方面,本发明提供了一种直播的方法,包括:
启动主播端直播应用程序;
获取所述主播端直播应用程序的主控进程;
所述主控进程创建编码进程;
通过所述编码进程编码出视频流并反馈给所述主控进程;
所述主控进程将所述视频流发送至直播服务器,以使所述直播服务器将所述视频流转发给接入所述直播服务器的观众端设备。
可选的,所述通过所述编码进程编码出视频流并反馈给所述主控进程,包括:
所述主控进程向编码存根模块发送编码指令,以通知所述编码进程编码视频流;
所述编码进程调用与所述编码存根模块连接的编码本地服务模块编码出所述视频流;
所述编码进程调用与所述编码本地服务模块连接的编码代理接口模块向所述主控进程反馈编码出的所述视频流。
可选的,所述主控进程创建编码进程,包括:
所述主控进程调用进程创建函数;
所述主控进程将所述主控进程的ID传入所述进程创建函数;
所述主控进程运行所述进程创建函数创建所述编码进程,所述编码进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。
可选的,所述编码进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,包括:
所述编码进程注册初始化服务函数和视频流编码服务函数;
创建存储视频材料的视频共享内存以及存储音频材料的音频共享内存;
获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程;
基于与所述主控进程的连接,向所述主控进程发送所述视频共享内存的标识和所述音频共享内存的标识。
可选的,在所述通过所述编码进程编码出视频流并反馈给所述主控进程之前,还包括:
所述主控进程向所述编码进程发送初始化命令,所述初始化命令包括用于指导所述编码进程确定解码头参数的额定参数,所述解码头参数包括视频解码头参数和音频解码头参数;
所述编码进程基于所述初始命令运行所述初始化服务函数,以基于所述额定参数获得所述视频解码头参数和所述音频解码头参数;
所述编码进程向所述主控进程反馈所述视频解码头参数和所述音频解码头参数,以使所述主控进程将所述视频解码头参数和所述音频解码头参数发送至所述直播服务器,所述直播服务器再将所述视频解码头参数和所述音频解码头参数转发给所述观众端设备。
可选的,所述通过所述编码进程编码出视频流并反馈给所述主控进程,包括:
所述编码进程接收所述主控进程发送的编码命令;
基于所述编码命令,从所述视频分享内存中提取由所述主控进程预先存储的视频材料,以及从所述音频分享内存中提取由所述主控进程预先存储的音频材料;
运行所述视频流编码服务函数对所述视频材料进行编码,获得视频编码数据,以及对所述音频材料进行编码,获取音频编码数据,所述视频流包括所述视频编码数据和所述音频编码数据;
将所述视频编码数据和所述音频编码数据反馈给所述主控进程。
可选的,所述方法还包括:
所述主控进程监控所述编码进程是否崩溃;
如果所述主控进程监控到所述编码进程崩溃,重新创建所述编码进程。
第二方面,本发明提供了一种直播的装置,包括:
启动单元,用于启动主播端直播应用程序;
主控进程获取单元,用于获取所述主播端直播应用程序的主控进程;
进程创建单元,用于创建编码进程;
视频流获取单元,用于通过所述编码进程编码出视频流并反馈给所述主控进程;
发送单元,用于将所述视频流发送至直播服务器,以使所述直播服务器将所述视频流转发给接入所述直播服务器的观众端设备。
可选的,所述视频流获取单元用于向编码存根模块发送编码指令,以通知所述编码进程编码视频流,所述编码进程调用与所述编码存根模块连接的编码本地服务模块编码出所述视频流,所述编码进程调用与所述编码本地服务模块连接的编码代理接口模块向所述视频流获取单元反馈编码出的所述视频流。
可选的,所述进程创建单元用于调用进程创建函数,将所述主控进程的ID传入所述进程创建函数,运行所述进程创建函数创建所述编码进程,所述编码进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。
可选的,所述装置还包括编码进程环境初始单元,用于在所述编码进程创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,具体用于在所述编码进程中注册初始化服务函数和视频流编码服务函数,创建存储视频材料的视频共享内存以及存储音频材料的音频共享内存,获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,基于所述编码进程与所述主控进程的连接,向所述主控进程发送所述视频共享内存的标识和所述音频共享内存的标识。
可选的,所述装置还包括编码初始化单元,用于在所述通过所述编码进程编码出视频流并反馈给所述主控进程之前,向所述编码进程发送初始化命令,所述初始化命令包括用于指导所述编码进程确定解码头参数的额定参数,所述解码头参数包括视频解码头参数和音频解码头参数,基于所述初始命令运行所述初始化服务函数,以基于所述额定参数获得所述视频解码头参数和所述音频解码头参数,向所述主控进程反馈所述视频解码头参数和所述音频解码头参数,以使所述主控进程将所述视频解码头参数和所述音频解码头参数发送至所述直播服务器,所述直播服务器再将所述视频解码头参数和所述音频解码头参 数转发给所述观众端设备。
可选的,所述视频流获取单元用于接收所述主控进程发送的编码命令;基于所述编码命令,从所述视频分享内存中提取由所述主控进程预先存储的视频材料,以及从所述音频分享内存中提取由所述主控进程预先存储的音频材料;运行所述视频流编码服务函数对所述视频材料进行编码,获得视频编码数据,以及对所述音频材料进行编码,获取音频编码数据,所述视频流包括所述视频编码数据和所述音频编码数据;将所述视频编码数据和所述音频编码数据反馈给所述主控进程。
可选的,所述装置还包括编码进程监控单元,用于监控所述编码进程是否崩溃;如果监控到所述编码进程崩溃,重新创建所述编码进程。
第三方面,本发明提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现第一方面任一项所述方法的步骤。
第四方面,本发明提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现第一方面任一项所述方法的步骤。
本申请实施例中的上述一个或多个技术方案,至少具有如下一种或多种技术效果:
在本发明实施例的技术方案中,首先启动主播端直播应用程序,并获取主播端直播应用程序的主控进程,然后主控进程进一步创建编码进程,通过编码进程编码出视频流并反馈给主控进程,主控进程再将视频流发送至直播服务器,以使直播服务器将视频流转发给接入直播服务器的观众端设备。由于本发明实施例采用多进程,利用编码进程编码视频流,故而编码功能的异常不会影响主控进程,所以避免了由于一个或多个功能异常而导致程序崩溃,使得主播端直播应用程序更稳定地运行,由此解决了现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。
附图说明
图1为本发明实施例中直播的方法流程图;
图2为本发明实施例中直播的装置结构示意图;
图3为本发明实施例中计算机设备的结构示意图。
具体实施方式
本发明实施例提供了一种直播的方法和装置,至少用于解决现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。
为了解决上述技术问题,本发明提供的技术方案思路如下:
在本发明实施例的技术方案中,首先启动主播端直播应用程序,并获取主播端直播应用程序的主控进程,然后主控进程进一步创建编码进程,通过编码进程编码出视频流并反馈给主控进程,主控进程再将视频流发送至直播服务器,以使直播服务器将视频流转发给接入直播服务器的观众端设备。由于本发明实施例采用多进程,利用编码进程编码视频流,故而编码功能的异常不会影响主控进程,所以避免了由于一个或多个功能异常而导致程序崩溃,使得主播端直播应用程序更稳定地运行,由此解决了现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。
下面通过附图以及具体实施例对本发明技术方案做详细的说明,应当理解本申请实施例以及实施例中的具体特征是对本申请技术方案的详细的说明,而不是对本申请技术方案的限定,在不冲突的情况下,本申请实施例以及实施例中的技术特征可以相互组合。
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
本发明第一方面提供了一种直播的方法,请参考图1,为本发明实施例中直播的方法流程图。该方法包括:
S101:启动主播端直播应用程序;
S102:获取所述主播端直播应用程序的主控进程;
S103:所述主控进程创建编码进程和/或插件加载进程,所述编码进程用于基于所述主控进程的控制编码出视频流,并向所述主控进程反馈所述视频流,所述插件加载进程用于在所述插件加载进程中加载插件,并根据所述主控进程的控制调用加载的插件;
S104:所述主控进程获取所述视频流;
S105:所述主控进程将所述视频流发送至直播服务器,以使所述直播服务器将所述视频流转发给接入所述直播服务器的观众端设备。
具体来讲,在S101中启动主播端直播应用程序。在具体实现过程中,主播端直播应用程序可以安装在手机、平板电脑或台式电脑等主播端设备上的直播应用,本发明不做具体限制。为了方便介绍本发明实施例中的技术方案,下文将以安装在Windows系统的台式电脑上的主播端直播应用程序为例来进行介绍。
在S102中,随着主播端直播应用程序的启动,相应创建主播端直播应用程 序的主控进程。接下来,在S103中,主控进程将按照需要创建编码进程和/或插件加载进程。
具体来讲,本发明实施例中的编码进程用于基于主控进程的控制编码出视频流,并向主控进程反馈视频流。更具体地,编码进程接收主控进程的初始化命令和编码命令进行初始化和编码,并将编码后的数据传递给主控进程。
插件加载进程用于在插件加载进程中加载插件,并根据主控进程的控制调用加载的插件。更具体地,插件加载进程充当主播端直播应用程序插件的装载器,将原有的要加载进主控进程中的插件加载到插件加载进程中,进而使主控进程不再需要加载插件,进而避免了因为插件的问题导致主控进程崩溃的情况。本发明实施例中的插件加载进程一方面模拟出插件加载和运行所依赖的主控进程的环境,另一方面响应来自主控进程获取图像、获取音频等命令,向主控进程反馈插件生成的图像和音频,使主控进程中可以正常绘制来自插件的图像以及播放声音。
主控进程是主播端直播应用程序的主进程,管理插件加载进程和编码进程。并且,如果监控到编码进程异常退出,主控进程将自动重新创建编码进程,使得编码进程能够快速的重启。
进一步,由于主控进程、编码进程和插件加载进程为不同的进程,为了使多条进程协同提供主播端直播应用程序的各种服务,进程间通过进程通信的方式进行交互。进程通信的方式包括RPC(远程过程调用协议,Remote Procedure Call Protocol)和命名管道等等,本发明不做具体限制,本发明所属领域的普通技术人员可以根据实际进行选择。后文中则以RPC为例来进行介绍。
对于本发明实施例中的主播端直播应用程序而言,主控进程、编码进程和插件加载进程运行于后台,在前台则通过界面程序与主播交互。界面程序为主播真正进行人机交互的程序,在实现上,界面程序需要将视频画面预览窗口交给主控进程来绘制。主播在界面上的调用会通过RPC转发到主控进程中处理。并且,界面程序还需在主控进程异常崩溃的情况下,启动和恢复主控进程。
以上是对本发明多进程模式中每个进程的介绍。在具体实现过程中,在不同的情况下主播可能有不同的需求,例如主播为了便于维护可能倾会使用单进程模式,或者为了程序温度会使用多进程模式,以及在不需要使用插件的情况下会不创建插件加载进程等,为了满足不同的需求,本发明实施例中的主播端直播应用程序可以按照至少以下4种运行模式运行。
第一模式:
第一模式LIVE_ENCODER_PROXY_WITH_SERVER具体为多进程模式。在第一模式下,主播端直播应用程序启动后将创建主控进程RpcLiveEncoderServer(主 控进程也可以命名为其他),然后主播端直播应用程序会将主控进程RpcLiveEncoderServer视为服务器,以客户端的身份接入主控进程RpcLiveEncoderServer。然后,主播端直播应用程序对主控进程的调用,会通过RPC请求发送给主控进程RpcLiveEncoderServer。
在第一模式下,主控进程RpcLiveEncoderServer会进一步创建编码进程RpcLiveEncoderEncoder(编码进程的命名也可以为其他)和插件加载进程RpcPluginLoader(插件加载进程的命名也可以为其他)。
第二模式:
第二模式LIVE_ENCODER_PROXY_WITHOUT_SERVER也为多进程模式。与第一模式不同的是,在第二模式下主播端直播应用程序不需要自行创建主控进程RpcLiveEncoderServer,而是连接到一个已有的预设主控进程中。类似地,主播端直播应用程序会将主控进程RpcLiveEncoderServer视为服务器,根据服务器的地址以客户端的身份接入预设的主控进程。
在具体实现过程中,第二模式中的主控进程可以为上层应用创建的进程。第二模式相较于第一模式,优势在于便于从上层应用扩展主控进程;第一模式相较于第二模式,优势在于便于主播端直播应用程序直接管理主控进程,并且主控进程是由主播端应用程序自己创建的,因此不兼容的可能性低。
在第二模式下,主控进程RpcLiveEncoderServer也会进一步创建编码进程RpcLiveEncoderEncoder和插件加载进程RpcPluginLoader。
第三模式:
第三模式LIVE_ENCODER_PROXY_STUB也为多进程模式。其中,第三模式中的主控进程RpcLiveEncoderServer类似于第一模式或第二模式中的主控进程。在第三模式下,主控进程RpcLiveEncoderServer进一步会创建编码进程RpcLiveEncoderServer或插件加载进程RpcPluginLoader中的一个。在本发明实施例中,通过预先设置标记位来指示主控进程RpcLiveEncoderServer生成编码进程RpcLiveEncoderServer还是插件加载进程RpcPluginLoader。
具体来讲,第一标记位LIVE_ENCODER_REMOTE_PLUGIN表示需要创建插件加载进程RpcPluginLoader,第二标记位LIVE_ENCODER_REMOTE_ENCODER表示需要创建编码进程RpcLiveEncoderServer。
那么,在具体实现过程中,如果需要添加插件,并且降低插件对主控进程的影响,则可以选择第三模式,且预先设置第一标记位;如果需要单独进程编码,避免编码功能对主控进程影响,且不需要添加插件时,则可以选择第三模式,且预先设置第二标记位。
第四模式:
第四模式LIVE_ENCODER_LOCAL_SERVICE为单进程模式。在第四模式下,主播端直播应用程序仅创建一个进程,即主控进程。主播端直播应用的编码功能在主控进程中实现,插件也加载在主控进程中。
在第四模式下,主控进程RpcLiveEncoderServer不会进一步创建其他进程。
基于以上对四种运行模式的介绍,可以看出主播端直播应用程序在不同运行模式下将按照不同的方式获取主控进程,因此本发明实施例中的S102具体通过如下过程实现:
判断预先设置的所述主播端直播应用程序的运行模式;
如果所述运行模式为第一模式,创建所述主播端直播应用程序的所述主控进程,其中,在所述第一模式下,所述主控进程将创建所述编码进程和所述插件加载进程;
如果所述运行模式为第二模式,获取预设的所述主控进程的地址,并基于所述地址接入所述主控进程,其中,在所述第一模式下,所述主控进程将创建所述编码进程和所述插件加载进程。
具体来讲,首先判断预先设置的运行模式为以上四种模式中的哪一种。如果主播设置的运行模式为第一模式,则由主播端直播应用程序创建出主控进程;如果主播设置的运行模式为第二模式,则主播端直播应用程序获取预设的主控进程的地址,然后基于该地址接入预设的主控进程。
另外,如果主播设置的运行模式为第四模式,则主播端直播应用程序仅创建主控进程一条进程,以单进程模式运行。如果主播设置的运行模式为第三模式,则主播端直播应用程序获取主控进程后,主控进程进一步还需创建编码进程或插件加载进程中的一个进程。具体地,S103之前还包括:判断预先设置的主播端直播应用程序的运行模式,如果运行模式为第三模式,则进一步获取表示需要创建编码进程或插件加载进程的标记位,如果标记位为第一标记位,S103具体为:通过主控进程创建插件加载进程;如果标记位为第二标记位,S103具体为:通过主控进程创建编码进程。并且,在第一模式和第二模式下,获取到的主控进程将进一步创建编码进程和插件加载进程。
由上述描述可以看出,通过设置不同的运行模式可以使主播端直播应用程序以单进程或多进程运行,满足不同的性能需求。并且,通过设置不同的标记位还可以将插件加载功能和编码功能中的一个从主控进程中独立出来。
进一步,编码功能通常为主播端直播应用程序最为核心的功能之一,在现有技术中,实现编码功能的各个函数、接口和参数等封装在编码模块中。主控进程运行时将编码模块加载到主控进程中,进而主控进程可以任意调用编码功 能的各个函数、接口和参数。在本发明实施例中,由于主播端直播应用程序既可以单进程运行又可以多进程运行,因此,为了使主播端直播应用程序无论单进程运行还是多进程运行均可以正常编码,本发明实施例对编码模块至少作出了以下改进:
将现有技术中的编码模块的编码功能封装在一个模块中,即LiveEncoderLocalService编码本地服务模块中;添加用于接收指令,以及将接收到的指令转发到编码本地服务模块中的模块,即LiveEncoderStub编码存根模块;添加一个用于模拟编码模块原有的输出接口,以及透明传输编码本地服务模块处理结果的模块,即LiveEncoderProxy编码代理模块。令LiveEncoderLocalService编码本地服务模块连接LiveEncoderStub编码存根模块,以及令LiveEncoderProxy编码代理模块连接LiveEncoderLocalService编码本地服务模块。可选的,将LiveEncoderLocalService编码本地服务模块、LiveEncoderStub编码存根模块和LiveEncoderProxy编码代理模块封装在一个模块中,即LiveEncoder编码模块。
基于以上对编码模块改进的介绍,下面就对本发明实施例如何应用改进后的编码模块编码进行介绍。
(1)如果主控进程创建了编码进程,即主播端直播应用程序运行在第一模式、第二模式和(第二标记位下的)第三模式下,S104中主控进程获取视频流包括:
所述主控进程向编码存根模块发送编码指令,以通知所述编码进程编码视频流;
所述编码进程调用与所述编码存根模块连接的编码本地服务模块编码出所述视频流;
所述编码进程调用与所述编码本地服务模块连接的编码代理接口模块向所述主控进程反馈编码出的所述视频流。
具体来讲,如果主控进程调用编码模块创建了编码进程,那么就将主播端直播应用程序的编码功能从主控进程中独立到编码进程中实现。编码进程从属于编码模块。当需要编码时,主控进程通过与编码进程间的RPC通过通信向编码存根模块发送编码指令来通知编码进程开始编码。编码进程响应于编码指令,调用编码本地服务模块中的相关方法和函数执行编码指令,从而编码出视频流。然后,编码进程再调用编码代理模块LiveEncoderProxy通过RPC通道向主控进程反馈编码好的视频流。
进而,在S105中,主控进程将视频流发送至直播服务器,然后直播服务器将视频流转发给观看该主播的观众的观众端设备上。进而,观众端设备对视频 流解码,解码出直播视频供观众观看。
(2)如果主控进程未创建了编码进程,即主播端直播应用程序运行在第三模式和(第一标记位的)第三模式下,S104中主控进程获取视频流包括:
所述主控进程向编码存根模块发送编码指令;
所述编码存根模块调用与所述编码存根模块连接的编码本地服务模块编码出所述视频流;
所述编码本地服务模块调用与所述编码本地服务模块连接的编码代理接口模块向所述主控进程反馈编码出的所述视频流。
具体来讲,如果主控进程未创建编码进程,那么主播端直播应用程序的编码功能则仍然由主控进程实现。具体地,当主控进程需要编码视频流时,生成编码指令。然后,主控进程向编码存根模块发送编码指令。接着,编码存根模块向编码本地服务模块发送编码指令,以调用编码本地服务模块中的方法和函数编码视频流。接着,编码本地服务模块将编码完成的视频流发送给编码代理模块,进而编码代理模块再将视频流透明传输给主控进程。
以上是对主控进程和编码进程如何利用改进后的编码模块进行编码的介绍,下面则对主控进程如何创建编码进程,以及编码进程具体的编码过程进行介绍。
首先对主控进程创建编码进程的过程进行介绍。在本发明实施例中,主控进程创建编码进程包括如下过程:
所述主控进程调用进程创建函数;
所述主控进程将所述主控进程的ID传入所述进程创建函数;
所述主控进程运行所述进程创建函数创建所述编码进程,所述编码进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。
具体来讲,主控进程调用Windows系统的进程创建CreateProcess函数创建一个编码进程RpcLiveEncoderEncoder。主控进程在调用CreateProcess函数时,会将主控进程的进程ID当做命令行参数传递给CreateProcess函数,进而由CreateProcess函数创建的编码进程RpcLiveEncoderEncoder启动后就可以在命令行中获取主控进程的进程ID。接着,主控进程运行CreateProcess函数创建出编码进程RpcLiveEncoderEncoder。接下来,编码进程初始化进程环境,并建立与主控进程的连接,具体地,编码进程通过如下过程初始化进程环境并连接主控进程:
所述编码进程注册初始化服务函数和视频流编码服务函数;
创建存储视频材料的视频共享内存以及存储音频材料的音频共享内存;
获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程;
基于与所述主控进程的连接,向所述主控进程发送所述视频共享内存的标识和所述音频共享内存的标识。
具体来讲,编码进程RpcLiveEncoderEncoder通过调用RpcCreatelnstance方法创建一个RPC通信客户端实例句柄hRpc,对应地,主控进程为服务器。然后,调用RpcRegisterProcedure函数,将编码进程RpcLiveEncoderEncoder的初始化服务函数init_encoder注册到hRpc中,以及将视频流编码服务函数encode_raw_buffer注册到hRpc中。在本发明实施例中,初始化服务函数init_encoder用于响应主控进程的初始化命令,根据初始化命令中的额定参数完成编码初始化工作,编码流服务器函数encode_raw_buffer用于响应主控进程的编码指令,对主控进程指定内存中的视频材料和音频材料进行编码,并将编码后所获取的数据返回给主控进程。
接下来,创建存储视频材料和音频材料的内存。在本发明实施例中,考虑到如果需要编码清晰度较高的视频流,例如1080p的视频流,那么每帧图像的数据量都比较大;同时,如果采用RPC传输进程之间的数据,也会带来较大的性能消耗,因此为了避免编码数据不必要的传输,本发明实施例采用共享内存的方式来优化性能。具体地,调用Windows系统的CreateFileMapping函数创建一个名为RpcLiveEncoderEncoder_video_X的视频共享内存,以及创建一个名为RpcLiveEncoderEncoder_Audio_X的音频共享内存。当然,在具体实现过程中,视频共享内存和音频共享内存的命名可以根据实际进行设置,本发明不做具体限制。
接下来,编码进程读取命令行中的主控进程的进程ID,调用RpcStartServie函数建立与主控进程之间的RPC通信通道。然后,基于RPC通道调用主控进程的client_process_ready函数,以通知主控进程编码进程初始化进程环境完成。
主控进程根据编码进程对client_process_ready函数的调用,从RPC通道内获取编码进程在RPC连接中的sessionld会话ID,并确定编码进程环境初始化完成,进而在后续过程中根据需要通知编码进程编码视频流。
另外,主控进程基于编码进程的sessionld调用编码进程的rpc_encoder_sharememory_name函数获取编码进程所创建的视频共享内存标识和音频共享内存标识。
通过上述过程,就完成了对编码进程的创建。接下来,对编码进程具体的编码过程进行介绍。
首先,为了使得观众端设备能够顺利获取并解码视频流,需要先向观众端 设备提供解码头参数。因此,在通过编码进程编码出视频流并反馈给主控进程之前,还包括:
所述主控进程向所述编码进程发送初始化命令,所述初始化命令包括用于指导所述编码进程确定解码头参数的额定参数,所述解码头参数包括视频解码头参数和音频解码头参数;
所述编码进程基于所述初始命令运行所述初始化服务函数,以基于所述额定参数获得所述视频解码头参数和所述音频解码头参数;
所述编码进程向所述主控进程反馈所述视频解码头参数和所述音频解码头参数,以使所述主控进程将所述视频解码头参数和所述音频解码头参数发送至所述直播服务器,所述直播服务器再将所述视频解码头参数和所述音频解码头参数转发给所述观众端设备。
具体来讲,主控进程向编码进程发送初始化init_encoder命令。该命令包括用于指导编码进程确定解码头参数的额定参数,而额定参数则由主控进程根据主播的选择确定。在本发明实施例中,额定参数包括但不限于分辨率信息(宽度width和高度height),视频码率videoBitrate,视频帧率fps,视频编码器类型videoCodec,音频编码器的声道数audioChannel,音频采样率audioSampleRate,音频码率audioBitrate,以及音频编码器类型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。
接着,编码进程调用IMediaFile接口的readVideoHeader获取到视频编码器接口IMediaEncoder的视频解码头参数videoHeader,以及调用IMediaFile接口的readAudioHeader方法获取音频编码器audioEncoder的音频解码头参数audioHeader。
然后,编码进程将获取到的视频解码头参数videoHeader和音频解码头参 数audioHeader通过RPC通道发送给主控进程。而主控进程则会进一步将的视频解码头参数videoHeader和音频解码头参数audioHeader发送给直播服务器,进而直播服务器将的视频解码头参数videoHeader和音频解码头参数audioHeader发送给各个观众端设备。那么,观众端设备就可以根据的视频解码头参数videoHeader和音频解码头参数audioHeader对视频和音频进行解码播放。
获得解码头参数后,就可以获取编码的视频流了。在本发明实施例中,S104中通过编码进程获得编码视频流具体通过如下过程:
所述编码进程接收所述主控进程发送的编码命令;
基于所述编码命令,从所述视频分享内存中提取由所述主控进程预先存储的视频材料,以及从所述音频分享内存中提取由所述主控进程预先存储的音频材料;
运行所述视频流编码服务函数对所述视频材料进行编码,获得视频编码数据,以及对所述音频材料进行编码,获取音频编码数据,所述视频流包括所述视频编码数据和所述音频编码数据;
将所述视频编码数据和所述音频编码数据反馈给所述主控进程。
具体来讲,主控进程根据前文获得的视频共享内存的标识,将需要编码的视频材料预先存储到视频共享内存中,以及根据前文获得的音频共享内存的标识,将需要编码的音频材料预先存储到音频共享内存中。在具体实现过程中,视频材料和音频材料的内容通常是匹配的,例如来源于同一个文件或者均有主播端设备采集。然后,在需要编码出视频流时,主控进程通过与编码进程间的RPC通道向编码进程发送编码命令encode_raw_buffer。
编码进程接收到encode_raw_buffer命令后,通过编码函数响应,具体地:调用videoEncoder接口的Encode方法,读取视频共享内存中的视频材料进行编码,将视频编码数据返回给主控进程;以及调用audioEncoder的Encode方法,对音频共享内存中的音频材料进行编码,将音频编码数据返回给主控进程。其中,视频编码数据和音频编码数据构成视频流,二者根据时间轴对应。
以上就是对编码进程编码视频流的介绍。通过上述过程,编码进程就实现了单独编码视频流。
主控进程接收到来自编码进程返回的视频流后,将视频流存入发送队列中发送到直播服务器。进而,直播服务器在接收视频流后,再将视频流转发给各个观众端设备,观众端设备对接收到的视频流依次解码,进而向用户播放主播的直播视频,由此完成直播。
另外,在具体实现过程中,编码进程可能由于异常的而崩溃,为了使主播 端直播应用程序能够继续编码进而继续直播,本发明实施例中的直播方法还可以进一步包括:
所述主控进程监控所述编码进程是否崩溃;
如果所述主控进程监控到所述编码进程崩溃,所述主控进程重新创建所述编码进程。
具体来讲,主控进程监控编码进程的运行状态,如果监控到编码进程崩溃,则按照上文介绍的创建编码进程的方式重新创建编码进程,此处就不再重复赘述了。
以上是对编码进程的介绍,下面对插件加载进程以及插件加载的方法进行介绍。
在本发明实施例中,主播端直播应用程序的插件加载在插件加载进程内部,进而即使插件异常也不会影响主控进程的运行。类似于编码进程,插件进程也通过RPC通道与主控进程连接,并且,插件进程为了模拟出插件加载到主控进程的环境,会通过RPC通道调用主控进程的相关接口,使插件可以正常加载和运行。
现有技术的主控进程在加载插件之前,需要知道有哪些插件,所以在加载插件之前,需要枚举插件。本发明实施例中的插件加载进程在加载插件之前,也需要向主控进程枚举插件。具体地,在插件加载进程在插件加载进程中加载需要在主播端直播应用程序中加载的目标插件之前,还包括:
所述主控进程创建插件枚举器进程;
所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件;
所述主控进程确定从所述备选插件中确定出所述目标插件,并通知所述插件加载进程所述目标插件。
首先对主控进程创建插件枚举器进程的过程进行介绍,主控进程通过如下方式创建插件枚举器进程:
所述主控进程调用进程创建函数;
所述主控进程将所述主控进程的ID传入所述进程创建函数;
所述主控进程运行所述进程创建函数创建所述插件枚举器进程,所述插件枚举器进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。
主控进程加载RpcPluginManager远程插件管理器模块,该模块负责插件枚举器进程RpcPluginFinder的创建,并且命令RpcPluginFinder枚举插件的功能。将RpcPluginManager模块加载到主控进程中后,调用该模块中的 CreatePluginManager函数,创建一个插件管理器接口IPluginManager。
接下来,主控进程调用插件管理器接口IPluginManager的初始化init方法,使init方法进一步调用Windows系统的进程创建函数CreateProcess创建插件枚举器进程RpcPluginFinder。在调用CreateProcess函数时,主控进程也会将主控进程的进程ID当做命令行参数传递给CreateProcess函数。
接下来,主控进程运行创建函数CreateProcess就可以创建出插件枚举器进程RpcPluginFinder了。
通过上述过程就完成了插件枚举器进程的创建。而插件枚举器进程在创建完成后,也需要初始化进程环境,以及建立与主控进程的连接。具体来讲,插件枚举器进程通过如下过程初始化环境:
在所述插件枚举器进程中注册枚举插件函数和枚举退出函数;
获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。
具体来讲,通过调用RpcCreatelnstance创建一个RPC通信客户端实例句柄hRpc;调用RpcRegisterProcedure函数,将枚举插件的功能函数,即枚举插件函数get_plugins注册到hRpc中,枚举插件函数用于响应主控进程的枚举插件指令去枚举插件;调用RpcRegisterProcedure函数,将枚举退出函数也注册到hRpc中,枚举退出函数用于响应主控进程获取到所有插件后发送的枚举退出指令,使插件枚举进程退出;根据命令行中的主控进程的进程ID,调用RpcStartService函数,建立与主控进程之间的RPC通道;调用主控进程的client_process_ready函数,以通知主控进程插件枚举器进程初始化完成。
主控进程根据插件枚举器进程对client_process_ready函数的调用,从RPC通道内获取到插件枚举器进程在RPC连接中的sessionld会话ID,并确定插件枚举器进程环境初始化完成,进而在后续过程中根据需要通知插件枚举器进程枚举插件。
通过上述过程,就完成了对插件枚举器进程的创建。接下来,对插件枚举器进程具体的枚举过程进行介绍。插件枚举器进程向主控进程枚举当前加载目录中存在的且能够加载的备选插件,包括:
所述插件枚举器接收所述主控进程发送的枚举指令,调用所述枚举插件函数进程读取所述加载目录下的所有插件;
从所有的所述插件中过滤出合法插件;
从所述合法插件中过滤出所述主播端直播应用程序支持的所述备用插件。
具体来讲,本发明实施例中的备选插件指的是供主控进程选择加载的插件。当主控进程需要加载插件时,会先向插件枚举器进程发送枚举指令,获得所有备选插件。插件枚举器进程从RPC通道接收到主控进程发送的枚举指令后, 调用枚举函数get_plugins枚举当前加载目录下的所有插件。
具体来讲,get_plugins函数调用FindFirstFile函数,获取加载目录下的第一个DLL(动态链接库,Dynamic Link Library)文件。接着,get_plugins函数调用FindNextFile函数继续获取加载目录下的下一个DLL文件。如果FindNextFile函数返回值为真,表示获取到了下一个DLL文件,则再次执行FindNextFile函数,继续获取下一个DLL文件;如果FindNextFile函数返回值为假时,表示已经获取完加载目录下的所有DLL文件。只要FindNextFile函数的返回值为真,则进行获取下一个DLL文件,直到FindNextFile函数返回值为假。
在具体实现过程中,主播有可能会将一些不合法的插件添加到加载目录中,但是不合法的插件是不能加载的,因此获取到所有插件后,进一步判断获取的插件是否合法,将不合法的插件过滤掉。
具体来讲,调用系统的LoadLibrary函数加载每个DLL文件,如果能够成功调用LoadLibrary函数,那么表示该DLL文件合法;反之,如果LoadLibrary函数调用失败,那么表示该DLL文件不合法。针对每个DLL文件调用LoadLibrary函数后,将不合法的DLL文件从加载目录中卸载,将合法DLL文件保留。
进一步,对于主播端直播应用程序而言,尽管一个插件是合法的,但是主播端直播应用程序也有可能不支持该插件,因此在本发明实施例中,为了保证最终为主控进程提供的备选插件均为主播端直播应用程序支持的插件,还需要进一步针对合法DLL文件进行过滤,从而得到主播端直播应用程序支持的插件。
在具体实现过程中,插件枚举器进程按照不同的支持条件进行过滤,本发明不做具体限制。举例来说,主播端直播应用程序所支持的插件具体为具备导出函数的插件,那么,具体判断合法插件是否能够被支持的方法为:调用系统的GetProcAddress函数获取一个合法DLL文件中的导出函数,如果能够获取到导出函数,则确定该DLL文件对应的插件为主播端直播应用程序可以支持的插件,进而将该插件保留为备选插件;反之,如果未获取到导出函数,则确定该DLL文件对应的插件为主播端直播应用程序不支持的插件,进而从加载目录中卸载该插件。
通过上述过程,就获得了一个或多个备选插件。接下来,插件枚举器进程通过与主控进程的RPC通道,将确定出的备选插件的名称提供给主控进程。
进一步,为了节约主播端设备的系统资源,在插件枚举器进程向主控进程枚举当前加载目录中存在的且能够加载的备选插件之后,还包括:
所述主控进程向所述插件枚举器进程发送退出指令;
所述插件枚举器基于所述退出指令调用所述枚举退出函数结束进程。
具体来讲,主控进程在接收到插件枚举器进程枚举的插件后,向插件枚举进程发送退出指令。插件枚举器进程接收退出指令后,调用枚举退出函数退出插件枚举器进程。
接下来,主控进程自动从备选插件中选取目标插件,或者根据主播的选取操作确定对应的目标插件,然后通过与插件加载进程的RPC通道,将目标插件的名称通知插件加载进程。进而,插件加载进程根据目标进程的名称获取目标插件的DLL文件,从而加载并运行目标插件。
一个具体的例子,假设当前加载的插件需要调用主控进程的加法方法才能加载,那么,插件加载进程通过与主控进程的RPC通道调用主控进程的加法方法,使插件检测到加法方法,从而能够成功加载。进一步,主控进程调用插件运行,插件加载进程通过与主控进程的RPC通道接收主控进程发送的触发该插件运行的指令,进而触发该插件运行。该插件运行过程中需要使用减法方法,那么,插件加载进程通过与主控进程的RPC通道调用主控进程的减法方法,使该插件使用减法方法进行处理,从而获得处理结果。插件加载进程获取该插件运行的结果,通过与主控进程的RPC通道将该插件的运行结果反馈给主控进程。
另外,如果加载的插件会产生图像和音频,即插件需要向主播展示图像和声音,那么插件加载进程则需要通过与主控进程的RPC通道将插件产生的图像和音频传输到主控进程。然后,主控进程再根据插件产生的图像绘制窗口展示图像,以及通过播放器播放音频,从而将插件产生的图像和声音展示给主播。
当然,主控进程同样也需要监控插件加载进程,因此本发明实施例还包括以下方案:
所述主控进程监控所述插件加载进程是否崩溃;
如果所述主控进程监控到所述插件加载进程崩溃,重新创建所述插件加载进程。
具体来讲,主控进程监控插件加载进程的运行状态,如果监控到插件加载进程崩溃,则按照上文介绍的创建插件枚举器进程和插件加载进程的方式重新创建插件枚举器进程和插件加载进程,此处就不再重复赘述了。
基于与前述实施例中直播的方法同样的发明构思,本发明第二方面还提供一种直播的装置,如图2所示,包括:
启动单元101,用于启动主播端直播应用程序;
主控进程获取单元102,用于获取所述主播端直播应用程序的主控进程;
进程创建单元103,用于创建编码进程和/或插件加载进程,所述编码进程用于基于所述主控进程的控制编码出视频流,并向所述主控进程反馈所述视频流,所述插件加载进程用于在所述插件加载进程中加载插件,并根据所述主控 进程的控制调用加载的插件;
视频流获取单元104,用于获取所述视频流;
发送单元105,用于将所述视频流发送至直播服务器,以使所述直播服务器将所述视频流转发给接入所述直播服务器的观众端设备。
具体来讲,所述主控进程获取单元102用于判断预先设置的所述主播端直播应用程序的运行模式;如果所述运行模式为第一模式,创建所述主播端直播应用程序的所述主控进程,其中,在所述第一模式下,所述主控进程将创建所述编码进程和所述插件加载进程;如果所述运行模式为第二模式,获取预设的所述主控进程的地址,并基于所述地址接入所述主控进程,其中,在所述第二模式下,所述主控进程将创建所述编码进程和所述插件加载进程。
进一步,所述装置还包括:
模式判断单元,用于在所述通过所述主控进程创建编码进程和/或插件加载进程之前,判断预先设置的所述主播端直播应用程序的运行模式;
标记获取单元,用于如果所述运行模式为第三模式,在创建编码进程或插件加载进程之前,获取表示需要创建所述编码进程和/或所述插件加载进程的标记位;
如果所述标记位为第一标记位,所述进程创建单元103具体用于通过所述主控进程创建所述插件加载进程;
如果所述标记位为第二标记位,所述进程创建单元103具体用于通过所述主控进程创建所述编码进程。
进一步,如果所述主控进程创建了所述编码进程,所述视频流获取单元104用于向编码存根模块发送编码指令,以通知所述编码进程编码视频流,所述编码进程调用与所述编码存根模块连接的编码本地服务模块编码出所述视频流,所述编码进程调用与所述编码本地服务模块连接的编码代理接口模块向所述视频流获取单元反馈编码出的所述视频流。
而如果所述主控进程未创建所述编码进程,所述视频流获取单元104则用于向编码存根模块发送编码指令,所述编码存根模块调用与所述编码存根模块连接的编码本地服务模块编码出所述视频流,所述编码本地服务模块调用与所述编码本地服务模块连接的编码代理接口模块向所述视频流获取单元反馈编码出的所述视频流。
(1)如果本发明实施例需要创建编码进程,那么所述进程创建单元103用于调用进程创建函数,将所述主控进程的ID传入所述进程创建函数,运行所述进程创建函数创建所述编码进程,所述编码进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进 程。
进一步,所述装置还包括编码进程环境初始单元,用于在所述编码进程创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,具体用于在所述编码进程中注册初始化服务函数和视频流编码服务函数,创建存储视频材料的视频共享内存以及存储音频材料的音频共享内存,获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,基于所述编码进程与所述主控进程的连接,向所述主控进程发送所述视频共享内存的标识和所述音频共享内存的标识。
更进一步,所述装置还包括编码初始化单元,用于在所述通过所述编码进程编码出视频流并反馈给所述主控进程之前,向所述编码进程发送初始化命令,所述初始化命令包括用于指导所述编码进程确定解码头参数的额定参数,所述解码头参数包括视频解码头参数和音频解码头参数,基于所述初始命令运行所述初始化服务函数,以基于所述额定参数获得所述视频解码头参数和所述音频解码头参数,向所述主控进程反馈所述视频解码头参数和所述音频解码头参数,以使所述主控进程将所述视频解码头参数和所述音频解码头参数发送至所述直播服务器,所述直播服务器再将所述视频解码头参数和所述音频解码头参数转发给所述观众端设备。
所述视频流获取单元104用于接收所述主控进程发送的编码命令;基于所述编码命令,从所述视频分享内存中提取由所述主控进程预先存储的视频材料,以及从所述音频分享内存中提取由所述主控进程预先存储的音频材料;运行所述视频流编码服务函数对所述视频材料进行编码,获得视频编码数据,以及对所述音频材料进行编码,获取音频编码数据,所述视频流包括所述视频编码数据和所述音频编码数据;将所述视频编码数据和所述音频编码数据反馈给所述主控进程。
更进一步,所述装置还包括编码进程监控单元,用于监控所述编码进程是否崩溃;如果监控到所述编码进程崩溃,重新创建所述编码进程。
(2)如果所述主控进程创建了所述插件加载进程,所述装置还包括:
插件加载单元,用于在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件。
那么,所述进程创建单元103还用于在所述插件加载进程中加载需要在所述直播应用程序中加载的目标插件之前,创建插件枚举器进程;
所述装置还包括插件枚举单元,用于向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件;
确定单元,用于确定从所述备选插件中确定出所述目标插件,并通知所述 插件加载进程所述目标插件。
具体来讲,所述进程创建单元103用于调用进程创建函数,将所述主控进程的ID传入所述进程创建函数,运行所述进程创建函数创建所述插件枚举器进程,所述插件枚举器进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。
进一步,所述装置还包括插件加载进程环境初始单元,用于在所述插件枚举器进程创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,具体用于在所述插件枚举器进程中注册枚举插件函数和枚举退出函数,获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。
更进一步,所述插件枚举单元用于接收所述主控进程发送的枚举指令,调用所述枚举插件函数进程读取所述加载目录下的所有插件;从所有的所述插件中过滤出合法插件;从所述合法插件中过滤出所述主播端直播应用程序支持的所述备用插件。
更进一步,所述装置还包括退出单元,用于在所述插件枚举器进程向所述主控进程枚举当前加载目录中存在的且能够加载的备选插件之后,向所述插件枚举器进程发送退出指令,基于所述退出指令调用所述枚举退出函数结束进程。
更进一步,所述装置还包括插件加载进程监控单元,用于监控所述插件加载进程是否崩溃,如果监控到所述插件加载进程崩溃,重新创建所述插件加载进程。
前述图1实施例中的直播的方法的各种变化方式和具体实例同样适用于本实施例的直播的装置,通过前述对直播的方法的详细描述,本领域技术人员可以清楚的知道本实施例中直播的装置的实施方法,所以为了说明书的简洁,在此不再详述。
基于与前述实施例中直播的方法同样的发明构思,本发明还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现前文所述直播的方法的任一方法的步骤。
基于与前述实施例中直播的方法同样的发明构思,本发明还提供一种计算机设备,如图3所示,包括存储器204、处理器202及存储在存储器204上并可在处理器202上运行的计算机程序,所述处理器202执行所述程序时实现前文所述控制进度条的方法的任一方法的步骤。
其中,在图3中,总线架构(用总线200来代表),总线200可以包括任意数量的互联的总线和桥,总线200将包括由处理器202代表的一个或多个处理器 和存储器204代表的存储器的各种电路链接在一起。总线200还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口206在总线200和接收器201和发送器203之间提供接口。接收器201和发送器203可以是同一个元件,即收发机,提供用于在传输介质上与各种其他装置通信的单元。
处理器202负责管理总线200和通常的处理,而存储器204可以被用于存储处理器202在执行操作时所使用的数据。
本申请实施例中的上述一个或多个技术方案,至少具有如下一种或多种技术效果:
在本发明实施例的技术方案中,首先启动主播端直播应用程序,并获取主播端直播应用程序的主控进程,然后主控进程进一步创建编码进程,通过编码进程编码出视频流并反馈给主控进程,主控进程再将视频流发送至直播服务器,以使直播服务器将视频流转发给接入直播服务器的观众端设备。由于本发明实施例采用多进程,利用编码进程编码视频流,故而编码功能的异常不会影响主控进程,所以避免了由于一个或多个功能异常而导致程序崩溃,使得主播端直播应用程序更稳定地运行,由此解决了现有技术存在的如何提高主播端直播程序运行稳定性的技术问题。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使 得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (10)

  1. 一种直播的方法,其特征在于,包括:
    启动主播端直播应用程序;
    获取所述主播端直播应用程序的主控进程;
    所述主控进程创建编码进程;
    通过所述编码进程编码出视频流并反馈给所述主控进程;
    所述主控进程将所述视频流发送至直播服务器,以使所述直播服务器将所述视频流转发给接入所述直播服务器的观众端设备。
  2. 如权利要求1所述的方法,其特征在于,所述通过所述编码进程编码出视频流并反馈给所述主控进程,包括:
    所述主控进程向编码存根模块发送编码指令,以通知所述编码进程编码视频流;
    所述编码进程调用与所述编码存根模块连接的编码本地服务模块编码出所述视频流;
    所述编码进程调用与所述编码本地服务模块连接的编码代理接口模块向所述主控进程反馈编码出的所述视频流。
  3. 如权利要求2所述的方法,其特征在于,所述主控进程创建编码进程,包括:
    所述主控进程调用进程创建函数;
    所述主控进程将所述主控进程的ID传入所述进程创建函数;
    所述主控进程运行所述进程创建函数创建所述编码进程,所述编码进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程。
  4. 如权利要求3所述的方法,其特征在于,所述编码进程在创建完成后,初始化进程环境,并基于所述进程创建函数所具有的所述主控进程的ID连接所述主控进程,包括:
    所述编码进程注册初始化服务函数和视频流编码服务函数;
    创建存储视频材料的视频共享内存以及存储音频材料的音频共享内存;
    获取所述进程创建函数所具有的所述主控进程的ID连接所述主控进程;
    基于与所述主控进程的连接,向所述主控进程发送所述视频共享内存的标识和所述音频共享内存的标识。
  5. 如权利要求4所述的方法,其特征在于,在所述通过所述编码进程编码出视频流并反馈给所述主控进程之前,还包括:
    所述主控进程向所述编码进程发送初始化命令,所述初始化命令包括用于 指导所述编码进程确定解码头参数的额定参数,所述解码头参数包括视频解码头参数和音频解码头参数;
    所述编码进程基于所述初始命令运行所述初始化服务函数,以基于所述额定参数获得所述视频解码头参数和所述音频解码头参数;
    所述编码进程向所述主控进程反馈所述视频解码头参数和所述音频解码头参数,以使所述主控进程将所述视频解码头参数和所述音频解码头参数发送至所述直播服务器,所述直播服务器再将所述视频解码头参数和所述音频解码头参数转发给所述观众端设备。
  6. 如权利要求5所述的方法,其特征在于,所述通过所述编码进程编码出视频流并反馈给所述主控进程,包括:
    所述编码进程接收所述主控进程发送的编码命令;
    基于所述编码命令,从所述视频分享内存中提取由所述主控进程预先存储的视频材料,以及从所述音频分享内存中提取由所述主控进程预先存储的音频材料;
    运行所述视频流编码服务函数对所述视频材料进行编码,获得视频编码数据,以及对所述音频材料进行编码,获取音频编码数据,所述视频流包括所述视频编码数据和所述音频编码数据;
    将所述视频编码数据和所述音频编码数据反馈给所述主控进程。
  7. 如权利要求1所述的方法,其特征在于,所述方法还包括:
    所述主控进程监控所述编码进程是否崩溃;
    如果所述主控进程监控到所述编码进程崩溃,重新创建所述编码进程。
  8. 一种直播的装置,其特征在于,包括:
    启动单元,用于启动主播端直播应用程序;
    主控进程获取单元,用于获取所述主播端直播应用程序的主控进程;
    进程创建单元,用于创建编码进程;
    视频流获取单元,用于通过所述编码进程编码出视频流并反馈给所述主控进程;
    发送单元,用于将所述视频流发送至直播服务器,以使所述直播服务器将所述视频流转发给接入所述直播服务器的观众端设备。
  9. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现权利要求1-7任一项所述方法的步骤。
  10. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现权利要求1-7任一项所述方法的步骤。
PCT/CN2017/109670 2017-10-09 2017-11-07 一种直播的方法和装置 WO2019071679A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710930142.1 2017-10-09
CN201710930142.1A CN107770567B (zh) 2017-10-09 2017-10-09 一种直播的方法和装置

Publications (1)

Publication Number Publication Date
WO2019071679A1 true WO2019071679A1 (zh) 2019-04-18

Family

ID=61267910

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/109670 WO2019071679A1 (zh) 2017-10-09 2017-11-07 一种直播的方法和装置

Country Status (2)

Country Link
CN (1) CN107770567B (zh)
WO (1) WO2019071679A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108777812B (zh) * 2018-06-25 2021-03-23 香港乐蜜有限公司 一种录屏直播方法、装置、电子设备及存储介质
CN112040259A (zh) * 2020-08-28 2020-12-04 广州华多网络科技有限公司 一种连麦开播的方法、服务端、系统、存储介质及设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101739300A (zh) * 2008-11-18 2010-06-16 中兴通讯股份有限公司 一种多媒体终端进程间通讯的方法和系统
CN101742218A (zh) * 2010-01-19 2010-06-16 南京邮电大学 一种用于网络电视机顶盒之间的可视电话系统的实现方法
CN104053014A (zh) * 2013-03-13 2014-09-17 腾讯科技(北京)有限公司 一种基于移动终端的直播系统、方法和移动终端
US9602846B1 (en) * 2016-08-31 2017-03-21 Living As One, Llc System and method for asynchronous uploading of live digital multimedia with guaranteed delivery
CN106792034A (zh) * 2017-02-10 2017-05-31 深圳创维-Rgb电子有限公司 基于移动终端进行直播的方法及移动终端

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9584564B2 (en) * 2007-12-21 2017-02-28 Brighttalk Ltd. Systems and methods for integrating live audio communication in a live web event
US9792716B2 (en) * 2014-06-13 2017-10-17 Arcsoft Inc. Enhancing video chatting
CN104333770B (zh) * 2014-11-20 2018-01-12 广州华多网络科技有限公司 一种视频直播的方法以及装置
CN104850456A (zh) * 2015-05-27 2015-08-19 苏州科达科技股份有限公司 多进程解码方法和系统
CN105872827A (zh) * 2015-12-07 2016-08-17 乐视云计算有限公司 移动终端中应用界面的直播方法及设备
CN105681212B (zh) * 2016-03-21 2019-02-22 广州盈可视电子科技有限公司 一种视频播放状态的监控方法和装置
CN106713304A (zh) * 2016-12-19 2017-05-24 北京星辰美豆文化传播有限公司 一种网络直播方法、装置及电子设备
CN107613312B (zh) * 2017-10-09 2018-08-21 武汉斗鱼网络科技有限公司 一种直播的方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101739300A (zh) * 2008-11-18 2010-06-16 中兴通讯股份有限公司 一种多媒体终端进程间通讯的方法和系统
CN101742218A (zh) * 2010-01-19 2010-06-16 南京邮电大学 一种用于网络电视机顶盒之间的可视电话系统的实现方法
CN104053014A (zh) * 2013-03-13 2014-09-17 腾讯科技(北京)有限公司 一种基于移动终端的直播系统、方法和移动终端
US9602846B1 (en) * 2016-08-31 2017-03-21 Living As One, Llc System and method for asynchronous uploading of live digital multimedia with guaranteed delivery
CN106792034A (zh) * 2017-02-10 2017-05-31 深圳创维-Rgb电子有限公司 基于移动终端进行直播的方法及移动终端

Also Published As

Publication number Publication date
CN107770567A (zh) 2018-03-06
CN107770567B (zh) 2018-08-21

Similar Documents

Publication Publication Date Title
WO2019071680A1 (zh) 一种插件加载的方法和装置
WO2019071678A1 (zh) 一种直播的方法和装置
US7441020B2 (en) Media plug-in registration and dynamic loading
JP5781497B2 (ja) 拡張可能なメディア形式を持つホスト型アプリケーションプラットフォーム
US10547657B2 (en) System and method for video gathering and processing
US20140237119A1 (en) Object migration system and method for web-based content service migration
CN113542757B (zh) 云应用的图像传输方法、装置、服务器及存储介质
US11490173B2 (en) Switch of audio and video
WO2016197862A1 (zh) 一种数据传输方法、装置和智能电视系统
WO2014089793A1 (zh) 一种视频重定向的方法、装置、系统及计算机可读介质
KR101931514B1 (ko) 웹 브라우저에서 미디어의 재생과 백업을 동시에 수행하는 장치 및 방법
US20170346792A1 (en) System and method for kernel level video operations
WO2020151660A1 (zh) Stb云化方法、系统、瘦stb、虚拟stb及平台、存储介质
EP3474559B1 (en) Smart-television playback method and apparatus
US10178170B2 (en) Browser-based virtual media administration
CN104349177A (zh) 一种在桌面云下转向播放多媒体文件的方法、虚拟机及系统
WO2014121477A1 (zh) 一种视频重定向的方法、装置、系统及计算机可读介质
WO2019071679A1 (zh) 一种直播的方法和装置
US11245885B2 (en) Method and system for playing media data
US11089381B2 (en) Apparatus and method for simultaneous playback and backup of media in a web browser
WO2021078208A1 (zh) 信息获取方法、云化机顶盒系统、实体机顶盒及存储介质
US11470137B2 (en) Method and system for encoding game video and audio remotely streamed to a remote computer system
CN115920372A (zh) 数据处理方法及装置、计算机可读存储介质、终端
CN114245212A (zh) Bs架构调用vlc播放器ocx扩展播放rtsp视频的系统及方法
CN107026852B (zh) 一种解决大规模视频云应用中的网络性能瓶颈的方法

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: 17928696

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: 17928696

Country of ref document: EP

Kind code of ref document: A1