From befc9805ab55324cd4a0b712e0cc894ee6cccc44 Mon Sep 17 00:00:00 2001 From: Evgeniy S Date: Fri, 31 Mar 2023 15:09:37 +0300 Subject: [PATCH] Add workaround for missing last byte in RTSP message Sometimes on android devices last byte is missing. This is link to this bug in Goggle Issue Tracker: https://issuetracker.google.com/issues/150758736?pli=1 --- src/RtspParser.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/RtspParser.c b/src/RtspParser.c index ea47bf6..2f1ff29 100644 --- a/src/RtspParser.c +++ b/src/RtspParser.c @@ -175,6 +175,16 @@ int parseRtspMessage(PRTSP_MESSAGE msg, char* rtspMessage, int length) { break; } + else if (startsWith(endCheck, "\n\r") && endCheck[2] == '\0') { + // Previous `if` statement already handle situation when two bytes are missing. + // This is the workaround for the same problem, but for only one byte missing. + // Sometimes on android emulators last byte or two bytes are missing. + // This is link to this bug in Goggle Issue Tracker: + // https://issuetracker.google.com/issues/150758736?pli=1 + messageEnded = true; + + break; + } else if (startsWith(endCheck, "\n\r\n")) { // We've encountered the end of the message - mark it thus messageEnded = true;