I'm writing an audio player using Microsoft Media Foundation. I wonder is it possible to change the playback device without re-creating the session?
IMFActivate *m_p_sink_activate;
...
m_p_sink_activate->SetString(MF_AUDIO_RENDERER_ATTRIBUTE_ENDPOINT_ID, name_device);
This doesn't take effect if the audio is already being played.
Btw, the media player provided by Microsoft.Windows.SDK.Contracts (Windows.Media.Playback.MediaPlayer) does it perfectly. When I change m_mediaPlayer.AudioDevice, the audio stream is redirected to the assigned device immediately. So I wonder if this is also possible for MSMF.
So far I have a way could do this job,
You could refer to MS sample TopoEdit for detail.
One side effect is that each time SetTopology cause huge memory growth.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.