diff --git a/lib/raop_rtp_mirror.c b/lib/raop_rtp_mirror.c index ae0577f..bae8911 100644 --- a/lib/raop_rtp_mirror.c +++ b/lib/raop_rtp_mirror.c @@ -320,7 +320,7 @@ raop_rtp_mirror_thread(void *arg) * be the only ones with packet[5] = 0x10, and almost always have packet[5] = 0x10, * * but occasionally have packet[5] = 0x00. */ - /* unencrypted SPS/PPS packets have packet[4:7] = 0x01 0x00 0x01 0x16 * + /* unencrypted SPS/PPS packets have packet[4:7] = 0x01 0x00 (0x16 or 0x56) 0x01 * * they are followed by an encrypted packet with the same timestamp in packet[8:15] */ /* "streaming report" packages have packet[4:7] = 0x05 0x00 0x00 0x00, and have no * @@ -453,6 +453,10 @@ raop_rtp_mirror_thread(void *arg) case 0x01: // The information in the payload contains an SPS and a PPS NAL // The sps_pps is not encrypted + if (payload_size == 0) { + logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror, discard type 0x01 packet with no payload"); + break; + } ntp_timestamp_nal = byteutils_get_long(packet, 8); float width = byteutils_get_float(packet, 16); float height = byteutils_get_float(packet, 20); diff --git a/uxplay.cpp b/uxplay.cpp index f3d35de..c9acc78 100644 --- a/uxplay.cpp +++ b/uxplay.cpp @@ -838,10 +838,13 @@ static void process_metadata(int count, const char *dmap_tag, const unsigned cha printf("Title: "); } - for (int i = 0; i < datalen; i++) { - if (dmap_type == 9) { - printf("%c",(char) metadata[i]); - } else if (debug_log) { + if (dmap_type == 9) { + char *str = (char *) calloc(1, datalen + 1); + memcpy(str, metadata, datalen); + printf("%s", str); + free(str); + } else if (debug_log) { + for (int i = 0; i < datalen; i++) { if (i > 0 && i % 16 == 0) printf("\n"); printf("%2.2x ", (int) metadata[i]); } @@ -1183,9 +1186,10 @@ int main (int argc, char *argv[]) { parse_arguments (argc, argv); -#ifdef _WIN32 /* don't buffer stdout in WIN32 when debug_log = false */ +#ifdef _WIN32 /* use utf-8 terminal output; don't buffer stdout in WIN32 when debug_log = false */ + SetConsoleOutputCP(CP_UTF8); if (!debug_log) { - setbuf(stdout, NULL); + setbuf(stdout, NULL); } #endif