WO2023221527A1 - 投屏方法、装置、终端设备及计算机可读存储介质 - Google Patents

投屏方法、装置、终端设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2023221527A1
WO2023221527A1 PCT/CN2022/143424 CN2022143424W WO2023221527A1 WO 2023221527 A1 WO2023221527 A1 WO 2023221527A1 CN 2022143424 W CN2022143424 W CN 2022143424W WO 2023221527 A1 WO2023221527 A1 WO 2023221527A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal device
resolution
screen projection
target
screen
Prior art date
Application number
PCT/CN2022/143424
Other languages
English (en)
French (fr)
Inventor
宋旭飞
张伟
刘光磊
李鑫
张进康
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2023221527A1 publication Critical patent/WO2023221527A1/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/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/436Interfacing a local distribution network, e.g. communicating with another STB or one or more peripheral devices inside the home
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/45Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
    • H04N21/462Content or additional data management, e.g. creating a master electronic program guide from data received from the Internet and a Head-end, controlling the complexity of a video stream by scaling the resolution or bit-rate based on the client capabilities
    • H04N21/4621Controlling the complexity of the content stream or additional data, e.g. lowering the resolution or bit-rate of the video stream for a mobile client with a small screen

Definitions

  • This application relates to the field of terminal technology, and specifically to a screen projection method, device, terminal equipment and computer-readable storage medium.
  • the source device directly captures the image displayed on the screen, and then directly sends it to the peer device for screencast display.
  • the peer device displays the screencast image sent by the source device.
  • Embodiments of the present application disclose a screen projection method, device, terminal equipment and computer-readable storage medium.
  • the embodiment of the present application discloses a screen projection method, which is applied to a first terminal device.
  • the method includes:
  • screen projection parameters corresponding to the second terminal device where the screen projection parameters include the first resolution corresponding to the screen projection window of the second terminal device and the codec capability corresponding to the second terminal device;
  • the embodiment of the present application discloses a screen projection method, which is applied to a second terminal device.
  • the method includes:
  • the target resolution is determined by the first terminal device according to the screen projection parameters corresponding to the second terminal device;
  • the screen projection parameters include The first resolution corresponding to the screen projection window of the second terminal device and the encoding and decoding capabilities corresponding to the second terminal device, and the target resolution is in equal proportion to the first resolution;
  • the screen projection image is played in the screen projection window.
  • the embodiment of the present application discloses a screen projection device, which is applied to a first terminal device.
  • the device includes:
  • a parameter acquisition module configured to obtain the screen projection parameters corresponding to the second terminal device, where the screen projection parameters include the first resolution and codec capability corresponding to the screen projection window of the second terminal device;
  • a resolution determination module configured to determine a target resolution that is proportional to the first resolution according to the screen projection parameters
  • a data sending module configured to send video stream data matching the target resolution to the second terminal device, where the video stream data is used to play the screen projection in the screen projection window of the second terminal device. picture.
  • the embodiment of the present application discloses a screen projection device, which is applied to a second terminal device.
  • the device includes:
  • a data receiving module configured to receive video stream data sent by the first terminal device that matches the target resolution, where the target resolution is determined by the first terminal device according to the screen projection parameters corresponding to the second terminal device;
  • the screen projection parameters include the first resolution and codec capability corresponding to the screen projection window of the second terminal device, and the target resolution is in equal proportion to the first resolution;
  • a playback module configured to play the screen projection image in the screen projection window according to the video stream data.
  • An embodiment of the present application discloses a terminal device, which includes a memory and a processor.
  • a computer program is stored in the memory.
  • the processor implements any of the above. method.
  • An embodiment of the present application discloses a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed by a processor, any one of the methods described above is implemented.
  • Figure 1A is a schematic diagram showing a screen projection screen in related technology
  • Figure 1B is an application scenario diagram of the screen projection method in one embodiment
  • Figure 2 is a flow chart of a screen projection method in one embodiment
  • Figure 3 is a flow chart of a screen projection method in another embodiment
  • Figure 4 is a schematic diagram of determining target resolution in one embodiment
  • Figure 5 is a flow chart of a screen projection method in yet another embodiment
  • Figure 6 is a schematic diagram of multiple screen projection windows performing background screen projection in one embodiment
  • Figure 7 is a timing diagram of a screen projection method in one embodiment
  • Figure 8 is a flow chart of a screen projection method in yet another embodiment
  • Figure 9 is a block diagram of a screen projection device in one embodiment
  • Figure 10 is a block diagram of a screen projection device in another embodiment
  • Figure 11 is a structural block diagram of a terminal device in an embodiment.
  • first, second, etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another element.
  • a first earphone may be referred to as a second earphone, and similarly, the second earphone may be referred to as a first earphone, without departing from the scope of the present application.
  • the first earphone and the second earphone are earphones, but they are not the same earphone.
  • the terms “plurality” and the like used in the embodiments of this application refer to two or more than two.
  • the source device directly captures the image displayed on the screen, and then directly sends it to the peer device for screen projection.
  • the resolution of the screen projection displayed by the peer device is The resolution of the image captured by the source device is based on it, so it is easy to have black edges or the image is stretched and distorted, which affects the screen projection effect.
  • the source device is a mobile phone and the peer device is a computer.
  • the projection is directly displayed with the resolution of the mobile phone.
  • the screen projected to the computer will have black borders when displayed.
  • Embodiments of the present application provide a screen projection method, device, terminal equipment and computer-readable storage medium, which can ensure that the problem of black borders or picture stretching and distortion will not occur when the screen projection screen is played in the screen projection window, and improve The screen projection effect is achieved.
  • Figure 1B is an application scenario diagram of the screen projection method in one embodiment.
  • the first terminal device 110 and the second terminal device 120 can establish a communication connection.
  • the first terminal device 110 can be used as the source device in the screen casting scenario
  • the second terminal device 120 can be used as the source device in the screen casting scenario.
  • the peer device, wherein the source device can transmit multimedia data to the peer device for screen projection in the peer device.
  • the first terminal device 110 and the second terminal device 120 may include but are not limited to mobile phones, wearable devices, PCs (Personal Computers), tablet computers, notebook computers, vehicle-mounted terminals, etc.
  • the communication connection between the first terminal device 110 and the second terminal device 120 may include wireless communication connections such as Bluetooth and Wi-Fi, and may also include wired communication connections implemented through a USB (Universal Serial Bus, Universal Serial Bus) port, etc. , the embodiment of the present application does not limit this.
  • the first terminal device 110 may obtain the screen projection parameters corresponding to the second terminal device 120 , which may include the first resolution corresponding to the screen projection window of the second terminal device 120 and the codec capability of the second terminal device 120 .
  • the first terminal device 110 can determine a target resolution that is proportional to the first resolution according to the screen projection parameters corresponding to the second terminal device 120, and send video stream data that matches the target resolution to the second terminal device 120.
  • the second terminal device 120 receives the video stream data sent by the first terminal device 110 that matches the target resolution, and can play the screen projection image in the screen projection window based on the video stream data. Since the resolution of the video stream data is the target resolution, which is proportional to the first resolution of the projection window, when the projection window displays the projection image, there will be no problems with black edges or image stretching and distortion. Improved screencasting effect.
  • the screencasting method provided by the embodiment of the present application can also be applied to a screencasting scenario in which one first terminal device 110 projects to multiple second terminal devices 120 , or multiple first terminal devices 110 project to a screen.
  • the terminal device can be used as either the above-mentioned first terminal device (i.e., the source device) or the second terminal device (i.e., the peer device).
  • the embodiments of this application are specific to The screen projection scenarios are not limited.
  • a screen projection method is provided, which can be applied to the above-mentioned first terminal device.
  • the method may include the following steps:
  • Step 210 Obtain the projection parameters corresponding to the second terminal device.
  • the projection parameters include the first resolution corresponding to the projection window of the second terminal device and the codec capability corresponding to the second terminal device.
  • the first terminal device and the second terminal device may first establish a communication connection, which may include but is not limited to a wireless communication connection or a wired communication connection.
  • a screen projection link between the first terminal device and the second terminal device can be established based on the communication connection.
  • the screen projection link can be used to transmit multimedia data during the screen projection process and screen projection-related data.
  • Information such as parameters, where the multimedia data may include video stream data, audio stream data, etc., and the parameters related to screen projection may include one of the resolution information corresponding to the video stream data, the volume, sound channel, etc. corresponding to the audio stream data, or Various.
  • the user can initiate a request to establish a screen projection link on the first terminal device or the second terminal device. After the first terminal device and the second terminal device establish a communication connection, the user can initiate a request on the first terminal device and/or the second terminal device. Or display the screen projection control on the second terminal device.
  • the user can trigger the screen casting control. For example, if the user triggers the screen casting control displayed on the first terminal device, the first terminal device responds to the triggering operation of the screen casting control and sends a request to the second terminal device to establish a screen casting chain.
  • the second terminal device can respond to the establishment request and establish a screen projection link with the first terminal device; for another example, if the user triggers the screen projection control displayed on the second terminal device, the second terminal device responds to the screen projection link.
  • the triggering operation of the screen projection control sends an establishment request to the first terminal device to establish a screen projection link.
  • the first terminal device can respond to the establishment request and establish a screen projection link with the second terminal device.
  • the user can select a screen casting relationship between the first terminal device and the second terminal device, such as selecting a screen casting relationship between the first terminal device and the second terminal device.
  • the screen projection relationship between the first terminal device and the second terminal device can also be set by default.
  • the screen projection relationship can be set by default such that the computer projects to the TV, and the mobile phone projects to the computer. Screen projection relationship, etc., but not limited to this. Users can initiate the establishment of a screen projection link on any terminal device, and can determine the screen projection relationship according to actual needs, meeting the different needs of users.
  • the first terminal device can obtain the screencasting parameters corresponding to the second terminal device.
  • the screencasting parameters may include the screencasting window corresponding to the second terminal device.
  • the second terminal device may be provided with a screen projection window, and the screen projection window is used to display the screen projection image of the first terminal device.
  • the screen projection window may be a full-screen window, and the first terminal device can use the projection screen through the screen projection window.
  • the screen window can play the mirrored image in full screen.
  • the screen window can also be a window of a custom size, for example, a window that takes up one-half of the screen, or a window that takes up three-quarters of the screen.
  • the first resolution corresponding to the screen projection window may refer to the number of pixels that can be displayed in the screen projection window, which can be expressed by the number of horizontal pixels * the number of vertical pixels.
  • the coding and decoding capabilities corresponding to the second terminal device may include, but are not limited to, one or more parameters of the video format supported by the second terminal device for coding and decoding, the maximum video width and height parameters supported by the coding and decoding, frame rate, code rate, etc.
  • Step 220 Determine a target resolution that is proportional to the first resolution according to the screen projection parameters.
  • the first terminal device may determine a target resolution that is proportional to the first resolution according to the screen projection parameters corresponding to the second terminal device.
  • the coding and decoding capabilities corresponding to the second terminal device will have an impact on the maximum resolution of the coding and decoding supported by the second terminal device. Therefore, the second terminal device can be determined according to the coding and decoding capabilities corresponding to the second terminal device.
  • the resolution range of the supported codecs and within this resolution range, determine the target resolution that is proportional to the first resolution. Among them, the target resolution is in equal proportion to the first resolution, and the ratio of the number of horizontal pixels to the number of vertical pixels of the target resolution is the same as the ratio of the number of horizontal pixels to the number of vertical pixels of the first resolution.
  • the first resolution is 1000*2000
  • the target resolution is 500*1000.
  • the target resolution may be smaller than the first resolution, or may be larger than or equal to the first resolution, which is not limited here. Since the target resolution is determined within the resolution range of the codec supported by the second terminal device, it is ensured that the video stream data transmitted from the first terminal device to the second terminal device can be coded normally.
  • Step 230 Send video stream data matching the target resolution to the second terminal device.
  • the video stream data is used to play the screen projection image in the screen projection window of the second terminal device.
  • the first terminal device After the first terminal device determines the target resolution, it can generate video stream data that matches the target resolution, that is, the resolution of the video stream data is the target resolution, and transmit the generated video stream data to the second terminal device. .
  • the second terminal device After receiving the video stream data sent by the first terminal device, the second terminal device can play the screen projection image in the set screen projection window according to the video stream data. Since the resolution of the video stream data is the target resolution, which is proportional to the first resolution corresponding to the projection window, the projection screen can fill the projection window for display without black edges or stretching and distortion of the screen. question. For example, if the projection window is a full-screen window, the second terminal device can display the projection image in full screen without causing black borders or stretching and distortion of the image.
  • the second terminal device can directly decode the video stream data to generate a screen projection image and display it in the screen projection window; if the target resolution is the same as the first resolution The rates are different. Since the target resolution is proportional to the first resolution corresponding to the screen projection window, the video stream data can be decoded and then scaled to obtain a screen projection image with the first resolution and be displayed in the screen projection window. displayed in. For example, if the first resolution is 1000*2000 and the target resolution is 500*1000, then after decoding the video stream data, the decoded data will be enlarged 2 times to obtain the screen projection image with the first resolution. Since it is equal to The proportional scaling will not cause the projection screen to be stretched or distorted, and the projection screen obtained after scaling is consistent with the resolution of the projection window, and can fill the projection window for display, without causing any distortion in the projection window. Black borders appear.
  • the first terminal device i.e., the source device in the screen projection
  • the second terminal device i.e., the peer device in the screen projection
  • the corresponding encoding and decoding capabilities of the terminal device adaptively adjust the resolution of the transmitted video stream data, which not only ensures that the second terminal device can decode the video stream data normally, but also ensures that the screen projection screen does not playback in the screen projection window. There will be black edges or the problem of picture stretching and distortion, which improves the screen projection effect.
  • a screen projection method is provided, which can be applied to the above-mentioned first terminal device.
  • the method may include the following steps:
  • Step 302 Obtain the projection parameters corresponding to the second terminal device.
  • the projection parameters include the first resolution corresponding to the projection window of the second terminal device and the codec capability corresponding to the second terminal device.
  • the first terminal device can obtain the screen projection parameters corresponding to the second terminal device.
  • the method of obtaining the screen projection parameters corresponding to the second terminal device may include but is not limited to Any of the following ways:
  • the first terminal device receives the screen projection parameters sent by the second terminal device. After the first terminal device and the second terminal device establish a screen projection link, the second terminal device can directly send the screen projection parameters to the first terminal device.
  • the second terminal device may send the first resolution corresponding to the screen projection window and the codec capability corresponding to the second terminal device to the first terminal device at the same time, or may send them separately.
  • the second terminal device can first send the encoding and decoding capabilities corresponding to the second terminal device to the first terminal device.
  • the second terminal device can set the screen projection window according to the actual screen projection requirements, and determine the first screen projection window corresponding to the screen projection window. After determining the resolution, the first resolution corresponding to the screen projection window is sent to the second terminal device.
  • Method 2 The first terminal device receives the device information sent by the second terminal device and queries the screen projection parameters corresponding to the device information. After the first terminal device and the second terminal device establish a screen projection link, the second terminal device may send device information to the first terminal device.
  • the device information may include but is not limited to the device identification, device model, One or more of the factory batch, manufacturer information, etc.
  • a white list may be stored in the first terminal device.
  • the white list may include device information of each terminal device capable of screen casting and corresponding screen casting parameters.
  • the screen projection parameters corresponding to the device information of the second terminal device can be found in the white list.
  • the first terminal device can upload the device information sent by the second terminal device to the server, search the screen projection parameters corresponding to the device information of the second terminal device through the server, and receive the second terminal device returned by the server. Screen projection parameters corresponding to the device.
  • the first terminal device can only find it based on the device information of the terminal device.
  • Corresponding codec capabilities after the second terminal device sets the screen projection window according to the actual screen projection requirements, determines the first resolution corresponding to the screen projection window, and then sends the first resolution corresponding to the screen projection window to the second terminal equipment.
  • the first terminal device can find the corresponding codec capability and the first resolution corresponding to the full-screen window based on the device information of the terminal device.
  • the first resolution corresponding to the full-screen window can be understood as the screen display of the first terminal device. resolution. If the first terminal device does not re-receive the first resolution corresponding to the screen projection window sent by the second terminal device before sending the video stream data to the second terminal device, it means that the second terminal device has not reset a new screen projection window. Then the full-screen window can be directly determined as the screen projection window of the second terminal device, and a target resolution that is proportional to the first resolution corresponding to the full-screen window can be determined.
  • the screen projection link established between the first terminal device and the second terminal device may include a first transmission channel and a second transmission channel.
  • the first transmission channel may be a bidirectional transmission channel, that is, through a first transmission channel. Transmission channel, the first terminal device and the second terminal device can transmit data to each other; the second transmission channel can be a one-way transmission channel, and the second terminal device can only receive data sent by the first terminal device through the second transmission channel data, but cannot send data to the first terminal device through the second transmission channel.
  • the first terminal device may receive the screen projection parameters sent by the second terminal device through the first transmission channel established with the second terminal device.
  • the first transmission channel can be used for the transmission of various parameters between the first terminal device and the second terminal device. For example, it can be used for codec capability negotiation.
  • the first terminal device and the second terminal device can use the first transmission channel.
  • Send the resolution information of the video stream data i.e. target resolution
  • the first terminal device may send video stream data matching the target resolution to the second terminal device through the second transmission channel established with the second terminal device.
  • the second transmission channel can be used to transmit multimedia data (including video stream data, audio stream data, etc.).
  • the screen projection link between the first terminal device and the second terminal device may include a P2P (Peer to Peer, peer-to-peer network) transmission channel
  • the P2P transmission channel may include RTSP (Real Time Streaming Protocol) , Real-time Streaming Protocol) socket channel and RTP (Real-time Transport Protocol, Real-time Transport Protocol) socket channel, among which the RTSP socket channel (i.e. the first transmission channel mentioned above) can be used as the transmission channel for various parameters, and the RTP socket channel (i.e., the above-mentioned second transmission channel) can be used as a transmission channel for multimedia data.
  • the RTSP socket channel i.e. the first transmission channel mentioned above
  • the RTP socket channel i.e., the above-mentioned second transmission channel
  • the transmission efficiency can be optimized with effective feedback and minimal overhead, and the data transmission efficiency during the screen casting process can be improved.
  • the first terminal device can accurately obtain the screen projection parameters corresponding to the second terminal device, ensuring that the resolution of the video stream data subsequently sent can match the corresponding codec capability and screen projection window of the second terminal device.
  • the first resolution improves the accuracy of screen projection.
  • Step 304 Determine the coding and decoding parameters according to the coding and decoding capabilities corresponding to the second terminal device and the coding and decoding capabilities corresponding to the first terminal device.
  • the first terminal device may negotiate codec capabilities with the second terminal device to determine codec parameters that can be supported by the first terminal device and the second terminal device simultaneously.
  • the codec parameters may include but are not limited to video format, video width and height.
  • the number of bits, the first terminal device and the second terminal device can perform codec processing and data transmission during the screen projection process based on the codec parameter.
  • the first terminal device can compare its own coding and decoding capabilities with the corresponding coding and decoding capabilities of the second terminal device, and determine the coding and decoding parameters based on the comparison results to ensure that the determined coding and decoding parameters can be used simultaneously. Supported by the first terminal device and the second terminal device. An intersection range of the coding and decoding capabilities of the first terminal device and the coding and decoding capabilities corresponding to the second terminal device may be selected, and the coding and decoding parameters may be determined from the intersection range. Taking the frame rate as an example, you can compare the frame rate range supported by the first terminal device with the frame rate range supported by the second terminal device, take the intersection range of the two frame rate ranges, and select the final screen projection from the intersection range.
  • the maximum parameter value may be determined as the codec parameter from the intersection range of the codec capability of the first terminal device and the codec capability corresponding to the second terminal device.
  • the maximum frame rate can be selected as the target frame rate from the intersection of two frame rate ranges.
  • the first terminal device may compare the first maximum video width and height parameter supported by the first terminal device with the second maximum video width and height parameter supported by the second terminal device, and select the smaller maximum video width and height parameter.
  • the video width and height parameters are used as target video width and height parameters
  • the target video width and height parameters are the maximum video width and height parameters that both the first terminal device and the second terminal device can support for encoding and decoding. For example, if the first maximum video width and height parameter supported by the first terminal device is 320*210, and the second maximum video width and height parameter supported by the second terminal device is 280*160, then the target video width and height parameter may be 280*160.
  • a target resolution that is proportional to the first resolution corresponding to the screen projection window in the second terminal device can be determined, thereby ensuring that the first terminal device is consistent with the second terminal device.
  • the devices are able to encode and decode normally.
  • Step 306 Determine a target resolution that is proportional to the first resolution based on the codec parameters and the first resolution corresponding to the projection window of the second terminal device.
  • the first terminal device may, as an implementation manner, determine a maximum resolution that is proportional to the first resolution corresponding to the screen projection window within the resolution range corresponding to the width and height parameters of the target video. , and use the maximum resolution as the target resolution.
  • FIG. 4 is a schematic diagram of determining the target resolution in one embodiment.
  • the first maximum video width and height parameter supported by the first terminal device is 320*210
  • the second maximum video width and height parameter supported by the second terminal device is 280*160, of which the smaller maximum video width and height is If the parameter is 280*160, it can be determined that the width and height parameters of the target video are 280*160, and the corresponding resolution range can be less than or equal to 280*160.
  • the first resolution corresponding to the projection window of the second terminal device is 100 *100, then you can choose the maximum resolution that is proportional to 100*100 as 160*160 from the resolution range less than or equal to 280*160, then you can determine the target resolution as 160*160.
  • the maximum resolution that is proportional to the first resolution is used as the target resolution. It can be selected to cast while ensuring that both terminal devices can perform normal encoding and decoding processing.
  • the screen image is displayed with the best image quality, further improving the display effect of the screen projection image.
  • a target resolution that is proportional to the first resolution may be determined based on network transmission parameters and/or performance parameters of the second terminal device.
  • the network transmission parameters may be used to characterize the network conditions between the first terminal device and the second terminal device.
  • the network transmission parameters may include but are not limited to one or more of transmission rate, transmission delay, transmission packet loss rate, etc.
  • the target resolution is determined based only on network transmission parameters, the better the network conditions represented by the network transmission parameters, the greater the determined target resolution can be.
  • the target resolution can be determined. A smaller target resolution can improve the smoothness and accuracy of video streaming and avoid packet loss, retransmission or freezes.
  • the performance parameters of the second terminal device can be used to characterize the performance of the second terminal device in processing data.
  • the performance parameters can include but are not limited to the memory parameters of the second terminal device, CPU (central processing unit, central processing unit) parameters, GPU (graphics processing) One or more of unit, graphics processor) parameters, heating parameters, etc.
  • CPU central processing unit, central processing unit
  • GPU graphics processing
  • One or more of unit, graphics processor One or more of unit, graphics processor
  • the target resolution may be determined based on the network transmission parameters and the performance parameters of the second terminal device at the same time, different weight values may be assigned to the network transmission parameters and the performance parameters of the second terminal device, and the target resolution may be determined based on the network transmission parameters and the performance parameters of the second terminal device.
  • the weight values corresponding to the performance parameters of the terminal equipment are weighted and calculated to determine the final impact parameters, and then the target resolution is determined based on the impact parameters. For example, if the larger the influence parameter, the better the network condition and the better the performance of the second terminal device, then the target resolution can be the first resolution corresponding to the screen projection window within the resolution range corresponding to the target video width and height parameters.
  • the network transmission situation and the performance of the second terminal device can be combined to select the appropriate target resolution, which improves the accuracy of video stream data transmission, further improves the display effect of the screen projection, and avoids lags and other situations.
  • the method of determining the target resolution is not limited to the above methods, and other methods can also be used.
  • the third resolution corresponding to the screen projection window can be determined within the resolution range corresponding to the width and height parameters of the target video.
  • Each resolution is equally proportional to one resolution, and one resolution is randomly selected as the target resolution, etc.
  • Step 308 Send video stream data matching the target resolution to the second terminal device.
  • the video stream data is used to play the screen projection image in the screen projection window of the second terminal device.
  • step 308 For the description of step 308, reference may be made to the relevant description of step 230 in the above embodiment, and the details will not be repeated here.
  • the first terminal device can combine its own coding and decoding capabilities with the corresponding coding and decoding capabilities of the second terminal device to determine the resolution range that both can support, and determine the resolution range that matches the first terminal device in the resolution range.
  • the target resolution of the first resolution corresponding to the screen projection window of the second terminal device is equal to the target resolution, ensuring that both the first terminal device and the second terminal device can perform normal encoding and decoding processing during the screen projection process, and ensuring that the screen projection screen is When playing in the screen projection window, there will be no black borders or the problem of image stretching and distortion, which improves the screen projection effect.
  • a screen projection method is provided, which can be applied to the above-mentioned first terminal device.
  • the method may include the following steps:
  • Step 502 Obtain the projection parameters corresponding to the second terminal device.
  • the projection parameters include the first resolution corresponding to the projection window of the second terminal device and the codec capability corresponding to the second terminal device.
  • Step 504 Determine the coding and decoding parameters according to the coding and decoding capabilities corresponding to the second terminal device and the coding and decoding capabilities corresponding to the first terminal device.
  • Step 506 Determine a target resolution that is proportional to the first resolution based on the codec parameters and the first resolution corresponding to the projection window of the second terminal device.
  • Step 508 Create a virtual screen according to the target resolution.
  • the screen projection between the first terminal device and the second terminal device can be background projection.
  • Background projection means that the target application program of the screen projection in the first terminal device can run in the background, and Project the corresponding interface content to the second terminal device without occupying the display screen of the first terminal device.
  • the second terminal device may send a background screen casting request to the first terminal device.
  • the background screen casting request may carry the screen casting window corresponding to of the first resolution.
  • the second terminal device can use the previously obtained codec capabilities corresponding to the second terminal device, its own codec capabilities, and the first resolution corresponding to the screen projection window. , determine the target resolution that is proportional to the first resolution.
  • the first terminal device can create a virtual screen according to the determined target resolution.
  • the virtual screen is different from the physical screen.
  • the interface displayed on the virtual screen is invisible to the user. It can be understood that the virtual screen is displayed in the background of the system.
  • You can create a virtual screen with the target resolution by calling the virtual screen creation interface provided by the system and writing the target resolution in the virtual screen creation interface.
  • the resolution of the interface content displayed in the virtual screen is target resolution.
  • Step 510 Output the interface content of the target application program to the virtual screen.
  • the target application refers to an application that needs to be screen-cast to the second terminal device.
  • the user can select the target application that needs to be screen-cast on the first terminal device or the second terminal device.
  • the user selects a target application that needs to be screen-casted on the first terminal device.
  • the first terminal device can display an application list including each currently running application.
  • the user can select the target application in the application list.
  • the first terminal The device can respond to the user's selection operation on the application list and determine the target application selected by the user; the interface of each application running on the first terminal device can also be provided with a screen projection control, and the user can trigger the screen projection control to allow
  • the application performs screencasting. If any application running on the first terminal device detects a triggering operation for the screencasting control, the application can be determined as the target application.
  • the user selects a target application that needs to be screen-casted on the second terminal device, and the first terminal device can send an application list to the second terminal device.
  • the application list can include various applications currently running on the first terminal device.
  • the user can select the target application program in the application list, and the second terminal device can respond to the user's selection operation on the application list, determine the target application program selected by the user, and send the application information of the target application program to the first terminal device
  • the application information may include but is not limited to application identifiers such as the application name and package name of the target application.
  • the first terminal device determines the target application that needs to be screen-casted based on the application information sent by the second terminal device.
  • the user can select the target application that needs to be projected on the first terminal device or the second terminal device.
  • the selection method is more flexible and meets the different needs of the users.
  • the first terminal device can output the interface content of the target application program to the virtual screen for display instead of displaying it on the physical screen. Since the resolution of the virtual screen is the target resolution, the interface content of the target application can be output to the virtual screen according to the target resolution, so that the resolution of the interface content of the target application displayed on the virtual screen is the target resolution. Rate.
  • the target application is running in the foreground, you can switch the target application to run in the background, and output the interface content of the target application to the virtual screen, which can avoid the target application taking up the physical screen and affecting the projection.
  • the user normally uses other applications during the screen process to improve the user experience.
  • Step 512 Capture the interface content of the target application program from the virtual screen as screen projection data, generate video stream data matching the target resolution based on the screen projection data, and send the video stream data to the second terminal device.
  • the video stream data is Play the screen projection screen in the screen projection window of the second terminal device.
  • the first terminal device can capture the interface content of the target application as screen projection data from the virtual screen every first period of time, and the first period of time can be based on the frame rate (the frame rate can be based on the second terminal
  • the first duration may be the ratio of the unit time to the frame rate.
  • the first terminal device can also identify the interface content displayed on the virtual screen and capture key frames of the interface content as screen projection data.
  • the key frame can be the interface content whose content difference from the interface content of the previous frame is greater than the difference threshold.
  • the interface content of each frame can be compared with the interface content of the previous frame to determine the difference between the interface content of the previous frame and the interface content of the previous frame.
  • the content difference can be expressed by the number of different pixels, or the content difference can be expressed by the content displacement of the interface content of the previous frame, etc., which is not limited in the embodiments of this application. It can be judged whether the difference between the content of the current frame interface and the content of the previous frame is greater than the difference threshold.
  • the content of the current frame interface can be determined as a key frame, and the content of the current frame interface can be captured as screen projection data.
  • the first terminal device can create an encoder according to the target resolution, and the encoder can be used to encode video data with the target resolution.
  • the first terminal device can also send the target resolution to the second terminal device, so that the second terminal device creates a decoder according to the target resolution, and the decoder can be used to decode video data with the target resolution.
  • the first terminal device may send the target resolution to the second terminal device through the above-mentioned first transmission channel.
  • the first terminal device After the first terminal device captures the interface content of the target application from the virtual screen as screen projection data, it can encode the screen projection data through the encoder to obtain video stream data that matches the target resolution, and then combine the data with the target application interface content.
  • the video stream data matching the target resolution is sent to the second terminal device.
  • the second terminal device After receiving the video stream data that matches the target resolution, the second terminal device can decode the video stream data through the decoder to obtain the screen projection data, and scale the screen projection data according to the first resolution and the target resolution. Processing to play the screen projection screen in the screen projection window of the second terminal device.
  • the second terminal device can reduce the projection data according to the ratio of the first resolution to the target resolution, so as to play the resolution in the projection window of the second terminal device. It is the projection screen of the first resolution. For example, if the first resolution is 1000*2000 and the target resolution is 1500*3000, then the ratio of the first resolution to the target resolution is 1:1.5, which means the projection data can be reduced by 1/3. Similarly, if the first resolution is greater than the target resolution, the second terminal device can amplify the projection data according to the ratio of the first resolution to the target resolution, so that the projection data can be displayed in the projection window of the second terminal device. Play the projection screen with the resolution of the first resolution.
  • the projection data can be amplified 2 times.
  • the second terminal device can obtain the projection image with the resolution of the first resolution through simple scaling processing, which ensures that the projection image displayed in the projection window will not have black edges or the image will be distorted and stretched.
  • multiple screen projection windows may be provided in the second terminal device for playing the screen projection images, and the first resolutions corresponding to the screen projection windows may be the same or different.
  • the background screen projection request sent by the second terminal device to the first terminal device may carry the first resolution corresponding to each screen projection window.
  • the first terminal device may display the screen according to the corresponding resolution of the second terminal device.
  • the encoding and decoding capabilities, as well as the first resolution corresponding to each projection window respectively determine the target resolution that is proportional to each first resolution. It should be noted that, for each screen projection window, the method of determining the target resolution that is proportional to the first resolution corresponding to the screen projection window can be referred to the relevant descriptions in the above embodiments, which will not be repeated here. Elaborate.
  • the first terminal device can create a virtual screen corresponding to each screen projection window according to the target resolution that is proportional to each first resolution. Screen.
  • the number of virtual screens created by the first terminal device is consistent with the number of screen projection windows set by the second terminal device, and corresponds one to one. Users can select the target application corresponding to each screen projection window according to actual needs, and each screen projection window can be used to play the screen projection of the corresponding target application.
  • the first terminal device can output the interface content of the target application program corresponding to each screen projection window to the virtual screen corresponding to each screen projection window, so as to generate video stream data corresponding to each screen projection window.
  • the first screen projection window may be any screen projection window among multiple screen projection windows set in the second terminal device.
  • the first terminal device may determine The first target resolution is proportional to the first resolution corresponding to the first screen projection window, and the first virtual screen is created according to the first target resolution, and the first encoder can also be created according to the first target resolution,
  • the second terminal device may create the first decoder according to the first target resolution.
  • the first terminal device can output the interface content of the first target application program corresponding to the first screen projection window to the first virtual screen, and capture the interface content of the first target application program from the first virtual screen as the first screen projection
  • the screen projection data corresponding to the window is encoded by the first encoder to obtain the video stream data matching the first target resolution.
  • the second terminal device can decode the video stream data through the first decoder to obtain the screen projection data corresponding to the first screen projection window, and use the first decoder to decode the video stream data.
  • the first resolution and the first target resolution corresponding to a screen projection window perform scaling processing on the screen projection data, so as to play the screen projection image in the first screen projection window.
  • the method in which the first terminal device generates video stream data corresponding to each screen projection window and plays the screen projection image in the corresponding screen projection window in the second terminal device is similar to the method described in the above embodiment.
  • FIG. 6 is a schematic diagram of multiple screen projection windows performing background screen projection in one embodiment.
  • the second terminal device can be set with three different screen projection windows: screen projection window 1, screen projection window 2 and screen projection window 3.
  • the first terminal device can create corresponding three virtual screens respectively: Virtual screen 1, virtual screen 2 and virtual screen 3, where the resolution of virtual screen 1 is in the same proportion as the resolution of the screen projection window 1, the resolution of the virtual screen 2 is in the same proportion as the resolution of the screen projection window 2, the virtual screen The resolution of 3 is proportional to the resolution of projection window 3.
  • the first terminal device can output the interface content of application program A to the virtual screen 1, and by grabbing the interface content of application program A displayed on the virtual screen 1, generate video stream data corresponding to the screen projection window 1 and send it to the second terminal device to play the screen projection corresponding to application A in the screen projection window 1 of the second terminal device.
  • the screen projection window 2 can play the screen projection corresponding to application B
  • the screen projection window 3 can play the application program.
  • C corresponds to the screen projection screen.
  • multiple screen projection windows can be set up in the second terminal device to play different screen projection images respectively, and it can be ensured that no black borders or stretched and distorted images will appear in each screen projection window. situation, improving the screen projection effect and meeting the different needs of users.
  • the first terminal device can project the screen to the second terminal device in the background, which can prevent the screen projection from affecting the user's normal use of the first terminal device, and can ensure that the first terminal device and the second terminal device can communicate with each other.
  • Terminal devices can perform normal encoding and decoding during the screencasting process. When the screencasting screen is played in the screencasting window, there will be no problems with black borders or screen stretching and distortion, which improves the screencasting effect.
  • the first terminal device may perform the following steps: The own resolution is used for projection on the second terminal device.
  • the first terminal device may determine an initial resolution that is proportional to the second resolution based on the coding and decoding capabilities corresponding to the second terminal device, the coding and decoding capabilities corresponding to the first terminal device, and the second resolution corresponding to the first terminal device. .
  • the second resolution corresponding to the first terminal device may be the resolution of the first terminal device when it is displayed in full screen, that is, the resolution of the physical screen of the first terminal device.
  • the second resolution may also be The display resolution of the target application that needs screencasting on the physical screen in the first terminal device.
  • Codec capability negotiation can be performed between the first terminal device and the second terminal device.
  • Codec parameters can be determined based on the codec capabilities corresponding to the second terminal device and the codec capabilities corresponding to the first terminal device, and the codec parameters can be determined based on the codec capabilities.
  • the parameters and the second resolution corresponding to the first terminal device are used to determine an initial resolution that is proportional to the second resolution.
  • the first maximum video width and height parameter supported by the first terminal device can be compared with the second maximum video width and height parameter supported by the second terminal device, and the smaller maximum video width and height parameter can be selected.
  • the target video width and height parameters and within the resolution range corresponding to the target video width and height parameters, determine an initial resolution that is proportional to the second resolution. For example, if the second resolution is 300*200 and the target video width and height parameters are 280*160, the initial resolution can be determined within the range of 280*160 in proportion to 300*200, such as 240*160, etc.
  • the method of determining the initial resolution may be similar to the method of determining the target resolution described in the above embodiments, except that the initial resolution is proportional to the second resolution, and the target resolution is proportional to the first resolution. Ratio, the embodiments of this application will not elaborate on the method of determining the initial resolution. Reference may be made to the relevant descriptions of determining the first resolution in the above embodiments.
  • the first terminal device may send video stream data matching the initial resolution to the second terminal device. After the first terminal device receives the first resolution corresponding to the screen projection window sent by the second terminal device, it may determine the data corresponding to the first resolution. The target resolution is proportional to the resolution, and then the video stream data matching the target resolution is sent to the second terminal device. If the first terminal device receives the first end request sent by the second terminal device, the first end request can be used to indicate the end of screen projection in the screen projection window, then the first terminal device can send a request to the third end device according to the first end request. The second terminal device sends video stream data matching the initial resolution.
  • the first terminal device can return to the method of casting the screen in the second terminal device based on the initial resolution.
  • the first end request may include an end background projection request, which is used to request the end of background projection. Then the target application can return to the foreground projection mode and perform screen projection on the second terminal device based on the initial resolution.
  • FIG. 7 is a timing diagram of a screen projection method in one embodiment.
  • the screen casting method may include the following steps:
  • Step 1 The second terminal device can request the first terminal device to establish a screen projection link, and the first terminal device and the second terminal device successfully establish a screen projection link.
  • Step 2 The first terminal device negotiates with the second terminal device about codec capabilities, resolution, etc.
  • the second terminal device may send its own coding and decoding capabilities to the first terminal device.
  • the first terminal device determines the coding and decoding parameters based on the coding and decoding capabilities of the second terminal device and the coding and decoding capabilities of the first terminal device, and determines the coding and decoding parameters according to the coding and decoding capabilities. and the second resolution corresponding to the first terminal device, and determine an initial resolution that is proportional to the second resolution.
  • the first terminal device can create an encoder according to the initial resolution and capture the screen projection data.
  • the first terminal device can also send the initial resolution to the second terminal device, and the second terminal device creates a decoder according to the initial resolution. .
  • Step 3 The first terminal device pushes the audio and video stream to the second terminal device, where the resolution of the video stream data is the initial resolution.
  • the first terminal device can encode the captured screen projection data through an encoder with a resolution of the initial resolution to obtain video stream data that matches the initial resolution, and push the audio stream data and the video to the second terminal device. streaming data.
  • the second terminal device can decode the received video stream data through a decoder with a resolution of the original resolution, and play the corresponding screen projection image.
  • Step 4 The second terminal device requests background projection from the first terminal device, and the request may carry the first resolution corresponding to the projection window.
  • Step 5 The first terminal device determines a target resolution that is proportional to the first resolution based on the negotiated encoding and decoding capabilities.
  • the first terminal device may determine a target resolution that is proportional to the first resolution based on the encoding and decoding parameters determined in step 2 and the first resolution.
  • Step 6 The first terminal device creates a virtual screen and encoder according to the target resolution.
  • Step 7 The first terminal device receives the target application program to the virtual screen, outputs the interface content of the target application program to the virtual screen, and captures screen projection data from the virtual screen.
  • Step 8 The first terminal device sends the target resolution to the second terminal device.
  • Step 9 The second terminal device creates a decoder according to the target resolution.
  • Step 10 The first terminal device pushes the audio and video stream to the second terminal device, where the resolution of the video stream data is the target resolution.
  • the first terminal device can encode the screen projection data captured from the virtual screen through an encoder with a resolution of the target resolution to obtain video stream data that matches the target resolution, and push the audio stream to the second terminal device. data with the video stream data.
  • Step 11 The second terminal device performs scaling processing on the video stream data matching the target resolution, and plays the screen projection image without black borders and without stretching and distortion in the screen projection window.
  • the second terminal device can decode the received video stream data through a decoder whose resolution is the target resolution, obtain the screen projection data, and perform scaling processing on the screen projection data.
  • Step 12 The second terminal device requests the first terminal device to end background projection.
  • Step 13 The first terminal device pulls the target application to the physical screen and outputs the interface content of the target application to the physical screen.
  • Step 14 The first terminal device creates an encoder according to the target resolution and captures the screen projection data.
  • Step 15 The first terminal device sends the initial resolution to the second terminal device.
  • Step 16 The second terminal device creates a new decoder according to the initial resolution.
  • Step 17 The first terminal device pushes the audio and video stream to the second terminal device, where the resolution of the video stream data is the initial resolution.
  • the first terminal device can encode the captured screen projection data through an encoder with a resolution of the initial resolution to obtain video stream data that matches the initial resolution, and push the audio stream data and the video to the second terminal device. streaming data.
  • the second terminal device can decode the received video stream data through a decoder with a resolution of the original resolution, and play the corresponding screen projection image.
  • the screencasting link between the first terminal device and the second terminal device can be disconnected.
  • the screencasting link can be disconnected by the first terminal device or by the second terminal device. .
  • screen projection is performed on the second terminal device based on the second resolution corresponding to the first terminal device, and the foreground projection and background projection are distinguished. , it can give users a prompt function of changes, which can prevent users from not knowing when to start and end background screencasting during the screencasting process, which meets user needs and improves user experience.
  • a screen projection method is provided, which can be applied to the above-mentioned second terminal device.
  • the screen projection method may include the following steps:
  • Step 810 Receive video stream data sent by the first terminal device that matches the target resolution.
  • the target resolution is determined by the first terminal device according to the screen projection parameters corresponding to the second terminal device; the screen projection parameters include the second terminal device.
  • the target resolution is proportional to the first resolution.
  • the method before step 810, further includes: sending screen projection parameters corresponding to the second terminal device to the first terminal device; or sending device information of the second terminal device to the first terminal device, so that The first terminal device queries the screen projection parameters corresponding to the device information.
  • Step 820 Play the screen projection image in the screen projection window according to the video stream data.
  • the step of sending the projection parameters corresponding to the second terminal device to the first terminal device may include: sending the second terminal device to the first terminal device through a first transmission channel established with the first terminal device.
  • Screen projection parameters corresponding to the device; step 820 may include: receiving video stream data matching the target resolution sent by the first terminal device through the second transmission channel established with the first terminal device; wherein the first transmission The channel is a bidirectional transmission channel, and the second transmission channel is a unidirectional transmission channel.
  • the method before step 810, further includes: receiving the target resolution sent by the first terminal device; creating a decoder according to the target resolution; step 820, may include: decoding the video stream data through the decoder , obtain the screen projection data; scale the screen projection data according to the first resolution and the target resolution, and output the scaled screen projection data to the screen projection window to play the screen projection image in the screen projection window.
  • the first terminal device i.e., the source device in the screen projection
  • the second terminal device i.e., the peer device in the screen projection
  • the corresponding encoding and decoding capabilities of the terminal device adaptively adjust the resolution of the transmitted video stream data, which not only ensures that the second terminal device can decode the video stream data normally, but also ensures that the screen projection screen does not playback in the screen projection window. There will be black edges or the problem of picture stretching and distortion, which improves the screen projection effect.
  • a screen projection device 900 is provided, which can be applied to the above-mentioned first terminal device.
  • the screen projection device 900 may include a parameter acquisition module 910, a resolution determination module 920 and a data transmission module. Module 930.
  • the parameter acquisition module 910 is used to obtain the screen projection parameters corresponding to the second terminal device.
  • the screen projection parameters include the first resolution and codec capability corresponding to the screen projection window of the second terminal device.
  • the resolution determination module 920 is configured to determine a target resolution that is proportional to the first resolution according to the screen projection parameters.
  • the data sending module 930 is configured to send video stream data matching the target resolution to the second terminal device, and the video stream data is used to play the screen projection image in the screen projection window of the second terminal device.
  • the first terminal device i.e., the source device in the screen projection
  • the second terminal device i.e., the peer device in the screen projection
  • the corresponding encoding and decoding capabilities of the terminal device adaptively adjust the resolution of the transmitted video stream data, which not only ensures that the second terminal device can decode the video stream data normally, but also ensures that the screen projection screen does not playback in the screen projection window. There will be black edges or the problem of picture stretching and distortion, which improves the screen projection effect.
  • the parameter acquisition module 910 is also used to receive the screen projection parameters sent by the second terminal device; or, receive the device information sent by the second terminal device, and query the screen projection parameters corresponding to the device information.
  • the parameter acquisition module 910 is also configured to receive the screen projection parameters sent by the second terminal device through the first transmission channel established with the second terminal device.
  • the data sending module 930 is also configured to send video stream data matching the target resolution to the second terminal device through the second transmission channel established with the second terminal device.
  • the first transmission channel is a bidirectional transmission channel
  • the second transmission channel is a unidirectional transmission channel
  • the resolution determination module 920 includes a codec parameter determination unit and a resolution determination unit.
  • the codec parameter determination unit is used to determine codec parameters according to the codec capability corresponding to the second terminal device and the codec capability corresponding to the first terminal device.
  • the resolution determination unit is configured to determine a target resolution that is proportional to the first resolution based on the encoding and decoding parameters and the first resolution corresponding to the screen projection window of the second terminal device.
  • the coding and decoding capabilities include video width and height parameters; the coding and decoding parameter determination unit is also configured to compare the first maximum video width and height parameters supported by the first terminal device with the second maximum video width and height parameter supported by the second terminal device. Compare the width and height parameters, and select the smaller maximum video width and height parameter as the target video width and height parameter.
  • the resolution determination unit is also used to determine a target resolution that is proportional to the first resolution within a resolution range corresponding to the width and height parameters of the target video.
  • the resolution determination unit is further configured to determine a maximum resolution that is proportional to the first resolution within a resolution range corresponding to the target video width and height parameters, and use the maximum resolution as the target resolution.
  • the resolution determination unit is further configured to determine, within the resolution range corresponding to the target video width and height parameters, according to the network transmission parameters and/or the performance parameters of the second terminal device, which is proportional to the first resolution. target resolution.
  • the first terminal device can combine its own coding and decoding capabilities with the corresponding coding and decoding capabilities of the second terminal device to determine the resolution range that both can support, and determine the resolution range that matches the first terminal device in the resolution range.
  • the target resolution of the first resolution corresponding to the screen projection window of the second terminal device is equal to the target resolution, ensuring that both the first terminal device and the second terminal device can perform normal encoding and decoding processing during the screen projection process, and ensuring that the screen projection screen is When playing in the screen projection window, there will be no black borders or the problem of image stretching and distortion, which improves the screen projection effect.
  • the above-mentioned screen projection device 900 in addition to the parameter acquisition module 910, the resolution determination module 920, and the data sending module 930, the above-mentioned screen projection device 900 also includes a virtual screen creation module and an output module.
  • the virtual screen creation module is used to create a virtual screen according to the target resolution.
  • the output module is used to output the interface content of the target application to the virtual screen.
  • the data sending module 930 is also used to capture the interface content of the target application program from the virtual screen as screen projection data, generate video stream data matching the target resolution based on the screen projection data, and send the video stream data to the second terminal device. .
  • the above-mentioned screen projection device 900 further includes an encoder creation module and a parameter sending module.
  • Encoder creation module used to create encoders according to the target resolution.
  • the parameter sending module is used to send the target resolution to the second terminal device, so that the second terminal device creates a decoder according to the target resolution.
  • the data sending module 930 is also used to encode the screen projection data through the encoder to obtain video stream data matching the target resolution, and send the video stream data to the second terminal device; the video stream data is used for the second terminal device
  • the video stream data is decoded by the decoder to obtain the screen projection data, and the projection data is scaled according to the first resolution and the target resolution, so as to play the screen projection image in the screen projection window of the second terminal device.
  • the screen projection parameters also include first resolutions respectively corresponding to multiple screen projection windows in the second terminal device; the resolution determination module 920 is also used to determine the codec capability of the second terminal device according to the corresponding coding and decoding capabilities of the second terminal device. and the first resolution corresponding to each screen projection window, respectively determining a target resolution that is proportional to each first resolution.
  • the virtual screen creation module is also used to create virtual screens corresponding to each screen projection window according to a target resolution that is proportional to each first resolution.
  • the first terminal device can project the screen to the second terminal device in the background, which can prevent the screen projection from affecting the user's normal use of the first terminal device, and can ensure that the first terminal device and the second terminal device can communicate with each other.
  • Terminal devices can perform normal encoding and decoding during the screencasting process. When the screencasting screen is played in the screencasting window, there will be no problems with black borders or screen stretching and distortion, which improves the screencasting effect.
  • the resolution determination module 920 is also used to determine the target resolution that is proportional to the first resolution according to the screen projection parameters, based on the codec capabilities corresponding to the second terminal device, the corresponding codec capabilities of the first terminal device, The encoding and decoding capabilities and the second resolution corresponding to the first terminal device are used to determine an initial resolution that is proportional to the second resolution.
  • the data sending module 930 is also used to send video stream data matching the initial resolution to the second terminal device.
  • the data sending module 930 is also configured to receive a first end request sent by the second terminal device; and send video stream data matching the initial resolution to the second terminal device according to the first end request.
  • screen projection is performed on the second terminal device based on the second resolution corresponding to the first terminal device, and the foreground projection and background projection are distinguished. , it can give users a prompt function of changes, which can prevent users from not knowing when to start and end background screencasting during the screencasting process, which meets user needs and improves user experience.
  • a screen projection device 1000 is provided, which can be applied to the above-mentioned second terminal device.
  • the screen projection device 1000 may include a data receiving module 1010 and a playback module 1020 .
  • the data receiving module 1010 is used to receive video stream data sent by the first terminal device that matches the target resolution.
  • the target resolution is determined by the first terminal device according to the screen projection parameters corresponding to the second terminal device; the screen projection parameters include the third The first resolution and encoding and decoding capabilities corresponding to the projection window of the second terminal device, and the target resolution is in equal proportion to the first resolution.
  • the screen projection device 1000 further includes a sending module.
  • a sending module configured to send the projection parameters corresponding to the second terminal device to the first terminal device; or to send the device information of the second terminal device to the first terminal device, so that the first terminal device queries the projection corresponding to the device information. screen parameters.
  • the sending module is further configured to send the screen projection parameters corresponding to the second terminal device to the first terminal device through the first transmission channel established with the first terminal device.
  • the data receiving module 1010 is also configured to receive video stream data matching the target resolution sent by the first terminal device through the second transmission channel established with the first terminal device.
  • the first transmission channel is a bidirectional transmission channel
  • the second transmission channel is a unidirectional transmission channel
  • the play module 1020 is used to play the screen projection image in the screen projection window according to the video stream data.
  • the screen projection device 1000 further includes a parameter receiving module and a decoder creating module.
  • a parameter receiving module is configured to receive the target resolution sent by the first terminal device.
  • Decoder creation module used to create decoders according to the target resolution.
  • the data receiving module 1010 is also used to decode the video stream data through the decoder to obtain the screen projection data; scale the screen projection data according to the first resolution and the target resolution, and output the scaled screen projection data Go to the screen casting window to play the screen mirroring in the screen casting window.
  • the first terminal device i.e., the source device in the screen projection
  • the second terminal device i.e., the peer device in the screen projection
  • the corresponding encoding and decoding capabilities of the terminal device adaptively adjust the resolution of the transmitted video stream data, which not only ensures that the second terminal device can decode the video stream data normally, but also ensures that the screen projection screen does not playback in the screen projection window. There will be black edges or the problem of picture stretching and distortion, which improves the screen projection effect.
  • Figure 11 is a structural block diagram of a terminal device in an embodiment.
  • the terminal device 1100 may include one or more of the following components: a processor 1110, a memory 1120 coupled to the processor 1110, where the memory 1120 may store one or more computer programs, and one or more computer programs. It may be configured to implement the screencasting method applied to the first terminal device as described in the above embodiments when executed by one or more processors 1110 .
  • Processor 1110 may include one or more processing cores.
  • the processor 1110 uses various interfaces and lines to connect various parts of the entire terminal device 1100, and executes by running or executing instructions, programs, code sets or instruction sets stored in the memory 1120, and calling data stored in the memory 1120.
  • the processor 1110 can use at least one of digital signal processing (Digital Signal Processing, DSP), field-programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA).
  • the processor 1110 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU), a modem, etc.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • modem etc.
  • the CPU mainly handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the display content; and the modem is used to handle wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1110 and may be implemented solely through a communication chip.
  • the memory 1120 may include random access memory (Random Access Memory, RAM) or read-only memory (Read-Only Memory, ROM). Memory 1120 may be used to store instructions, programs, codes, sets of codes, or sets of instructions.
  • the memory 1120 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing an operating system and instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , instructions for implementing each of the above method embodiments, etc.
  • the storage data area can also store data created during use of the terminal device 1100, etc.
  • the terminal device 1100 may include more or fewer structural elements than in the above structural block diagram, for example, including a power module, physical buttons, WiFi (Wireless Fidelity, wireless fidelity) module, speaker, Bluetooth module, sensor, etc. , it can also be unrestricted here.
  • An embodiment of the present application discloses a terminal device, which includes a memory and a processor.
  • a computer program is stored in the memory.
  • the processor implements the second application as described in the above embodiments. Screencasting method of terminal device.
  • An embodiment of the present application discloses a computer-readable storage medium that stores a computer program, wherein when the computer program is executed by a processor, the screen projection method applied to the first terminal device as described in the above embodiments is implemented.
  • An embodiment of the present application discloses a computer-readable storage medium that stores a computer program, wherein when the computer program is executed by a processor, the screen projection method applied to a second terminal device as described in the above embodiments is implemented.
  • An embodiment of the present application discloses a computer program product.
  • the computer program product includes a non-transitory computer-readable storage medium that stores a computer program.
  • the computer program When executed by a processor, it can implement the application described in the above embodiments.
  • the screencasting method of the first terminal device is not limited to, but not limited to, but not limited to, but not limited to, but not limited to, but not limited to, but not limited to, but not limited to, a processor, it can implement the application described in the above embodiments. The screencasting method of the first terminal device.
  • An embodiment of the present application discloses a computer program product.
  • the computer program product includes a non-transitory computer-readable storage medium that stores a computer program.
  • the computer program When executed by a processor, it can implement the application described in the above embodiments. Screencasting method of the second terminal device.
  • the programs can be stored in a non-volatile computer-readable storage medium. , when the program is executed, it may include the processes of the above-mentioned method embodiments.
  • the storage medium may be a magnetic disk, an optical disk, a ROM, etc.
  • Non-volatile memory may include ROM, programmable ROM (PROM), erasable PROM (Erasable PROM, EPROM), electrically erasable PROM (Electrically Erasable PROM, EEPROM) or flash memory.
  • Volatile memory may include random access memory (RAM), which acts as external cache memory.
  • RAM can be in many forms, such as static RAM (Static RAM, SRAM), dynamic RAM (Dynamic Random Access Memory, DRAM), synchronous DRAM (synchronous DRAM, SDRAM), double data rate SDRAM (Double Data Rate SDRAM, DDR SDRAM), enhanced SDRAM (Enhanced Synchronous DRAM, ESDRAM), synchronous link DRAM (Synchlink DRAM, SLDRAM), memory bus direct RAM (Rambus DRAM, RDRAM) and direct memory bus dynamic RAM (Direct Rambus DRAM , DRDRAM).
  • static RAM Static RAM, SRAM
  • dynamic RAM Dynamic Random Access Memory
  • DRAM Dynamic Random Access Memory
  • SDRAM synchronous DRAM
  • double data rate SDRAM Double Data Rate SDRAM, DDR SDRAM
  • enhanced SDRAM Enhanced Synchronous DRAM, ESDRAM
  • synchronous link DRAM Synchlink DRAM, SLDRAM
  • memory bus direct RAM Rabus DRAM, RDRAM
  • DRDRAM direct memory bus dynamic RAM
  • DRDRAM Direct Rambus DRAM
  • the units described above as separate components may or may not be physically separated.
  • the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of this embodiment.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software functional units.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

