This info was really helpful, thank you @gbooker02. I got a chance to do some more poking around in my setup and I believe I have started to narrow in on what is going on.
I checked the plex.ini file and, conveniently, the QtAudioDevices key was near the top (so was QtAudioDevicePreferredOrder, but I don’t think it is particularly relevant here). It confirmed what I suspected, which is that the unique identifier for the name of the device has changed numerous times (as there were quite a few entries all with the same description and different names) and all of those appear to be recorded in the QtAudioDevices, with the most recent current/working version at the end of the list. I know that is the case because when I went into Plex HTPC, the Audio settings had reset, so I reconfigured it, exited Plex, and looked in the plex.ini file. The newest entry corresponded to the first entry in the QtAudioDevicePreferredOrder and also had some kind of timestamp in it that matched up.
I think we can definitively say that the changing unique identifier on the device name is the cause of the unwanted behavior in Plex.
As to why the unique identifier keeps changing, I continued digging First, I looked for anything that had updated recently, but there have been no Plex HTPC updates or driver updates that I could identify. (as an aside, I’m still on the 1.38 version of Plex HTPC and have not been prompted to auto-update; is that always done when you start Plex HTPC or is it somewhat spread out to reduce update load on servers?) Next, I rebooted, I put the HTPC to sleep, and I used the Suspend option in the Plex HTPC menu. In every instance the unique identifier stayed the same.
I tend to think that the issue @jcorn, @TheTrunkMonkey, and I are seeing is not related to Plex updates, driver updates, or simply sleep, suspend, or reboot. I’m not willing to say it is definitive, but I do not think those power-related actions alone cause the problem (I’m willing to take as a given that driver updates might cause it, but it does happen in the absence of such updates). I think the power-related actions in combination with the HDMI events (devices turning on/off in different orders and handshakes happening and re-happening) is the most likely cause. That is not easily tested as far as I can figure.
Next, it occurred to me that the audio device is provided via the HDMI port on the graphics card and thus is likely at least partially the responsibility of the NVIDIA GPU driver (which would make sense, because the description includes something like “NVIDIA High Definition Audio Device”; sorry, don’t have it in front of me, going from memory).
My GPU is an EVGA GeForce GTX 960. @JohnAlex indicated they are using an AMD GPU. @jcorn and @TheTrunkMonkey, why kind of GPUs are you using?
My current theory is that NVIDIA’s drivers during the HDMI handshake/update stuff are generating the new unique identifiers for the devices and providing those to the OS. I could find no settings that might allow for controlling that behavior (but I may have looked in the wrong place). Regardless, it strikes me (1) as unlikely that NVIDIA will change anything (and may well have good reasons for why they do it that way) and (2) other applications (and Windows itself) seem to cope with the unique identifiers changing just fine, given that NVIDIA is like 75%+ of the GPU market.
To @TheTrunkMonkey’s suggestion of just allowing for hardcoding of the device, I do not think that will work. MPV takes the name of the device from Plex, so Plex has to pass it that. But if the name has changed, hardcoding will not solve the problem be cause the hardcoded name being passed won’t exist.
Instead, if Plex were to use the description to identify the correct name from the list provided by MPV, this would almost certainly result in Plex behaving as everyone wants (as @jcorn articulated above). Additionally, as far as I can see, there really is no reason for Plex to be so beholden to the name of the device. It uses the description in the UI, so there’s no reason it couldn’t likewise identify the name by description in the list provided from MPV. Within Plex itself, it could store the description of the preferred device. Perhaps even just an additional setting to tell Plex to use description or name to identify preferred audio device would make everyone happy?
@gbooker02 what do you think?