mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-04-02 22:06:10 +00:00
Minor cleanups to RTSP URL parsing
This commit is contained in:
@@ -701,8 +701,10 @@ static bool parseUrlAddrFromRtspUrlString(const char* rtspUrlString, char* desti
|
||||
*urlPathSeparator = 0;
|
||||
}
|
||||
|
||||
PltSafeStrcpy(destination, destinationLength, rtspUrlScratchBuffer + prefixLen);
|
||||
destination[destinationLength - 1] = '\0';
|
||||
if (!PltSafeStrcpy(destination, destinationLength, rtspUrlScratchBuffer + prefixLen)) {
|
||||
free(rtspUrlScratchBuffer);
|
||||
return false;
|
||||
}
|
||||
|
||||
free(rtspUrlScratchBuffer);
|
||||
return true;
|
||||
@@ -774,12 +776,10 @@ int performRtspHandshake(PSERVER_INFORMATION serverInfo) {
|
||||
if (OriginalVideoBitrate >= HIGH_AUDIO_BITRATE_THRESHOLD &&
|
||||
(AudioCallbacks.capabilities & CAPABILITY_SLOW_OPUS_DECODER) == 0 &&
|
||||
(StreamConfig.streamingRemotely != STREAM_CFG_REMOTE || CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(StreamConfig.audioConfiguration) <= 2)) {
|
||||
// If we have an RTSP URL string and it was successfully parsed, use that string
|
||||
if (serverInfo->rtspSessionUrl != NULL && parseUrlAddrFromRtspUrlString(serverInfo->rtspSessionUrl, urlAddr, sizeof(urlAddr))) {
|
||||
PltSafeStrcpy(rtspTargetUrl, sizeof(rtspTargetUrl), serverInfo->rtspSessionUrl);
|
||||
rtspTargetUrl[sizeof(rtspTargetUrl) - 1] = '\0';
|
||||
}
|
||||
else {
|
||||
// If we have an RTSP URL string and it was successfully parsed and copied, use that string
|
||||
if (serverInfo->rtspSessionUrl == NULL ||
|
||||
!parseUrlAddrFromRtspUrlString(serverInfo->rtspSessionUrl, urlAddr, sizeof(urlAddr)) ||
|
||||
!PltSafeStrcpy(rtspTargetUrl, sizeof(rtspTargetUrl), serverInfo->rtspSessionUrl)) {
|
||||
// If an RTSP URL string was not provided or failed to parse, we will construct one now as best we can.
|
||||
//
|
||||
// NB: If the remote address is not a LAN address, the host will likely not enable high quality
|
||||
|
||||
Reference in New Issue
Block a user