Closed hushilin closed 2 years ago
@hushilin This in ios10_log.txt I think means that you are still running the previous code, not the one I need to test.
Client identified as User-Agent: AirPlay/320.20
This identifies client as using old protocol for AES audio key)
timing_rport = 59450
raop_ntp parse remote ip = 169.254.149.55
Please make sure that lib/ global.h in the test looks like.
#ifndef GLOBAL_H
#define GLOBAL_H
#define GLOBAL_FEATURES 0x7
#define GLOBAL_MODEL "AppleTV2,1"
#define GLOBAL_VERSION "220.68"
/* use old protocol for AES key if User-Agent string is contained in these strings */
/* replace xxx by any new User-Agent string as needed */
#define OLD_PROTOCOL_AUDIO_CLIENT_LIST "AirMyPC/2.0;xxx"
#define OLD_PROTOCOL_VIDEO_CLIENT_LIST "AirMyPC/2.0;xxx"
#define MAX_HWADDR_LEN 6
#endif
The code has line 405 in lib/raop_handlers.h
which should not produce the output I am seeing in your output if global.h is like the one above.
const char * user_agent = http_request_get_header(request, "User-Agent");
logger_log(conn->raop->logger, LOGGER_INFO, "Client identified as User-Agent: %s", user_agent);
unsigned char *aeskey_audio, *aeskey_video;
if (strstr(OLD_PROTOCOL_AUDIO_CLIENT_LIST,user_agent)) { /* old-protocol clients use the unhashed AES key */
logger_log(conn->raop->logger, LOGGER_INFO, "This identifies client as using old protocol for AES audio key)");
aeskey_audio = aeskey_old;
} else {
aeskey_audio = aeskey;
}
video project:
Yes uxplay does not have the webserver mode that apple tv has, where video streamer from a site to the ipad/iphone is streamed directly to the AppleTV.
ios_10.txt sorry! This is the latest version of the log
Thank you!
It did not behave the way I expected.
Yes this time it used the hashed AES KEY (not the unhashed one) for audio, but looks just the same as with the unhashed key, both seem bad. I need to make the debug mode to show more details about the audio decryption directly (inside raop_rtp.c) rather than wait till the audio stream gets to gstreamer.
This will be to count how many successful decrypted audio frames there are (if any) before a bad one, and print the beginning of the bad frame.
I'll post here when this is ready to be tried, if it is not too much trouble for you (I dont have access to the old hardware) If there is an easy fix, it would be nice to support those old 32-bit iPads etc that are stuck at iOS9.3 . I was surprised that I could guess an easy fix that worked for the old-protocol Windows AirPlay-client emulator AirMyPc, that someone wanted to use.
(It is not high priority, as I don't know if anyone will actually use ios9 devices if it gets fixed, at least the video works which is OK for some uses).
Why are you using ios9 , ios10 devices?
@hushilin Thanks for you help.
Get a fresh download of uxplay-1.44 and edit lib/glocal.h
Change #define DECRYPTION_TEST 0
to #define DECRYPTION_TEST 1
and build.
Run "uxplay" (WITHOUT -d option) with and iOS 9 or iOS10 client streaming audio as well as video. post some of the output, enough to see what is happening.
Then again edit global.h to replace
#define OLD_PROTOCOL_AUDIO_CLIENT_LIST "AirMyPC/2.0;xxx"
by
#define OLD_PROTOCOL_AUDIO_CLIENT_LIST "AirMyPC/2.0;AirPlay/260.26;AirPlay/320.20;xxx"
and rebuild and run it again with an iOS9 or iOS10 client, streaming audio as well as video. Post some output.
When run with a working client, you will see output like
AirMyPC/2.0;xxx
273 before ef 8c 8a 2d 8d 18 f0 68 83 6c 3f c5 ad 28 53 3f
273 after 8e 81 b2 d4 d8 a8 10 2b 7a 95 c8 16 a3 4e fc ae
AirMyPC/2.0;xxx
265 before 23 2d 24 87 55 36 ac 8c f4 a3 5d 30 af b4 13 b3
265 after 8e 83 b4 51 e0 ec 74 08 14 47 30 a9 08 04 5b 55
AirMyPC/2.0;xxx
283 before d8 ea 65 c2 d6 69 04 36 2a a7 63 63 a9 b6 bd 55
283 after 8d 06 eb df ef f0 96 a8 73 14 c2 05 5c a8 73 55
Good AAC frames begin with 8d or 8e. The first line shows the definition of OLD_PROTOCOL_AUDIO_CLIENT_LIST
in global.h that was used when uxplay was compiled.
@fduncanh
start audio connection, format AAC-ELD 44100/2
raop_rtp starting audio
AirMyPC/2.0;AirPlay/260.26;AirPlay/320.20;xxx
44 before c2 00 0c 17 eb 5e 9c 75 4b 82 73 5c c0 9f d1 11
***ERROR AUDIO FRAME IS NOT AAC_ELD OR ALAC
44 after 81 c0 00 00 00 7c 83 86 4f 25 2d c3 cc a3 c0 3e
*** ERROR decryption of audio frame (compression_type 8) failed
AirMyPC/2.0;AirPlay/260.26;AirPlay/320.20;xxx
132 before e9 c8 f8 83 8f ea 4e 90 53 0b 58 02 c1 6a c1 f3
***ERROR AUDIO FRAME IS NOT AAC_ELD OR ALAC
132 after 82 92 a9 b1 d0 60 33 ab d7 1c f5 86 10 99 df 43
AirMyPC/2.0;AirPlay/260.26;AirPlay/320.20;xxx
124 before 3d 5a 46 83 a3 ab 02 ed df 10 9c 46 11 a0 24 68
***ERROR AUDIO FRAME IS NOT AAC_ELD OR ALAC
124 after 82 94 a7 42 50 c0 34 79 6e 19 d2 98 a8 c8 1d 29
AirMyPC/2.0;AirPlay/260.26;AirPlay/320.20;xxx
100 before d6 02 76 ac b4 70 5f f6 e0 09 f7 a6 12 bd 41 51
***ERROR AUDIO FRAME IS NOT AAC_ELD OR ALAC
100 after 82 98 a2 b2 e0 88 90 19 ec d8 72 ce 19 7c 6d 98
AirMyPC/2.0;AirPlay/260.26;AirPlay/320.20;xxx
100 before 62 d4 6b 44 df 3c e8 8a 5d 9a d0 b7 fb 28 95 e5
***ERROR AUDIO FRAME IS NOT AAC_ELD OR ALAC
100 after 82 94 a5 b2 51 20 35 75 a4 f4 13 19 cc 35 56 d0
AirMyPC/2.0;AirPlay/260.26;AirPlay/320.20;xxx
88 before ef 88 c4 f1 e7 a8 5c 59 30 47 87 71 9c a0 3d 2e
***ERROR AUDIO FRAME IS NOT AAC_ELD OR ALAC
88 after 82 9c 87 23 04 60 37 d1 1e 9e 5a c4 f4 dc 34 d1
AirMyPC/2.0;AirPlay/260.26;AirPlay/320.20;xxx
96 before 08 bc 81 5f e1 97 93 93 89 0c 72 66 6d 02 9a 54
***ERROR AUDIO FRAME IS NOT AAC_ELD OR ALAC
96 after 82 98 a4 34 08 a0 33 da f0 f5 37 79 f4 c6 d1 8b
AHA! first byte is always 81 or 82 after decryption! (not random so the decryption is successful!) So it is decrypted with the old protocol, but is not AAC-ELD audio! Probably AAC-LC (which AIrPlay also supports)
No not LC. One need to examine the headers more closely. Modern AAC_ELD starts with
0x8d = 10001101 0x8e = 10001110
this starts with 0x81 = 10000001 0x82 = 10000010
so just need to work our what variety of AAC it is.
@hushilin I am hoping that the AAC-ELD audio will work now.
Please download a new copy of 1.44, build and test it. (just use "uxplay"). If it works, please test both iOS9 and iOS10, and let me know the precise iOS versions on your two iPhones. (Probably the last ones that work for those models?).
If the sound still does not work, please edit global.h to
change #define DECRYPTION_TEST 0
to #define DECRYPTION_TEST 2
and rebuild.
This will output complete decrypted audio frames. Please post output with about 10 frames here, I will try to find out what GStreamer settings are needed to play them. (the frames begin with 0x81 or 0x82 rather than 0x8d and 0x8e from modern iOS.)
@hushilin
If you have time, please check if sound is working now ....
now tested on iPhone 4,1 ios9 running iOS 9.3.6 (User Agent: AirPlay/280.33) (most recent iOS for 32bit device)
Protocol is same as current (hashed audio AES key) , but first byte of AAC-ELD audio frames is 0x81 or 0x82, while modern 64 bit iOS devices have AAC-ELD audio frames starting 0x8d or 0x8e.
ios9 mirror error。 ios10 OK