How to use IRDPSRAPIAudiostream in C++?

Luis Claudio 6 Reputation points
2022-02-14T18:22:31.507+00:00

I´m writing a Windows desktop application in C++ for sharing desktop screen with some viewers, using IRDPSRAPI.
I can share the desktop screen, but not the sound. For example, if I play a video in the sharer´s computer, the viewers can see the video, but can´t hear its sound, so I´m trying to use IRDPSRAPIAudiostream for sharing the audio as well. Is this the right way to do it?
I´ve read the API documentation (https://learn.microsoft.com/en-us/windows/win32/api/rdpencomapi/nn-rdpencomapi-irdpsrapiaudiostream), but it´s too vague, and I couldn´t find any code sample on internet.
If I have a sharing session and an attendee, how do I create a audio stream? I tried using QueryInterface to get IRDSRAPIAudiostream both from the sharing session and from the attendee, but none of them suceeded.
Can anybody give me some hint?

Thanks a lot.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,621 questions
Remote Desktop
Remote Desktop
A Microsoft app that connects remotely to computers and to virtual apps and desktops.
4,563 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,734 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Junjie Zhu - MSFT 17,826 Reputation points Microsoft Vendor
    2023-04-25T07:06:10.31+00:00

    Hello @Luis Claudio

    Sorry for the delay. I searched the official documentation and code samples, but I didn't see any examples of actually successfully obtaining IRDPSRAPIAudioStream. But here is the description of WDS and Desktop Duplication API in the documentation.

    Beginning with Windows 8 and Windows Server 2012, Windows Desktop Sharing uses the Desktop Duplication API. To ensure that your application will work correctly at all dots per inch (dpi) settings, your application must be DPI-aware. The recommended method for doing this is to configure the application manifest to mark your application as per-monitor DPI-aware as described in Writing DPI-Aware Desktop and Win32 Applications. This will set the application level when the application is launched.

    It is recommended to use the Desktop Duplication API to achieve this function first.

    Thank you,

    Junjie

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.