mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 01:15:46 +00:00
Adjust RTSP requests to conform to GFE 3.22 changes
This commit is contained in:
parent
9a706fd78c
commit
9b194cc700
@ -12,6 +12,7 @@ static bool hasSessionId;
|
|||||||
static int rtspClientVersion;
|
static int rtspClientVersion;
|
||||||
static char urlAddr[URLSAFESTRING_LEN];
|
static char urlAddr[URLSAFESTRING_LEN];
|
||||||
static bool useEnet;
|
static bool useEnet;
|
||||||
|
static const char* controlStreamId;
|
||||||
|
|
||||||
static SOCKET sock = INVALID_SOCKET;
|
static SOCKET sock = INVALID_SOCKET;
|
||||||
static ENetHost* client;
|
static ENetHost* client;
|
||||||
@ -418,7 +419,8 @@ static bool sendVideoAnnounce(PRTSP_MESSAGE response, int* error) {
|
|||||||
|
|
||||||
*error = -1;
|
*error = -1;
|
||||||
|
|
||||||
ret = initializeRtspRequest(&request, "ANNOUNCE", "streamid=video");
|
ret = initializeRtspRequest(&request, "ANNOUNCE",
|
||||||
|
APP_VERSION_AT_LEAST(7, 1, 431) ? controlStreamId : "streamid=video");
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ret = false;
|
ret = false;
|
||||||
|
|
||||||
@ -604,6 +606,7 @@ int performRtspHandshake(void) {
|
|||||||
sprintf(rtspTargetUrl, "rtsp%s://%s:48010", useEnet ? "ru" : "", urlAddr);
|
sprintf(rtspTargetUrl, "rtsp%s://%s:48010", useEnet ? "ru" : "", urlAddr);
|
||||||
currentSeqNumber = 1;
|
currentSeqNumber = 1;
|
||||||
hasSessionId = false;
|
hasSessionId = false;
|
||||||
|
controlStreamId = APP_VERSION_AT_LEAST(7, 1, 431) ? "streamid=control/9/0" : "streamid=control/1/0";
|
||||||
|
|
||||||
switch (AppVersionQuad[0]) {
|
switch (AppVersionQuad[0]) {
|
||||||
case 3:
|
case 3:
|
||||||
@ -808,7 +811,9 @@ int performRtspHandshake(void) {
|
|||||||
RTSP_MESSAGE response;
|
RTSP_MESSAGE response;
|
||||||
int error = -1;
|
int error = -1;
|
||||||
|
|
||||||
if (!setupStream(&response, "streamid=control/1/0", &error)) {
|
if (!setupStream(&response,
|
||||||
|
controlStreamId,
|
||||||
|
&error)) {
|
||||||
Limelog("RTSP SETUP streamid=control request failed: %d\n", error);
|
Limelog("RTSP SETUP streamid=control request failed: %d\n", error);
|
||||||
ret = error;
|
ret = error;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
@ -844,18 +849,19 @@ int performRtspHandshake(void) {
|
|||||||
freeMessage(&response);
|
freeMessage(&response);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
// GFE 3.22 uses a single PLAY message
|
||||||
|
if (APP_VERSION_AT_LEAST(7, 1, 431)) {
|
||||||
RTSP_MESSAGE response;
|
RTSP_MESSAGE response;
|
||||||
int error = -1;
|
int error = -1;
|
||||||
|
|
||||||
if (!playStream(&response, "streamid=video", &error)) {
|
if (!playStream(&response, "/", &error)) {
|
||||||
Limelog("RTSP PLAY streamid=video request failed: %d\n", error);
|
Limelog("RTSP PLAY streamid=video request failed: %d\n", error);
|
||||||
ret = error;
|
ret = error;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.message.response.statusCode != 200) {
|
if (response.message.response.statusCode != 200) {
|
||||||
Limelog("RTSP PLAY streamid=video failed: %d\n",
|
Limelog("RTSP PLAY failed: %d\n",
|
||||||
response.message.response.statusCode);
|
response.message.response.statusCode);
|
||||||
ret = response.message.response.statusCode;
|
ret = response.message.response.statusCode;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
@ -863,26 +869,48 @@ int performRtspHandshake(void) {
|
|||||||
|
|
||||||
freeMessage(&response);
|
freeMessage(&response);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
{
|
||||||
|
RTSP_MESSAGE response;
|
||||||
|
int error = -1;
|
||||||
|
|
||||||
{
|
if (!playStream(&response, "streamid=video", &error)) {
|
||||||
RTSP_MESSAGE response;
|
Limelog("RTSP PLAY streamid=video request failed: %d\n", error);
|
||||||
int error = -1;
|
ret = error;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (!playStream(&response, "streamid=audio", &error)) {
|
if (response.message.response.statusCode != 200) {
|
||||||
Limelog("RTSP PLAY streamid=audio request failed: %d\n", error);
|
Limelog("RTSP PLAY streamid=video failed: %d\n",
|
||||||
ret = error;
|
response.message.response.statusCode);
|
||||||
goto Exit;
|
ret = response.message.response.statusCode;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
freeMessage(&response);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.message.response.statusCode != 200) {
|
{
|
||||||
Limelog("RTSP PLAY streamid=audio failed: %d\n",
|
RTSP_MESSAGE response;
|
||||||
response.message.response.statusCode);
|
int error = -1;
|
||||||
ret = response.message.response.statusCode;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
freeMessage(&response);
|
if (!playStream(&response, "streamid=audio", &error)) {
|
||||||
|
Limelog("RTSP PLAY streamid=audio request failed: %d\n", error);
|
||||||
|
ret = error;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.message.response.statusCode != 200) {
|
||||||
|
Limelog("RTSP PLAY streamid=audio failed: %d\n",
|
||||||
|
response.message.response.statusCode);
|
||||||
|
ret = response.message.response.statusCode;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
freeMessage(&response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user