本申请实施例公开了一种投屏方法、装置、终端设备及计算机可读存储介质,方法应用于第一终端设备,方法包括:获取第二终端设备对应的投屏参数,投屏参数包括第二终端设备的投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力(210);根据投屏参数确定与第一分辨率等比例的目标分辨率(220);向第二终端设备发送与目标分辨率匹配的视频流数据,视频流数据用于在第二终端设备的投屏窗口中播放投屏画面(230)。

Description

投屏方法、装置、终端设备及计算机可读存储介质
本申请要求于2022年05月20日提交、申请号为202210555494.4、发明名称为“投屏方法、装置、终端设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及终端技术领域,具体涉及一种投屏方法、装置、终端设备及计算机可读存储介质。
背景技术
目前的投屏技术中,源端设备都是直接抓取在屏幕上显示的图像画面,然后直接发送给对端设备进行投屏显示,在对端设备将源端设备发送的投屏画面进行显示时,容易出现黑边或者是画面拉伸扭曲的问题,影响投屏效果。
发明内容
本申请实施例公开了一种投屏方法、装置、终端设备及计算机可读存储介质。
本申请实施例公开了一种投屏方法,应用于第一终端设备,所述方法包括:
获取第二终端设备对应的投屏参数,所述投屏参数包括所述第二终端设备的投屏窗口对应的第一分辨率及所述第二终端设备对应的编解码能力;
根据所述投屏参数确定与所述第一分辨率等比例的目标分辨率;
向所述第二终端设备发送与所述目标分辨率匹配的视频流数据,所述视频流数据用于在所述第二终端设备的所述投屏窗口中播放投屏画面。
本申请实施例公开了一种投屏方法,应用于第二终端设备,所述方法包括:
接收第一终端设备发送的与目标分辨率匹配的视频流数据,所述目标分辨率是所述第一终端设备根据所述第二终端设备对应的投屏参数确定的;所述投屏参数包括所述第二终端设备的投屏窗口对应的第一分辨率及所述第二终端设备对应的编解码能力,所述目标分辨率与所述第一分辨率等比例;
根据所述视频流数据,在所述投屏窗口中播放投屏画面。
本申请实施例公开了一种投屏装置,应用于第一终端设备,所述装置包括:
参数获取模块,用于获取第二终端设备对应的投屏参数,所述投屏参数包括所述第二终端设备的投屏窗口对应的第一分辨率及编解码能力;
分辨率确定模块,用于根据所述投屏参数确定与所述第一分辨率等比例的目标分辨率;
数据发送模块,用于向所述第二终端设备发送与所述目标分辨率匹配的视频流数据,所述视频流数据用于在所述第二终端设备的所述投屏窗口中播放投屏画面。
本申请实施例公开了一种投屏装置,应用于第二终端设备,所述装置包括:
数据接收模块,用于接收第一终端设备发送的与目标分辨率匹配的视频流数据,所述目标分辨率是所述第一终端设备根据所述第二终端设备对应的投屏参数确定的;所述投屏参数包括所述第二终端设备的投屏窗口对应的第一分辨率及编解码能力,所述目标分辨率与所述第一分辨率等比例;
播放模块,用于根据所述视频流数据,在所述投屏窗口中播放投屏画面。
本申请实施例公开了一种终端设备,包括存储器及处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器实现如上任一所述的方法。
本申请实施例公开了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上任一所述的方法。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和有益效果将从说明书、附图以及权利要求书中体现。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1A为相关技术中投屏画面的显示示意图;
图1B为一个实施例中投屏方法的应用场景图;
图2为一个实施例中投屏方法的流程图;
图3为另一个实施例中投屏方法的流程图;
图4为一个实施例中确定目标分辨率的示意图;
图5为又一个实施例中投屏方法的流程图;
图6为一个实施例中多个投屏窗口进行后台投屏的示意图;
图7为一个实施例中投屏方法的时序示意图;
图8为再一个实施例中投屏方法的流程图;
图9为一个实施例中投屏装置的框图;
图10为另一个实施例中投屏装置的框图;
图11为一个实施例中终端设备的结构框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
需要说明的是,本申请实施例及附图中的术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一耳机称为第二耳机,且类似地,可将第二耳机称为第一耳机。第一耳机和第二耳机两者属于耳机,但其不是同一只耳机。另外,需要说明的是,本申请实施例中所使用的术语“多个”等指的是两个或两个以上。
在目前的投屏技术中,源端设备都是直接抓取在屏幕上显示的图像画面,然后直接发送给对端设备进行投屏显示,对端设备显示的投屏画面的分辨率都是以源端设备抓取的图像画面的分辨率为基础,因此容易出现黑边或者是画面拉伸扭曲的问题,影响投屏效果。例如,如图1A所示,源端设备为手机,对端设备为电脑,在进行手机向电脑的投屏时,由于手机的分辨率与电脑的分辨率不同,直接以手机的分辨率显示投屏画面时,会导致投屏到电脑的投屏画面在进行显示时会出现黑边的问题。
本申请实施例提供了一种投屏方法、装置、终端设备及计算机可读存储介质,能够保证投屏画面在投屏窗口中播放时不会出现黑边或者是画面拉伸扭曲的问题,提高了投屏效果。
图1B为一个实施例中投屏方法的应用场景图。如图1B所示,第一终端设备110及第二终端设备120可建立通信连接,第一终端设备110可作为投屏场景中的源端设备,第二终端设备120可作为投屏场景中的对端设备,其中,源端设备能够将多媒体数据传输到对端设备,以在对端设备中进行投屏。第一终端设备110与第二终端设备120可包括但不限于手机、可穿戴设备、PC(Personal Computer,个人计算机)、平板电脑、笔记本电脑及车载终端等。第一终端设备110与第二终端设备120之间的通信连接可包括蓝牙、Wi-Fi等无线通信连接,也可包括通过USB(Universal Serial Bus,通用串行总线)端口实现的有线通信连接等,本申请实施例对此不作限制。
第一终端设备110可获取第二终端设备120对应的投屏参数,该投屏参数可包括第二终端设备120的投屏窗口对应的第一分辨率及第二终端设备120的编解码能力。第一终端设备110可根据第二终端设备120对应的投屏参数,确定与该第一分辨率等比例的目标分辨率,并向第二终端设备120发送与目标分辨率匹配的视频流数据。第二终端设备120接收第一终端设备110发送的与目标分辨率匹配的视频流数据,可根据该视频流数据,在投屏窗口中播放投屏画面。由于视频流数据的分辨率为目标分辨率,与投屏窗口的第一分辨率等比例,因此,投屏窗口在显示投屏画面时,不会出现黑边或者是画面拉伸扭曲的问题,提高了投屏效果。
需要说明的是,本申请实施例提供的投屏方法也可应用在一个第一终端设备110投屏到多个第二终端设备120的投屏场景,或者是多个第一终端设备110投屏到一个第二终端设备120的投屏场景,终端设备既可以作为上述的第一终端设备(即源端设备),也可作为第二终端设备(即对端设备),本申请实施例对具体的投屏场景不作限定。
如图2所示,在一个实施例中,提供一种投屏方法,可应用于上述的第一终端设备,该方法可包括以下步骤:
步骤210,获取第二终端设备对应的投屏参数,投屏参数包括第二终端设备的投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力。
第一终端设备与第二终端设备可先建立通信连接,该通信连接可包括但不限于无线通信连接或有线通信连接。可选地,可在通信连接的基础上建立第一终端设备与第二终端设备之间的投屏链路,该投屏链路可用于传输投屏过程中的多媒体数据及与投屏相关的参数等信息,其中,多媒体数据可包括视频流数据及音频流数据等,投屏相关的参数可包括视频流数据对应的分辨率信息、音频流数据对应的音量、声道等中的一种或多种。
在一些实施例中,用户可在第一终端设备或第二终端设备发起建立投屏链路的请求,在第一终端设备与第二终端设备建立通信连接之后,可在第一终端设备和/或第二终端设备上显示投屏控件。用户可触发该投屏控件,例如,用户触发第一终端设备上显示的投屏控件,则第一终端设备响应针对该投屏控件的触发操作,并向第二终端设备发送请求建立投屏链路的建立请求,第二终端设备可响应该建立请求,与第一终端设备建立投屏链路;又例如,用户触发第二终端设备上显示的投屏控件,则第二终端设备响应针对该投屏控件的触发操作,并向第一终端设备发送请求建立投屏链路的建立请求,第一终端设备可响应该建立请求,与第二终端设备建立投屏链路。
进一步地,用户在触发该投屏控件时,可选择第一终端设备与第二终端设备的投屏关系,如选择第一终端设备向第二终端设备进行投屏的投屏关系等。可选地,第一终端设备与第二终端设备之间的投屏关系也可以是默认设置的,如可按照设备类型默认设置成电脑向电视进行投屏的投屏关系,手机向电脑进行投屏的投屏关系等,但不限于此。用户可在任一终端设备发起投屏链路的建立,且可根据实际需求确定投屏关系,满足了用户的不同需求。
在第一终端设备与第二终端设备之间建立投屏链路之后,第一终端设备可获取第二终端设备对应的投屏参数,该投屏参数可包括第二终端设备的投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力。其中,第二终端设备可设置有投屏窗口,该投屏窗口用于显示第一终端设备的投屏画面,可选地,该投屏窗口可以是全屏窗口,则第一终端设备通过该投屏窗口可全屏播放投屏画面,该投屏窗口也可以是自定义大小的窗口,例如,占屏幕二分之一的窗口,或是占屏幕四分之三的窗口。投屏窗口对应的第一分辨率可指的是投屏窗口中可显示的像素个数,可采用水平像素数*垂直像素数进行表示。第二终端设备对应的编解码能力可包括但不限于第二终端设备支持编解码的视频格式、支持编解码的最大视频宽高参数、帧率、码率等中的一种或多种参数。
步骤220,根据投屏参数确定与第一分辨率等比例的目标分辨率。
第一终端设备可根据第二终端设备对应的投屏参数,确定与第一分辨率等比例的目标分辨率。作为一种实施方式,第二终端设备对应的编解码能力会对第二终端设备所支持编解码的最大分辨率产生影响,因此,可根据第二终端设备对应的编解码能力确定第二终端设备所支持编解码的分辨率范围,并在该分辨范围内确定与第一分辨率等比例的目标分辨率。其中,目标分辨率与第一分辨率等比例,目标分辨率的水平像素数与垂直像素数的比值,与第一分辨率的水平像素数与垂直像素数的比值相同,例如,第一分辨率为1000*2000,目标分辨率为500*1000。目标分辨率可小于第一分辨率,也可大于或等于第一分辨率,在此不作限定。由于是在第二终端设备所支持编解码的分辨率范围确定目标分辨率,从而可保证第一终端设备向第二终端设备传输的视频流数据能够被正常编解码。
步骤230,向第二终端设备发送与目标分辨率匹配的视频流数据,视频流数据用于在第二终端设备的投屏窗口中播放投屏画面。
第一终端设备确定目标分辨率后,可生成与该目标分辨率匹配的视频流数据,即该视频流数据的分辨率为该目标分辨率,并将生成的视频流数据传输给第二终端设备。第二终端设备接收到第一终端设备发送的视频流数据后,可根据该视频流数据在设置的投屏窗口中播放投屏画面。由于视频流数据的分辨率为目标分辨率,与投屏窗口对应的第一分辨率等比例,投屏画面可填充满投屏窗口进行显示,且不会产生黑边或是画面拉伸扭曲的问题。例如,投屏窗口为全屏窗口,则第二终端设备可将投屏画面进行全屏显示,不会产生黑边或是画面拉伸扭曲的问题。
进一步地,若目标分辨率与第一分辨率相同,则第二终端设备可直接对视频流数据进行解码,以生成投屏画面,并在投屏窗口中显示;若目标分辨率与第一分辨率不同,由于目标分辨率与投屏窗口对应的第一分辨率等比例,则可对视频流数据进行解码后再进行缩放处理,得到具备第一分辨率的投屏画面,并在投屏窗口中显示。例如,第一分辨率为1000*2000,目标分辨率为500*1000,则在对视频流数据进 行解码后,将解码数据放大2倍,得到具备第一分辨率的投屏画面,由于是等比例的缩放,不会造成投屏画面出现拉伸扭曲的情况,且缩放后得到的投屏画面与投屏窗口的分辨率一致,能够填充满投屏窗口进行显示,不会在投屏窗口中出现黑边。
在本申请实施例中,第一终端设备(即投屏中的源端设备)能够根据第二终端设备(即投屏中的对端设备)的投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力对传输的视频流数据的分辨率进行自适应调整,既能够保证第二终端设备对视频流数据进行正常解码,又可保证投屏画面在投屏窗口中播放时不会出现黑边或者是画面拉伸扭曲的问题,提高了投屏效果。
如图3所示,在另一个实施例中,提供一种投屏方法,可应用于上述的第一终端设备,该方法可包括以下步骤:
步骤302,获取第二终端设备对应的投屏参数,投屏参数包括第二终端设备的投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力。
在第一终端设备与第二终端设备建立投屏链路之后,第一终端设备可获取第二终端设备对应的投屏参数,获取第二终端设备对应的投屏参数的方式可包括但不限于以下几种方式中的任一种:
方式一、第一终端设备接收第二终端设备发送的投屏参数。在第一终端设备与第二终端设备建立投屏链路之后,第二终端设备可直接将投屏参数发送给第一终端设备。可选地,第二终端设备可同时向第一终端设备发送投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力,也可分别进行发送。例如,第二终端设备可先向第一终端设备发送第二终端设备对应的编解码能力,第二终端设备可根据实际的投屏需求设置投屏窗口,并在确定投屏窗口对应的第一分辨率后,再将投屏窗口对应的第一分辨率发送给第二终端设备。
方式二、第一终端设备接收第二终端设备发送的设备信息,查询与设备信息对应的投屏参数。在第一终端设备与第二终端设备建立投屏链路之后,第二终端设备可向第一终端设备发送设备信息,该设备信息可包括但不限于第二终端设备的设备标识、设备型号、出厂批次、厂商信息等中的一种或多种。
作为一种实施方式,第一终端设备中可存储有白名单,该白名单可包括能够进行投屏的各个终端设备的设备信息及对应的投屏参数,在第一终端设备接收到第二终端设备发送的设备信息后,可在白名单中查找与第二终端设备的设备信息对应的投屏参数。作为另一种实施方式,第一终端设备可将第二终端设备发送的设备信息上传到服务器,通过服务器查找与第二终端设备的设备信息对应的投屏参数,并接收服务器返回的第二终端设备对应的投屏参数。
可选地,由于第二终端设备中的投屏窗口对应的第一分辨率可以是根据实际需求进行设置的,而非固定的,因此,第一终端设备可仅根据终端设备的设备信息查找到对应的编解码能力,在第二终端设备根据实际的投屏需求设置投屏窗口,确定投屏窗口对应的第一分辨率后,再将投屏窗口对应的第一分辨率发送给第二终端设备。
或者,第一终端设备可根据终端设备的设备信息查找到对应的编解码能力,以及全屏窗口对应的第一分辨率,该全屏窗口对应的第一分辨率可理解为第一终端设备的屏幕显示分辨率。若第一终端设备在向第二终端设备发送视频流数据之前未重新接收到第二终端设备发送的投屏窗口对应的第一分辨率,说明第二终端设备未重新设置新的投屏窗口,则可直接将该全屏窗口确定为第二终端设备的投屏窗口,并确定与该全屏窗口对应的第一分辨率等比例的目标分辨率。
在一些实施例中,第一终端设备与第二终端设备之间建立的投屏链路可包括第一传输通道及第二传输通道,该第一传输通道可为双向传输通道,即通过第一传输通道,第一终端设备与第二终端设备之间可以互相传输数据;该第二传输通道可为单向传输通道,第二终端设备仅可通过该第二传输通道接收第一终端设备发送的数据,而不能通过该第二传输通道向第一终端设备发送数据。
第一终端设备可通过与第二终端设备之间建立的第一传输通道,接收第二终端设备发送的投屏参数。该第一传输通道可用于第一终端设备与第二终端设备之间各项参数的传输,比如,可用于编解码能力协商,第一终端设备与第二终端设备,可通过该第一传输通道互相发送各自的编解码能力;或者,第二终端设备通过该第一传输通道向第一终端设备发送投屏窗口的第一分辨率,第一终端设备通过该第二传输通道向第二终端设备发送视频流数据的分辨率信息(即目标分辨率)等。
第一终端设备可通过与第二终端设备之间建立的第二传输通道,向第二终端设备发送与目标分辨率匹配的视频流数据。第二传输通道可用于传输多媒体数据(包括视频流数据及音频流数据等)。
作为一种具体实施方式,第一终端设备与第二终端设备之间的投屏链路可包括P2P(Peer to Peer,对等网络)传输通道,该P2P传输通道可包括RTSP(Real Time Streaming Protocol,实时流传输协议)socket通道和RTP(Real-time Transport Protocol,实时传输协议)socket通道,其中,RTSP socket通道 (即上述的第一传输通道)可作为各项参数的传输通道,RTP socket通道(即上述的第二传输通道)可作为多媒体数据的传输通道。通过将RTCP socket通道和RTP socket通道配合使用,能够以有效的反馈和最小的开销使传输效率最佳化,提高投屏过程中的数据传输效率。
在本申请实施例中,第一终端设备能够准确获取到第二终端设备对应的投屏参数,保证后续发送的视频流数据的分辨率能够匹配第二终端设备对应的编解码能力及投屏窗口的第一分辨率,提高投屏的准确性。
步骤304,根据第二终端设备对应的编解码能力,以及第一终端设备对应的编解码能力确定编解码参数。
第一终端设备可与第二终端设备进行编解码能力协商,确定能够被第一终端设备及第二终端设备同时支持的编解码参数,该编解码参数可包括但不限于视频格式、视频宽高参数、帧率、码率等中的一种或多种,其中,帧率指的是在单位时间(如1秒等)内传输的图像帧数,码率指的是单位时间内传输的数据位数,第一终端设备及第二终端设备可基于该编解码参数进行投屏过程中的编解码处理及数据传输。
在一些实施例中,第一终端设备可将自身的编解码能力,与第二终端设备对应的编解码能力进行比较,并根据比较结果确定编解码参数,以保证确定的编解码参数能够同时被第一终端设备及第二终端设备支持。可选择第一终端设备的编解码能力与第二终端设备对应的编解码能力的交集范围,并从交集范围中确定编解码参数。以帧率为例,可将第一终端设备支持的帧率范围与第二终端设备支持的帧率范围进行比较,取两个帧率范围的交集范围,并从该交集范围中选择最终投屏过程中的目标帧率。进一步地,可从第一终端设备的编解码能力与第二终端设备对应的编解码能力的交集范围中,确定最大参数值为编解码参数。例如,可从两个帧率范围的交集范围中,选择最大帧率作为目标帧率。通过在第一终端设备的编解码能力与第二终端设备对应的编解码能力的交集范围中,确定最大参数值为编解码参数,既能够保证投屏过程中正常进行数据传输及编解码处理,而且可以尽可能地提高数据传输及编解码处理的性能及效率。
作为一种具体实施方式,第一终端设备可将第一终端设备支持的第一最大视频宽高参数,与第二终端设备支持的第二最大视频宽高参数进行比较,并选择较小的最大视频宽高参数作为目标视频宽高参数,该目标视频宽高参数即为第一终端设备与第二终端设备均能够支持进行编解码的最大视频宽高参数。例如,第一终端设备支持的第一最大视频宽高参数为320*210,第二终端设备支持的第二最大视频宽高参数为280*160,则目标视频宽高参数可为280*160。可在该目标视频宽高参数对应的分辨率范围内,确定与第二终端设备中的投屏窗口对应的第一分辨率等比例的目标分辨率,从而可保证第一终端设备与第二终端设备均能够正常进行编解码。
步骤306,根据编解码参数及第二终端设备的投屏窗口对应的第一分辨率,确定与第一分辨率等比例的目标分辨率。
第一终端设备在确定目标视频宽高参数后,作为一种实施方式,可在目标视频宽高参数对应的分辨率范围内,确定与投屏窗口对应的第一分辨率等比例的最大分辨率,并将最大分辨率作为目标分辨率。示例性地,图4为一个实施例中确定目标分辨率的示意图。如图4所示,第一终端设备支持的第一最大视频宽高参数为320*210,第二终端设备支持的第二最大视频宽高参数为280*160,其中较小的最大视频宽高参数为280*160,则可确定目标视频宽高参数为280*160,其对应的分辨率范围可为小于或等于280*160,第二终端设备的投屏窗口对应的第一分辨率为100*100,则可从小于或等于280*160这一分辨率范围内,选择与100*100等比例的最大分辨率为160*160,则可确定目标分辨率为160*160。在目标视频宽高参数对应的分辨率范围内,将与第一分辨率等比例的最大分辨率作为目标分辨率,能够在保证两个终端设备均可进行正常编解码处理的情况下,选择投屏画面以最优画质进行显示,进一步提高了投屏画面的显示效果。
作为另一种实施方式,可在目标视频宽高参数对应的分辨率范围内,根据网络传输参数和/或第二终端设备的性能参数确定与第一分辨率等比例的目标分辨率。
网络传输参数可用于表征第一终端设备与第二终端设备之间的网络情况,网络传输参数可包括但不限于传输速率、传输延迟、传输丢包率等中的一种或多种。在仅根据网络传输参数确定目标分辨率的情况下,网络传输参数所表征的网络情况越良好,则确定的目标分辨率可越大,在网络传输参数表征网络情况较差的情况下,可确定较小的目标分辨率,从而可提高视频流传输的流畅性及准确性,避免出现丢包重传或是卡顿的情况。
第二终端设备的性能参数可用于表征第二终端设备处理数据的性能,性能参数可包括但不限于第二 终端设备的内存参数、CPU(central processing unit,中央处理器)参数、GPU(graphics processing unit,图形处理器)参数、发热参数等中的一种或多种。在仅根据第二终端设备的性能参数确定目标分辨率的情况下,性能参数所表征的性能越好,则确定的目标分辨率可越大,在该性能参数表征第二终端设备的性能较差的情况下,可确定较小的目标分辨率,从而可减轻第二终端设备的处理负担,保证投屏画面能够正常、流畅地进行显示。
可选地,可同时根据网络传输参数和第二终端设备的性能参数确定目标分辨率,可针对网络传输参数及第二终端设备的性能参数分配不同的权重值,并根据网络传输参数及第二终端设备的性能参数分别对应的权重值进行加权和计算,以确定最终的影响参数,再根据该影响参数确定目标分辨率。例如,若是影响参数越大,表示网络情况越良好且第二终端设备的性能越好,则目标分辨率可为目标视频宽高参数对应的分辨率范围内,与投屏窗口对应的第一分辨率等比例的最大分辨率与该影响参数的乘积等。可综合网络传输情况以及第二终端设备的性能,选择合适的目标分辨率,提高了视频流数据传输的准确性,进一步提高了投屏画面的显示效果,避免出现卡顿等情况。
需要说明的是,确定目标分辨率的方式并不仅限于上述的几种方式,也可采用其它方式,例如,可在目标视频宽高参数对应的分辨率范围内,确定与投屏窗口对应的第一分辨率等比例的各个分辨率,并从中随机选择一个分辨率作为目标分辨率等。
步骤308,向第二终端设备发送与目标分辨率匹配的视频流数据,视频流数据用于在第二终端设备的投屏窗口中播放投屏画面。
步骤308的描述可参考上述实施例中步骤230的相关描述,在此不再重复赘述。
在本申请实施例中,第一终端设备可结合自身的编解码能力及第二终端设备对应的编解码能力,确定二者均能够支持的分辨率范围,并在该分辨率范围中确定与第二终端设备的投屏窗口对应的第一分辨率等比例的目标分辨率,保证第一终端设备及第二终端设备在投屏过程中均能够正常进行编解码处理,且可保证投屏画面在投屏窗口中播放时不会出现黑边或者是画面拉伸扭曲的问题,提高了投屏效果。
如图5所示,在另一个实施例中,提供一种投屏方法,可应用于上述的第一终端设备,该方法可包括以下步骤:
步骤502,获取第二终端设备对应的投屏参数,投屏参数包括第二终端设备的投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力。
步骤504,根据第二终端设备对应的编解码能力,以及第一终端设备对应的编解码能力确定编解码参数。
步骤506,根据编解码参数及第二终端设备的投屏窗口对应的第一分辨率,确定与第一分辨率等比例的目标分辨率。
步骤502~506的描述可参考上述各实施例中的相关描述,在此不再重复赘述。
步骤508,按照目标分辨率创建虚拟屏幕。
在本申请实施例中,第一终端设备与第二终端设备之间的投屏可为后台投屏,后台投屏指的是第一终端设备中投屏的目标应用程序可在后台运行,并将相应的界面内容投屏到第二终端设备,而不需要占用第一终端设备的显示屏。在一些实施例中,第一终端设备与第二终端设备建立投屏链路之后,第二终端设备可向第一终端设备发送后台投屏请求,该后台投屏请求可携带有投屏窗口对应的第一分辨率。第二终端设备接收到该第一终端设备发送的后台投屏请求后,可根据之前获取的第二终端设备对应的编解码能力、自身的编解码能力及该投屏窗口对应的第一分辨率,确定与该第一分辨率等比例的目标分辨率。
第一终端设备可按照确定的目标分辨率创建虚拟屏幕,虚拟屏幕区别于物理屏幕,在虚拟屏幕上显示的界面用户不可见,可理解为虚拟屏幕是在系统后台进行显示。可通过调用系统提供的虚拟屏创建接口,在该虚拟屏创建接口中写入目标分辨率,从而创建分辨率为目标分辨率的虚拟屏幕,在该虚拟屏幕中显示的界面内容的分辨率即为目标分辨率。
步骤510,将目标应用程序的界面内容输出到虚拟屏幕。
目标应用程序指的是需要向第二终端设备进行投屏的应用程序,可选地,用户可在第一终端设备或第二终端设备选择需要投屏的目标应用程序。例如,用户在第一终端设备上选择需要投屏的目标应用程序,第一终端设备可显示包含当前运行的各个应用程序的应用列表,用户可在该应用列表中选择目标应用程序,第一终端设备可响应用户针对应用列表进行的选择操作,确定用户选择的目标应用程序;第一终端设备上运行的各个应用程序的界面中也可设置有投屏控件,用户可通过触发该投屏控件让应用程序进行投屏,若第一终端设备上运行的任一应用程序检测到针对投屏控件的触发操作,则可将该应用程序确定为目标应用程序。
又例如,用户在第二终端设备上选择需要投屏的目标应用程序,第一终端设备可向第二终端设备发送应用列表,该应用列表中可包括有第一终端设备当前运行的各个应用程序,用户可在该应用列表中选择目标应用程序,第二终端设备可响应用户针对应用列表进行的选择操作,确定用户选择的目标应用程序,并将目标应用程序的应用信息发送给第一终端设备,该应用信息可包括但不限于目标应用程序的应用名称、包名等应用标识。第一终端设备根据第二终端设备发送的应用信息确定需要投屏的目标应用程序。用户可在第一终端设备或第二终端设备选择需要投屏的目标应用程序,选择方式更为灵活,满足了用户的不同需求。
第一终端设备可将目标应用程序的界面内容输出到虚拟屏幕进行显示,而不在物理屏幕上进行显示。由于虚拟屏幕的分辨率为目标分辨率,因此,可将目标应用程序的界面内容按照该目标分辨率输出到虚拟屏幕,使得在虚拟屏幕显示的目标应用程序的界面内容的分辨率为该目标分辨率。可选地,若目标应用程序在前台运行,则可将目标应用程序切换至后台运行,并将目标应用程序的界面内容输出到虚拟屏幕,可避免投屏的目标应用程序占用物理屏幕,影响投屏过程中用户正常使用其它应用程序的情况,提高用户体验。
步骤512,从虚拟屏幕中抓取目标应用程序的界面内容作为投屏数据,根据投屏数据生成与目标分辨率匹配的视频流数据,并向第二终端设备发送视频流数据,视频流数据用于在第二终端设备的投屏窗口中播放投屏画面。
在一些实施例中,第一终端设备可每隔第一时长从虚拟屏幕中抓取目标应用程序的界面内容作为投屏数据,该第一时长可根据帧率(帧率可以是根据第二终端设备对应的编解码能力及第一终端设备对应的编解码能力确定的)进行确定,第一时长可为单位时间与该帧率的比值。
在一些实施例中,第一终端设备也可对虚拟屏幕中显示的界面内容进行识别,并抓取该界面内容的关键帧作为投屏数据。可选地,该关键帧可以是跟前一帧界面内容的内容差异大于差异阈值的界面内容,可将每一帧的界面内容与前一帧界面内容进行比对,确定与前一帧界面内容的内容差异,该内容差异可用存在区别的像素数量进行表示,或是该内容差异可用与前一帧界面内容的内容位移等进行表示,在本申请实施例中不作限定。可判断当前帧界面内容与前一帧界面内容的内容差异是否大于差异阈值,若大于,则可将当前帧界面内容确定为关键帧,并抓取当前帧界面内容作为投屏数据。通过抓取目标应用程序的关键帧界面内容进行投屏,既可提高投屏的流畅性,可又提高投屏的准确性,进一步提高了投屏效果。
作为一种实施方式,第一终端设备在确定目标分辨率之后,可按照该目标分辨率创建编码器,该编码器可用于对具备目标分辨率的视频数据进行编码。第一终端设备还可向第二终端设备发送该目标分辨率,以使第二终端设备按照该目标分辨率创建解码器,该解码器可用于对具备目标分辨率的视频数据进行解码。进一步地,该第一终端设备可通过上述的第一传输通道向第二终端设备发送该目标分辨率。
第一终端设备从虚拟屏幕中抓取目标应用程序的界面内容作为投屏数据后,可通过该编码器对投屏数据进行编码,以得到与目标分辨率匹配的视频流数据,再将该与目标分辨率匹配的视频流数据发送给第二终端设备。第二终端设备接收到与目标分辨率匹配的视频流数据后,可通过解码器对该视频流数据进行解码,得到投屏数据,并根据第一分辨率及目标分辨率对投屏数据进行缩放处理,以在第二终端设备的投屏窗口中播放投屏画面。
若第一分辨率小于目标分辨率,则第二终端设备可根据第一分辨率与目标分辨率的比值,对投屏数据进行缩小处理,以在第二终端设备的投屏窗口中播放分辨率为第一分辨率的投屏画面。例如,第一分辨率为1000*2000,目标分辨为1500*3000,则第一分辨率与目标分辨率的比值为1:1.5,则可将投屏数据缩小1/3。同理,若第一分辨率大于目标分辨率,则第二终端设备可根据第一分辨率与目标分辨率的比值,对投屏数据进行放大处理,以在第二终端设备的投屏窗口中播放分辨率为第一分辨率的投屏画面。例如,第一分辨率为1000*2000,目标分辨为500*1000,第一分辨率与目标分辨率的比值为2:1,则可将投屏数据放大2倍。第二终端设备通过简单的缩放处理即可得到分辨率为第一分辨率的投屏画面,可保证投屏窗口中显示的投屏画面不会出现黑边或是画面扭曲拉伸的情况。
在一些实施例中,第二终端设备中可设置有多个投屏窗口用于播放投屏画面,各个投屏窗口对应的第一分辨率可相同,也可不同。第二终端设备向第一终端设备发送的后台投屏请求可携带有各个投屏窗口对应的第一分辨率,第一终端设备在接收到该后台投屏请求后,可根据第二终端设备对应的编解码能力,以及各个投屏窗口对应的第一分辨率,分别确定与各个第一分辨率等比例的目标分辨率。需要说明的是,针对每个投屏窗口,确定与该投屏窗口对应的第一分辨率等比例的目标分辨率的确定方式,可参考上面各实施例中的相关描述,在此不再重复进行赘述。
第一终端设备在确定与各个投屏窗口对应的第一分辨率等比例的目标分辨率后,可按照与各个第一分辨率等比例的目标分辨率,分别创建与各个投屏窗口对应的虚拟屏幕。第一终端设备创建的虚拟屏幕的数量与第二终端设备设置的投屏窗口数量一致,且一一对应。用户可根据实际需求选择各个投屏窗口对应的目标应用程序,各个投屏窗口可用于播放对应的目标应用程序的投屏画面。第一终端设备可将各个投屏窗口对应的目标应用程序的界面内容分别输出到各个投屏窗口对应的虚拟屏幕,以生成与各个投屏窗口对应的视频流数据。
作为一种具体实施方式,以第一投屏窗口为例,该第一投屏窗口可以是第二终端设备中设置的多个投屏窗口中的任一投屏窗口,第一终端设备可确定与第一投屏窗口对应的第一分辨率等比例的第一目标分辨率,并按照该第一目标分辨率创建第一虚拟屏幕,还可按照该第一目标分辨率创建第一编码器,第二终端设备可按照该第一目标分辨率创建第一解码器。第一终端设备可将第一投屏窗口对应的第一目标应用程序的界面内容输出到第一虚拟屏幕,并从第一虚拟屏幕中抓取第一目标应用程序的界面内容作为第一投屏窗口对应的投屏数据,通过该第一编码器对第一投屏窗口对应的投屏数据进行编码,以得到与第一目标分辨率匹配的视频流数据。第二终端设备在接收到该与第一目标分辨率匹配的视频流数据后,可通过第一解码器对该视频流数据进行解码,得到第一投屏窗口对应的投屏数据,并根据第一投屏窗口对应的第一分辨率及第一目标分辨率对该投屏数据进行缩放处理,以在第一投屏窗口中播放投屏画面。第一终端设备生成每个投屏窗口对应的视频流数据,并在第二终端设备中对应的投屏窗口中播放投屏画面的方式与上述实施例中描述的方式类似。
示例性地,图6为一个实施例中多个投屏窗口进行后台投屏的示意图。如图6所示,第二终端设备可设置有3个不同的投屏窗口:投屏窗口1、投屏窗口2及投屏窗口3,第一终端设备可分别创建对应的3个虚拟屏幕:虚拟屏幕1、虚拟屏幕2及虚拟屏幕3,其中,虚拟屏幕1的分辨率与投屏窗口1的分辨率等比例,虚拟屏幕2的分辨率与投屏窗口2的分辨率等比例,虚拟屏幕3的分辨率与投屏窗口3的分辨率等比例。第一终端设备可将应用程序A的界面内容输出到虚拟屏幕1,并通过抓取虚拟屏幕1中显示的应用程序A的界面内容,生成投屏窗口1对应的视频流数据发送给第二终端设备,以在第二终端设备的投屏窗口1中播放应用程序A对应的投屏画面,同理,投屏窗口2可播放应用程序B对应的投屏画面,投屏窗口3可播放应用程序C对应的投屏画面。在本申请实施例中,可实现在第二终端设备中设置多个投屏窗口分别播放不同的投屏画面,且可保证各个投屏窗口中均不会出现黑边或是画面拉伸扭曲的情况,提高了投屏效果且满足了用户的不同需求。
在本申请实施例中,第一终端设备可实现在后台对第二终端设备进行投屏,可避免投屏影响到用户正常使用第一终端设备的情况,而且能够保证第一终端设备及第二终端设备均可在投屏过程中进行正常的编解码处理,投屏画面在投屏窗口中播放时不会出现黑边或者是画面拉伸扭曲的问题,提高了投屏效果。
在一些实施例中,第一终端设备与第二终端设备建立投屏链路之后,在第二终端设备向第一终端设备发送投屏窗口对应的第一分辨率之前,第一终端设备可按照自身的分辨率在第二终端设备中进行投屏。第一终端设备可根据第二终端设备对应的编解码能力、第一终端设备对应的编解码能力及第一终端设备对应的第二分辨率,确定与该第二分辨率等比例的初始分辨率。
其中,第一终端设备对应的第二分辨率可以是第一终端设备全屏显示时的分辨率,也即第一终端设备的物理屏幕的分辨率,可选地,该第二分辨率也可以是第一终端设备中需要投屏的目标应用程序在物理屏幕上的显示分辨率。第一终端设备与第二终端设备之间可进行编解码能力协商,可根据第二终端设备对应的编解码能力,以及第一终端设备对应的编解码能力确定编解码参数,并根据该编解码参数及第一终端设备对应的第二分辨率,确定与该第二分辨率等比例的初始分辨率。
作为一种具体实施方式,可将第一终端设备支持的第一最大视频宽高参数,与第二终端设备支持的第二最大视频宽高参数进行比较,并选择较小的最大视频宽高参数作为目标视频宽高参数,并在目标视频宽高参数对应的分辨率范围内,确定与第二分辨率等比例的初始分辨率。例如,第二分辨率为300*200,目标视频宽高参数为280*160,则可在280*160的范围内确定与300*200等比例的初始分辨率,如240*160等。
需要说明的是,确定初始分辨率的方式可与上述实施例中描述的确定目标分辨率的方式类似,只是初始分辨率是与第二分辨等比例,而目标分辨率是与第一分辨率等比例,本申请实施例不再对确定初始分辨率的方式进行赘述,可参考上述各实施例中确定第一分辨率的相关描述。
第一终端设备可向第二终端设备发送与初始分辨率匹配的视频流数据,在第一终端设备接收到第二终端设备发送的投屏窗口对应的第一分辨率后,可确定与第一分辨率等比例的目标分辨率,再向第二终 端设备发送与目标分辨率匹配的视频流数据。若第一终端设备接收到第二终端设备发送的第一结束请求,该第一结束请求可用于表征结束在该投屏窗口进行投屏,则第一终端设备可根据该第一结束请求向第二终端设备发送与初始分辨率匹配的视频流数据。也即,在第二终端设备结束在投屏窗口进行投屏之后,第一终端设备可恢复到基于初始分辨率在第二终端设备中进行投屏的方式。进一步地,该第一结束请求可包括结束后台投屏请求,用于请求结束后台投屏,则目标应用程序可恢复到前台投屏的方式,基于初始分辨率在第二终端设备中进行投屏。
示例性地,图7为一个实施例中投屏方法的时序示意图。如图7所示,该投屏方法可包括以下步骤:
步骤1、第二终端设备可向第一终端设备请求建立投屏链路,第一终端设备与第二终端设备成功建立投屏链路。
步骤2、第一终端设备与第二终端设备协商编解码能力及分辨率等。
第二终端设备可向第一终端设备发送自身的编解码能力,第一终端设备根据第二终端设备的编解码能力、第一终端设备的编解码能力确定编解码参数,并根据该编解码参数及第一终端设备对应的第二分辨率,确定与第二分辨率等比例的初始分辨率。
第一终端设备可按照该初始分辨率创建编码器,并抓取投屏数据,第一终端设备还可向第二终端设备发送该初始分辨率,第二终端设备按照该初始分辨率创建解码器。
步骤3、第一终端设备向第二终端设备推送音视频流,其中,视频流数据的分辨率为初始分辨率。
第一终端设备可通过分辨率为初始分辨率的编码器对抓取的投屏数据进行编码,以得到与初始分辨率匹配的视频流数据,并向第二终端设备推送音频流数据与该视频流数据。第二终端设备可通过分辨率为初始分辨率的解码器对接收的视频流数据进行解码,并播放相应的投屏画面。
步骤4、第二终端设备向第一终端设备请求后台投屏,该请求中可携带投屏窗口对应的第一分辨率。
步骤5、第一终端设备根据协商的编解码能力,确定与第一分辨率等比例的目标分辨率。
第一终端设备可根据步骤2确定的编解码参数及第一分辨率,确定与第一分辨率等比例的目标分辨率。
步骤6、第一终端设备按照目标分辨率创建虚拟屏及编码器。
步骤7、第一终端设备接取目标应用程序到虚拟屏,将目标应用程序的界面内容输出到虚拟屏,并从虚拟屏抓取投屏数据。
步骤8、第一终端设备向第二终端设备发送目标分辨率。
步骤9、第二终端设备按照目标分辨率创建解码器。
步骤10、第一终端设备向第二终端设备推送音视频流,其中,视频流数据的分辨率为目标分辨率。
第一终端设备可通过分辨率为目标分辨率的编码器对从虚拟屏中抓取的投屏数据进行编码,以得到与目标分辨率匹配的视频流数据,并向第二终端设备推送音频流数据与该视频流数据。
步骤11、第二终端设备对与目标分辨率匹配的视频流数据进行缩放处理,在投屏窗口中播放无黑边且无拉伸扭曲的投屏画面。
第二终端设备可通过分辨率为目标分辨率的解码器对接收的视频流数据进行解码,得到投屏数据,并对投屏数据进行缩放处理。
步骤12、第二终端设备向第一终端设备请求结束后台投屏。
步骤13、第一终端设备拉取目标应用程序到物理屏,将目标应用程序的界面内容输出到物理屏。
步骤14、第一终端设备按照目标分辨率创建编码器,并抓取投屏数据。
步骤15、第一终端设备向第二终端设备发送初始分辨率。
步骤16、第二终端设备按照初始分辨率创建新的解码器。
步骤17、第一终端设备向第二终端设备推送音视频流,其中,视频流数据的分辨率为初始分辨率。
第一终端设备可通过分辨率为初始分辨率的编码器对抓取的投屏数据进行编码,以得到与初始分辨率匹配的视频流数据,并向第二终端设备推送音频流数据与该视频流数据。第二终端设备可通过分辨率为初始分辨率的解码器对接收的视频流数据进行解码,并播放相应的投屏画面。
若是结束投屏,则可断开第一终端设备与第二终端设备之间的投屏链路,断开投屏链路可以是由第一终端设备断开,或由第二终端设备断开。
在本申请实施例中,在后台投屏之前与后台投屏之后,均基于第一终端设备对应的第二分辨率在第二终端设备中进行投屏,将前台投屏与后台投屏进行区分,可以给到用户变化的提示作用,可避免用户在投屏过程中不清楚什么时候开始及结束后台投屏,满足了用户需求,提高了用户体验。
如图8所示,在一个实施例中,提供一种投屏方法,可应用于上述的第二终端设备,该投屏方法可 包括以下步骤:
步骤810,接收第一终端设备发送的与目标分辨率匹配的视频流数据,该目标分辨率是第一终端设备根据第二终端设备对应的投屏参数确定的;投屏参数包括所第二终端设备的投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力,该目标分辨率与该第一分辨率等比例。
在一个实施例中,在步骤810之前,该方法还包括:向第一终端设备发送第二终端设备对应的投屏参数;或,向第一终端设备发送第二终端设备的设备信息,以使第一终端设备查询与设备信息对应的投屏参数。
步骤820,根据视频流数据,在投屏窗口中播放投屏画面。
在一个实施例中,步骤向第一终端设备发送第二终端设备对应的投屏参数,可包括:通过与第一终端设备之间建立的第一传输通道,向第一终端设备发送第二终端设备对应的投屏参数;步骤820,可包括:通过与第一终端设备之间建立的第二传输通道,接收第一终端设备发送的与目标分辨率匹配的视频流数据;其中,第一传输通道为双向传输通道,第二传输通道为单向传输通道。
在一个实施例中,在步骤810之前,该方法还包括:接收第一终端设备发送的目标分辨率;按照目标分辨率创建解码器;步骤820,可包括:通过解码器对视频流数据进行解码,得到投屏数据;根据第一分辨率及目标分辨率对投屏数据进行缩放处理,并将缩放处理后的投屏数据输出到投屏窗口,以在投屏窗口中播放投屏画面。
需要说明的是,本申请实施例中提供的应用于第二终端设备的投屏方法,可参考上述各实施例中提供的应用于第一终端设备的投屏方法中的相关描述,在此不再重复赘述。
在本申请实施例中,第一终端设备(即投屏中的源端设备)能够根据第二终端设备(即投屏中的对端设备)的投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力对传输的视频流数据的分辨率进行自适应调整,既能够保证第二终端设备对视频流数据进行正常解码,又可保证投屏画面在投屏窗口中播放时不会出现黑边或者是画面拉伸扭曲的问题,提高了投屏效果。
如图9所示,在一个实施例中,提供一种投屏装置900,可应用于上述的第一终端设备,该投屏装置900可包括参数获取模块910、分辨率确定模块920及数据发送模块930。
参数获取模块910,用于获取第二终端设备对应的投屏参数,投屏参数包括第二终端设备的投屏窗口对应的第一分辨率及编解码能力。
分辨率确定模块920,用于根据投屏参数确定与第一分辨率等比例的目标分辨率。
数据发送模块930,用于向第二终端设备发送与目标分辨率匹配的视频流数据,视频流数据用于在第二终端设备的投屏窗口中播放投屏画面。
在本申请实施例中,第一终端设备(即投屏中的源端设备)能够根据第二终端设备(即投屏中的对端设备)的投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力对传输的视频流数据的分辨率进行自适应调整,既能够保证第二终端设备对视频流数据进行正常解码,又可保证投屏画面在投屏窗口中播放时不会出现黑边或者是画面拉伸扭曲的问题,提高了投屏效果。
在一个实施例中,参数获取模块910,还用于接收第二终端设备发送的投屏参数;或,接收第二终端设备发送的设备信息,查询与设备信息对应的投屏参数。
在一个实施例中,参数获取模块910,还用于通过与第二终端设备之间建立的第一传输通道,接收第二终端设备发送的投屏参数。
数据发送模块930,还用于通过与第二终端设备之间建立的第二传输通道,向第二终端设备发送与目标分辨率匹配的视频流数据。
其中,第一传输通道为双向传输通道,第二传输通道为单向传输通道。
在一个实施例中,分辨率确定模块920,包括编解码参数确定单元及分辨率确定单元。
编解码参数确定单元,用于根据第二终端设备对应的编解码能力,以及第一终端设备对应的编解码能力确定编解码参数。
分辨率确定单元,用于根据编解码参数及第二终端设备的投屏窗口对应的第一分辨率,确定与第一分辨率等比例的目标分辨率。
在一个实施例中,编解码能力包括视频宽高参数;编解码参数确定单元,还用于将第一终端设备支持的第一最大视频宽高参数,与第二终端设备支持的第二最大视频宽高参数进行比较,并选择较小的最大视频宽高参数作为目标视频宽高参数。
分辨率确定单元,还用于在目标视频宽高参数对应的分辨率范围内,确定与第一分辨率等比例的目标分辨率。
在一个实施例中,分辨率确定单元,还用于在目标视频宽高参数对应的分辨率范围内,确定与第一分辨率等比例的最大分辨率,并将最大分辨率作为目标分辨率。
在一个实施例中,分辨率确定单元,还用于在目标视频宽高参数对应的分辨率范围内,根据网络传输参数和/或第二终端设备的性能参数确定与第一分辨率等比例的目标分辨率。
在本申请实施例中,第一终端设备可结合自身的编解码能力及第二终端设备对应的编解码能力,确定二者均能够支持的分辨率范围,并在该分辨率范围中确定与第二终端设备的投屏窗口对应的第一分辨率等比例的目标分辨率,保证第一终端设备及第二终端设备在投屏过程中均能够正常进行编解码处理,且可保证投屏画面在投屏窗口中播放时不会出现黑边或者是画面拉伸扭曲的问题,提高了投屏效果。
在一个实施例中,上述的投屏装置900除了包括参数获取模块910、分辨率确定模块920及数据发送模块930,还包括虚拟屏创建模块、输出模块。
虚拟屏创建模块,用于按照目标分辨率创建虚拟屏幕。
输出模块,用于将目标应用程序的界面内容输出到虚拟屏幕。
数据发送模块930,还用于从虚拟屏幕中抓取目标应用程序的界面内容作为投屏数据,根据投屏数据生成与目标分辨率匹配的视频流数据,并向第二终端设备发送视频流数据。
在一个实施例中,上述的投屏装置900还包括编码器创建模块、参数发送模块。
编码器创建模块,用于按照目标分辨率创建编码器。
参数发送模块,用于向第二终端设备发送目标分辨率,以使第二终端设备按照目标分辨率创建解码器。
数据发送模块930,还用于通过编码器对投屏数据进行编码,以得到与目标分辨率匹配的视频流数据,并向第二终端设备发送视频流数据;视频流数据用于第二终端设备通过解码器对视频流数据进行解码,得到投屏数据,并根据第一分辨率及目标分辨率对投屏数据进行缩放处理,以在第二终端设备的投屏窗口中播放投屏画面。
在一个实施例中,投屏参数还包括第二终端设备中的多个投屏窗口分别对应的第一分辨率;分辨率确定模块920,还用于根据第二终端设备对应的编解码能力,以及各个投屏窗口对应的第一分辨率,分别确定与各个第一分辨率等比例的目标分辨率。
虚拟屏创建模块,还用于按照与各个第一分辨率等比例的目标分辨率,分别创建与各个投屏窗口对应的虚拟屏幕。
在本申请实施例中,第一终端设备可实现在后台对第二终端设备进行投屏,可避免投屏影响到用户正常使用第一终端设备的情况,而且能够保证第一终端设备及第二终端设备均可在投屏过程中进行正常的编解码处理,投屏画面在投屏窗口中播放时不会出现黑边或者是画面拉伸扭曲的问题,提高了投屏效果。
在一个实施例中,分辨率确定模块920,还用于在根据投屏参数确定与第一分辨率等比例的目标分辨率之前,根据第二终端设备对应的编解码能力、第一终端设备对应的编解码能力及第一终端设备对应的第二分辨率,确定与第二分辨率等比例的初始分辨率。
数据发送模块930,还用于向第二终端设备发送与初始分辨率匹配的视频流数据。
数据发送模块930,还用于接收第二终端设备发送的第一结束请求;根据第一结束请求向第二终端设备发送与初始分辨率匹配的视频流数据。
在本申请实施例中,在后台投屏之前与后台投屏之后,均基于第一终端设备对应的第二分辨率在第二终端设备中进行投屏,将前台投屏与后台投屏进行区分,可以给到用户变化的提示作用,可避免用户在投屏过程中不清楚什么时候开始及结束后台投屏,满足了用户需求,提高了用户体验。
如图10所示,在一个实施例中,提供一种投屏装置1000,可应用于上述的第二终端设备,该投屏装置1000可包括数据接收模块1010及播放模块1020。
数据接收模块1010,用于接收第一终端设备发送的与目标分辨率匹配的视频流数据,目标分辨率是第一终端设备根据第二终端设备对应的投屏参数确定的;投屏参数包括第二终端设备的投屏窗口对应的第一分辨率及编解码能力,目标分辨率与第一分辨率等比例。
在一个实施例中,该投屏装置1000还包括发送模块。
发送模块,用于向第一终端设备发送第二终端设备对应的投屏参数;或,向第一终端设备发送第二终端设备的设备信息,以使第一终端设备查询与设备信息对应的投屏参数。
在一个实施例中,发送模块,还用于通过与第一终端设备之间建立的第一传输通道,向第一终端设备发送第二终端设备对应的投屏参数。
数据接收模块1010,还用于通过与第一终端设备之间建立的第二传输通道,接收第一终端设备发送的与目标分辨率匹配的视频流数据。
其中,第一传输通道为双向传输通道,第二传输通道为单向传输通道。
播放模块1020,用于根据视频流数据,在投屏窗口中播放投屏画面。
在一个实施例中,该投屏装置1000还包括参数接收模块及解码器创建模块。
参数接收模块,用于接收第一终端设备发送的目标分辨率。
解码器创建模块,用于按照目标分辨率创建解码器。
数据接收模块1010,还用于通过解码器对视频流数据进行解码,得到投屏数据;根据第一分辨率及目标分辨率对投屏数据进行缩放处理,并将缩放处理后的投屏数据输出到投屏窗口,以在投屏窗口中播放投屏画面。
在本申请实施例中,第一终端设备(即投屏中的源端设备)能够根据第二终端设备(即投屏中的对端设备)的投屏窗口对应的第一分辨率及第二终端设备对应的编解码能力对传输的视频流数据的分辨率进行自适应调整,既能够保证第二终端设备对视频流数据进行正常解码,又可保证投屏画面在投屏窗口中播放时不会出现黑边或者是画面拉伸扭曲的问题,提高了投屏效果。
图11为一个实施例中终端设备的结构框图。如图11所示,终端设备1100可以包括一个或多个如下部件:处理器1110、与处理器1110耦合的存储器1120,其中存储器1120可存储有一个或多个计算机程序,一个或多个计算机程序可以被配置为由一个或多个处理器1110执行时实现如上述各实施例描述的应用于第一终端设备的投屏方法。
处理器1110可以包括一个或者多个处理核。处理器1110利用各种接口和线路连接整个终端设备1100内的各个部分,通过运行或执行存储在存储器1120内的指令、程序、代码集或指令集,以及调用存储在存储器1120内的数据,执行终端设备1100的各种功能和处理数据。可选地,处理器1110可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器1110可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器1110中,单独通过一块通信芯片进行实现。
存储器1120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory,ROM)。存储器1120可用于存储指令、程序、代码、代码集或指令集。存储器1120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现上述各个方法实施例的指令等。存储数据区还可以存储终端设备1100在使用中所创建的数据等。
可以理解地,终端设备1100可包括比上述结构框图中更多或更少的结构元件,例如,包括电源模块、物理按键、WiFi(Wireless Fidelity,无线保真)模块、扬声器、蓝牙模块、传感器等,还可在此不进行限定。
本申请实施例公开一种终端设备,包括存储器及处理器,该存储器中存储有计算机程序,该计算机程序被该处理器执行时,使得该处理器实现如上述各实施例描述的应用于第二终端设备的投屏方法。
本申请实施例公开一种计算机可读存储介质,其存储计算机程序,其中,该计算机程序被处理器执行时实现如上述各实施例描述的应用于第一终端设备的投屏方法。
本申请实施例公开一种计算机可读存储介质,其存储计算机程序,其中,该计算机程序被处理器执行时实现如上述各实施例描述的应用于第二终端设备的投屏方法。
本申请实施例公开一种计算机程序产品,该计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,且该计算机程序可被处理器执行时实现如上述各实施例描述的应用于第一终端设备的投屏方法。
本申请实施例公开一种计算机程序产品,该计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,且该计算机程序可被处理器执行时实现如上述各实施例描述的应用于第二终端设备的投屏方法。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、ROM等。
如此处所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括ROM、可编程ROM(Programmable ROM,PROM)、可擦除PROM(Erasable PROM,EPROM)、电可擦除PROM(Electrically Erasable PROM,EEPROM)或闪存。易失性存储器可包括随机存取存储器(random access memory,RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM可为多种形式,诸如静态RAM(Static RAM,SRAM)、动态RAM(Dynamic Random Access Memory,DRAM)、同步DRAM(synchronous DRAM,SDRAM)、双倍数据率SDRAM(Double Data Rate SDRAM,DDR SDRAM)、增强型SDRAM(Enhanced Synchronous DRAM,ESDRAM)、同步链路DRAM(Synchlink DRAM,SLDRAM)、存储器总线直接RAM(Rambus DRAM,RDRAM)及直接存储器总线动态RAM(Direct Rambus DRAM,DRDRAM)。
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定特征、结构或特性可以以任意适合的方式结合在一个或多个实施例中。本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及的动作和模块并不一定是本申请所必须的。
在本申请的各种实施例中,应理解,上述各过程的序号的大小并不意味着执行顺序的必然先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可位于一个地方,或者也可以分布到多个网络单元上。可根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。
另外,在本申请各实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上对本申请实施例公开的一种投屏方法、装置、终端设备及计算机可读存储介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想。同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (21)

  1. 一种投屏方法,其特征在于,应用于第一终端设备,所述方法包括:
    获取第二终端设备对应的投屏参数,所述投屏参数包括所述第二终端设备的投屏窗口对应的第一分辨率及所述第二终端设备对应的编解码能力;
    根据所述投屏参数确定与所述第一分辨率等比例的目标分辨率;
    向所述第二终端设备发送与所述目标分辨率匹配的视频流数据,所述视频流数据用于在所述第二终端设备的所述投屏窗口中播放投屏画面。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述投屏参数确定与所述第一分辨率等比例的目标分辨率,包括:
    根据所述第二终端设备对应的编解码能力,以及所述第一终端设备对应的编解码能力确定编解码参数;
    根据所述编解码参数及所述第二终端设备的投屏窗口对应的第一分辨率,确定与所述第一分辨率等比例的目标分辨率。
  3. 根据权利要求2所述的方法,其特征在于,所述编解码能力包括视频宽高参数;所述根据所述第二终端设备对应的编解码能力,以及所述第一终端设备对应的编解码能力确定编解码参数,包括:
    将所述第一终端设备支持的第一最大视频宽高参数,与所述第二终端设备支持的第二最大视频宽高参数进行比较,并选择较小的最大视频宽高参数作为目标视频宽高参数;
    所述根据所述编解码参数及所述第二终端设备的投屏窗口对应的第一分辨率,确定与所述第一分辨率等比例的目标分辨率,包括:
    在所述目标视频宽高参数对应的分辨率范围内,确定与所述第一分辨率等比例的目标分辨率。
  4. 根据权利要求3所述的方法,其特征在于,所述在所述目标视频宽高参数对应的分辨率范围内,确定与所述第一分辨率等比例的目标分辨率,包括:
    在所述目标视频宽高参数对应的分辨率范围内,确定与所述第一分辨率等比例的最大分辨率,并将所述最大分辨率作为目标分辨率。
  5. 根据权利要求3所述的方法,其特征在于,所述在所述目标视频宽高参数对应的分辨率范围内,确定与所述第一分辨率等比例的目标分辨率,包括:
    在所述目标视频宽高参数对应的分辨率范围内,根据网络传输参数和/或所述第二终端设备的性能参数确定与所述第一分辨率等比例的目标分辨率。
  6. 根据权利要求1~5任一所述的方法,其特征在于,所述获取第二终端设备对应的投屏参数,包括:
    接收第二终端设备发送的投屏参数;或,
    接收第二终端设备发送的设备信息,查询与所述设备信息对应的投屏参数。
  7. 根据权利要求6所述的方法,其特征在于,所述接收第二终端设备发送的投屏参数,包括:
    通过与所述第二终端设备之间建立的第一传输通道,接收所述第二终端设备发送的投屏参数;
    所述向所述第二终端设备发送与所述目标分辨率匹配的视频流数据,包括:
    通过与所述第二终端设备之间建立的第二传输通道,向所述第二终端设备发送与所述目标分辨率匹配的视频流数据;
    其中,所述第一传输通道为双向传输通道,所述第二传输通道为单向传输通道。
  8. 根据权利要求1~5任一所述的方法,其特征在于,在所述根据所述投屏参数确定与所述第一分辨率等比例的目标分辨率之后,所述方法还包括:
    按照所述目标分辨率创建虚拟屏幕;
    将目标应用程序的界面内容输出到所述虚拟屏幕;
    所述向所述第二终端设备发送与所述目标分辨率匹配的视频流数据,包括:
    从所述虚拟屏幕中抓取所述目标应用程序的界面内容作为投屏数据,根据所述投屏数据生成与所述目标分辨率匹配的视频流数据,并向所述第二终端设备发送所述视频流数据。
  9. 根据权利要求8所述的方法,其特征在于,在所述根据所述投屏参数确定与所述第一分辨率等比例的目标分辨率之后,所述方法还包括:
    按照所述目标分辨率创建编码器;
    向所述第二终端设备发送所述目标分辨率,以使所述第二终端设备按照所述目标分辨率创建解码器;
    所述根据所述投屏数据生成与所述目标分辨率匹配的视频流数据,并向所述第二终端设备发送所述视频流数据,包括:
    通过所述编码器对所述投屏数据进行编码,以得到与所述目标分辨率匹配的视频流数据,并向所述第二终端设备发送所述视频流数据;所述视频流数据用于所述第二终端设备通过所述解码器对所述视频流数据进行解码,得到所述投屏数据,并根据所述第一分辨率及目标分辨率对所述投屏数据进行缩放处理,以在所述第二终端设备的所述投屏窗口中播放投屏画面。
  10. 根据权利要求8所述的方法,其特征在于,所述投屏参数还包括所述第二终端设备中的多个投屏窗口分别对应的第一分辨率;
    所述根据所述投屏参数确定与所述第一分辨率等比例的目标分辨率,包括:
    根据所述第二终端设备对应的编解码能力,以及各个所述投屏窗口对应的第一分辨率,分别确定与各个所述第一分辨率等比例的目标分辨率;
    所述按照所述目标分辨率创建虚拟屏幕,包括:
    按照与各个所述第一分辨率等比例的目标分辨率,分别创建与各个所述投屏窗口对应的虚拟屏幕。
  11. 根据权利要求1~5任一所述的方法,其特征在于,在所述根据所述投屏参数确定与所述第一分辨率等比例的目标分辨率之前,所述方法还包括:
    根据所述第二终端设备对应的编解码能力、所述第一终端设备对应的编解码能力及所述第一终端设备对应的第二分辨率,确定与所述第二分辨率等比例的初始分辨率;
    向所述第二终端设备发送与所述初始分辨率匹配的视频流数据;
    在所述向所述第二终端设备发送与所述目标分辨率匹配的视频流数据之后,所述方法还包括:
    接收所述第二终端设备发送的第一结束请求;
    根据所述第一结束请求向所述第二终端设备发送与所述初始分辨率匹配的视频流数据。
  12. 一种投屏方法,其特征在于,应用于第二终端设备,所述方法包括:
    接收第一终端设备发送的与目标分辨率匹配的视频流数据,所述目标分辨率是所述第一终端设备根据所述第二终端设备对应的投屏参数确定的;所述投屏参数包括所述第二终端设备的投屏窗口对应的第一分辨率及所述第二终端设备对应的编解码能力,所述目标分辨率与所述第一分辨率等比例;
    根据所述视频流数据,在所述投屏窗口中播放投屏画面。
  13. 根据权利要求12所述的方法,其特征在于,在所述接收第一终端设备发送的与目标分辨率匹配的视频流数据之前,所述方法还包括:
    向所述第一终端设备发送所述第二终端设备对应的投屏参数;或,
    向所述第一终端设备发送所述第二终端设备的设备信息,以使所述第一终端设备查询与所述设备信息对应的投屏参数。
  14. 根据权利要求13所述的方法,其特征在于,所述向所述第一终端设备发送所述第二终端设备对应的投屏参数,包括:
    通过与所述第一终端设备之间建立的第一传输通道,向所述第一终端设备发送所述第二终端设备对应的投屏参数;
    所述接收第一终端设备发送的与目标分辨率匹配的视频流数据,包括:
    通过与所述第一终端设备之间建立的第二传输通道,接收所述第一终端设备发送的与目标分辨率匹配的视频流数据;
    其中,所述第一传输通道为双向传输通道,所述第二传输通道为单向传输通道。
  15. 根据权利要求12所述的方法,其特征在于,在所述接收第一终端设备发送的与目标分辨率匹配的视频流数据之前,所述方法还包括:
    接收第一终端设备发送的目标分辨率;
    按照所述目标分辨率创建解码器;
    所述根据所述视频流数据,在所述投屏窗口中播放投屏画面,包括:
    通过所述解码器对所述视频流数据进行解码,得到投屏数据;
    根据所述第一分辨率及目标分辨率对所述投屏数据进行缩放处理,并将缩放处理后的投屏数据输出到所述投屏窗口,以在所述投屏窗口中播放投屏画面。
  16. 一种投屏装置,其特征在于,应用于第一终端设备,所述装置包括:
    参数获取模块,用于获取第二终端设备对应的投屏参数,所述投屏参数包括所述第二终端设备的投屏窗口对应的第一分辨率及编解码能力;
    分辨率确定模块,用于根据所述投屏参数确定与所述第一分辨率等比例的目标分辨率;
    数据发送模块,用于向所述第二终端设备发送与所述目标分辨率匹配的视频流数据,所述视频流数据用于在所述第二终端设备的所述投屏窗口中播放投屏画面。
  17. 一种投屏装置,其特征在于,应用于第二终端设备,所述装置包括:
    数据接收模块,用于接收第一终端设备发送的与目标分辨率匹配的视频流数据,所述目标分辨率是所述第一终端设备根据所述第二终端设备对应的投屏参数确定的;所述投屏参数包括所述第二终端设备的投屏窗口对应的第一分辨率及编解码能力,所述目标分辨率与所述第一分辨率等比例;
    播放模块,用于根据所述视频流数据,在所述投屏窗口中播放投屏画面。
  18. 一种终端设备,其特征在于,包括存储器及处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述终端设备实现如权利要求1~11任一所述的方法。
  19. 一种终端设备,其特征在于,包括存储器及处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述终端设备实现如权利要求12~15任一所述的方法。
  20. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1~11任一所述的方法。
  21. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求12~15任一所述的方法。
PCT/CN2022/143424 2022-05-20 2022-12-29 投屏方法、装置、终端设备及计算机可读存储介质 WO2023221527A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210555494.4 2022-05-20
CN202210555494.4A CN114979755A (zh) 2022-05-20 2022-05-20 投屏方法、装置、终端设备及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2023221527A1 true WO2023221527A1 (zh) 2023-11-23

Family

ID=82985661

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/143424 WO2023221527A1 (zh) 2022-05-20 2022-12-29 投屏方法、装置、终端设备及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN114979755A (zh)
WO (1) WO2023221527A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979755A (zh) * 2022-05-20 2022-08-30 Oppo广东移动通信有限公司 投屏方法、装置、终端设备及计算机可读存储介质
CN115484485A (zh) * 2022-09-06 2022-12-16 三星电子(中国)研发中心 投屏方法、设备和系统
CN116193176A (zh) * 2023-02-13 2023-05-30 阿波罗智联(北京)科技有限公司 投屏方法、装置、设备以及存储介质

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040017394A1 (en) * 2002-04-04 2004-01-29 Keiji Adachi Image processing apparatus and method, and program for implementing the method
JP2015179330A (ja) * 2014-03-18 2015-10-08 株式会社東芝 電子機器および表示方法
CN111192544A (zh) * 2018-11-14 2020-05-22 腾讯科技(深圳)有限公司 投屏控制方法、装置、计算机可读存储介质和计算机设备
CN111552450A (zh) * 2020-04-30 2020-08-18 深圳市鸿合创新信息技术有限责任公司 一种投屏方法及装置
JP2020197687A (ja) * 2019-06-05 2020-12-10 パナソニックIpマネジメント株式会社 画像表示システム、表示制御装置及び表示制御方法
CN112468519A (zh) * 2021-01-28 2021-03-09 深圳乐播科技有限公司 电视解码能力检测方法、装置、计算机设备及可读存储介质
CN112637671A (zh) * 2020-12-11 2021-04-09 深圳乐播科技有限公司 一种屏幕共享方法及系统
CN113556598A (zh) * 2020-09-10 2021-10-26 华为终端有限公司 多窗口投屏方法及电子设备
CN114979755A (zh) * 2022-05-20 2022-08-30 Oppo广东移动通信有限公司 投屏方法、装置、终端设备及计算机可读存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9866789B2 (en) * 2015-02-25 2018-01-09 Echostar Technologies L.L.C. Automatic program formatting for TV displays
CN110286864A (zh) * 2019-05-15 2019-09-27 武汉卡比特信息有限公司 一种手机与计算机类终端自适应互联投屏方法
CN114489529A (zh) * 2020-10-23 2022-05-13 华为技术有限公司 电子设备的投屏方法及其介质和电子设备

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040017394A1 (en) * 2002-04-04 2004-01-29 Keiji Adachi Image processing apparatus and method, and program for implementing the method
JP2015179330A (ja) * 2014-03-18 2015-10-08 株式会社東芝 電子機器および表示方法
CN111192544A (zh) * 2018-11-14 2020-05-22 腾讯科技(深圳)有限公司 投屏控制方法、装置、计算机可读存储介质和计算机设备
JP2020197687A (ja) * 2019-06-05 2020-12-10 パナソニックIpマネジメント株式会社 画像表示システム、表示制御装置及び表示制御方法
CN111552450A (zh) * 2020-04-30 2020-08-18 深圳市鸿合创新信息技术有限责任公司 一种投屏方法及装置
CN113556598A (zh) * 2020-09-10 2021-10-26 华为终端有限公司 多窗口投屏方法及电子设备
CN112637671A (zh) * 2020-12-11 2021-04-09 深圳乐播科技有限公司 一种屏幕共享方法及系统
CN112468519A (zh) * 2021-01-28 2021-03-09 深圳乐播科技有限公司 电视解码能力检测方法、装置、计算机设备及可读存储介质
CN114979755A (zh) * 2022-05-20 2022-08-30 Oppo广东移动通信有限公司 投屏方法、装置、终端设备及计算机可读存储介质

Also Published As

Publication number Publication date
CN114979755A (zh) 2022-08-30

Similar Documents

Publication Publication Date Title
WO2023221527A1 (zh) 投屏方法、装置、终端设备及计算机可读存储介质
US11653036B2 (en) Live streaming method and system, server, and storage medium
US9913301B2 (en) Content sharing method and device
EP3195606B1 (en) Direct streaming for wireless display
WO2020103326A1 (zh) 一种一对多同屏方法、装置和系统、同屏设备及存储介质
JP5826861B2 (ja) ワイヤレスディスプレイのためのユーザ入力バックチャネル
JP5714726B2 (ja) ワイヤレスディスプレイのためのユーザ入力バックチャネル
US10045089B2 (en) Selection of encoder and decoder for a video communications session
WO2018010662A1 (zh) 视频文件的转码方法,装置及存储介质
US9007426B2 (en) Comparison-based selection of video resolutions in a video call
WO2020042350A1 (zh) 一种桌面投屏方法、装置、设备及存储介质
US8521900B2 (en) Remote audio-video sharing method and application program for the same
CN110740363A (zh) 投屏方法和系统、电子设备
US11694316B2 (en) Method and apparatus for determining experience quality of VR multimedia
US20110310965A1 (en) Communication device, communication method, and communication program product
WO2014054325A1 (ja) 符号化制御装置および符号化制御方法
WO2013159663A1 (zh) 内容再现方法及装置、移动终端
CN111182342A (zh) 基于dlna的媒体数据播放方法、装置、设备以及存储介质
CN114007125A (zh) 音量控制方法、移动终端、目标设备及存储介质
WO2015085873A1 (zh) 视频码流的获取方法及装置
JP2018514129A (ja) マルチレイヤタイミング同期フレームワーク
WO2023142665A1 (zh) 图像处理方法、装置、计算机设备、存储介质及程序产品
JP5847846B2 (ja) ワイヤレスディスプレイのためのユーザ入力バックチャネル
CN114710568B (zh) 音视频数据通信方法、设备及存储介质
CN116980392A (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: 22942546

Country of ref document: EP

Kind code of ref document: A1