philippe44 / AirConnect

Use AirPlay to stream to UPnP/Sonos & Chromecast devices
Other
3.55k stars 218 forks source link

Getting Delay on Google Mini Speakers after Clicking play on mac. #275

Closed iksheth closed 4 years ago

iksheth commented 4 years ago

./aircast-osx-multi -l 1000:2000 ≡ [12:24:18.030942] main:951 Starting aircast version: v0.2.27.0 (Aug 3 2020 @ 11:17:19) [12:24:18.031671] main:959 no config file, using defaults [12:24:18.031815] Start:715 Binding to 10.0.0.146 [12:24:18.159718] AddCastDevice:652 [0x10512e300]: adding renderer (Window Mini) [12:24:18.160403] AddCastDevice:652 [0x10512eca8]: adding renderer (Living Room speaker) [12:24:18.161018] AddCastDevice:652 [0x10512f650]: adding renderer (Bhaumik) [12:24:18.161678] AddCastDevice:652 [0x10512fff8]: adding renderer (Home group) [12:24:18.161694] AddCastDevice:658 [0x10512fff8]: creating MAC 5130002 [12:24:18.162424] AddCastDevice:652 [0x1051309a0]: adding renderer (All mini) [12:24:18.162434] AddCastDevice:658 [0x1051309a0]: creating MAC 51309aa [12:24:18.163316] AddCastDevice:652 [0x105131348]: adding renderer (TV mini) [12:24:27.818004] rtsp_thread:351 got RTSP connection 13 [12:24:27.820752] handle_rtsp:399 [0x7fe52f904c50]: challenge Q1CGJnitXr4Mre6fIAGZYQ== [12:24:27.823916] handle_rtsp:392 [0x7fe52f904c50]: received ANNOUNCE

RTSP/1.0 200 OK Audio-Jack-Status: connected; type=analog CSeq: 2

[12:24:27.826815] handle_rtsp:392 [0x7fe52f904c50]: received SETUP

RTSP/1.0 200 OK Transport: RTP/AVP/UDP;unicast;mode=record;control_port=64822;timing_port=61628;server_port=57981 Session: DEADBEEF Audio-Jack-Status: connected; type=analog CSeq: 3

[12:24:27.828012] handle_rtsp:392 [0x7fe52f904c50]: received RECORD [12:24:27.828022] hairtunes_record:504 [0x7fe52dd00000]: record 0 0

RTSP/1.0 200 OK Audio-Latency: 44100 Audio-Jack-Status: connected; type=analog CSeq: 4

[12:24:27.829212] handle_rtsp:392 [0x7fe52f904c50]: received SET_PARAMETER [12:24:27.829230] handle_rtsp:559 [0x7fe52f904c50]: SET PARAMETER volume -20.000000 [12:24:27.829242] CastSetDeviceVolume:333 [0x10512e300]: Queuing SET_VOLUME [12:24:27.829245] callback:235 [0x10512e300]: Volume[0..1] 0.3333

RTSP/1.0 200 OK Audio-Jack-Status: connected; type=analog CSeq: 5

[12:24:27.829575] rtp_thread_func:736 [0x7fe52dd00000]: 1st sync packet received [12:24:27.830957] handle_rtsp:392 [0x7fe52f904c50]: received SET_PARAMETER

RTSP/1.0 200 OK Audio-Jack-Status: connected; type=analog CSeq: 6

[12:24:27.832095] handle_rtsp:392 [0x7fe52f904c50]: received SET_PARAMETER

RTSP/1.0 200 OK Audio-Jack-Status: connected; type=analog CSeq: 7

[12:24:27.833434] handle_rtsp:392 [0x7fe52f904c50]: received SET_PARAMETER [12:24:27.833471] handle_rtsp:576 [0x7fe52f904c50]: received metadata artist: David Robertshaw album: title: interstellar "First Step" Hans Zimmer soundtrack - church Organ / piano cover epic

RTSP/1.0 200 OK Audio-Jack-Status: connected; type=analog CSeq: 8

[12:24:27.859315] rtp_thread_func:736 [0x7fe52dd00000]: 1st sync packet received [12:24:27.860376] handle_rtsp:392 [0x7fe52f904c50]: received FLUSH [12:24:27.860397] hairtunes_flush:474 [0x7fe52dd00000]: FLUSH ignored as same as RECORD (18666 - 1539163578) [12:24:27.860403] hairtunes_flush:486 [0x7fe52dd00000]: flush 18666 1539163578

RTSP/1.0 200 OK Audio-Jack-Status: connected; type=analog CSeq: 9

[12:24:27.889485] flac_init:218 [0x7fe52dd00000]: Using FLAC-0 (0x7fe52f904620) [12:24:27.889535] buffer_put_packet:620 [0x7fe52dd00000]: fill [level:1] [W:18666 R:18666]

[12:24:27.899828] search_remote_cb:629 [0x7fe52f904c50]: found ActiveRemote for 4EF71BD94610B79D at 10.0.0.146:54390 [12:24:27.973291] CastConnect:365 [0x10512e300]: SSL connection opened [0x7fe52f9048c0] [12:24:27.973443] CastLoad:174 [0x10512e300]: Queuing LOAD [12:24:27.973457] CastSimple:211 [0x10512e300]: Queuing PLAY [12:24:27.973461] CastSetDeviceVolume:333 [0x10512e300]: Queuing SET_VOLUME [12:24:28.023146] CastSocketThread:763 [0x10512e300]: Launching receiver 1 [12:24:29.154307] CastSocketThread:791 [0x10512e300]: Receiver launched [12:24:29.154506] ProcessQueue:583 [0x10512e300]: Processing VOLUME (id:3) [12:24:30.230230] ProcessQueue:609 [0x10512e300]: Processing LOAD (id:4) [12:24:30.367272] http_thread_func:1060 [0x7fe52dd00000]: got HTTP connection 20 (silent frames 0) [12:24:30.374529] handle_http:1243 [0x7fe52dd00000]: received GET

HTTP/1.0 200 OK Server: HairTunes Content-Type: audio/flac Connection: close

[12:24:30.374577] _buffer_get_frame:960 [0x7fe52dd00000]: drain [level:310 gap:-1516] [W:18976 R:18666] [R:0 S:0 F:0] [12:24:30.594006] CastSocketThread:807 [0x10512e300]: Media session id 1 [12:24:30.758063] ProcessQueue:590 [0x10512e300]: Processing PLAY (id:6) [12:24:30.971389] ProcessQueue:583 [0x10512e300]: Processing VOLUME (id:8) [12:24:30.971419] MRThread:287 [0x10512e300]: Cast playing [12:24:31.969751] buffer_put_packet:620 [0x7fe52dd00000]: fill [level:4] [W:19178 R:19175] [12:24:31.979485] _buffer_get_frame:960 [0x7fe52dd00000]: drain [level:1 gap:965] [W:19179 R:19178] [R:0 S:0 F:0] [12:24:36.079536] buffer_put_packet:620 [0x7fe52dd00000]: fill [level:1] [W:19690 R:19690] [12:24:36.092979] _buffer_get_frame:960 [0x7fe52dd00000]: drain [level:4 gap:939] [W:19694 R:19690] [R:0 S:0 F:0] [12:24:40.159740] buffer_put_packet:620 [0x7fe52dd00000]: fill [level:1] [W:20202 R:20202] [12:24:40.174068] _buffer_get_frame:960 [0x7fe52dd00000]: drain [level:1 gap:944] [W:20203 R:20202] [R:0 S:0 F:0] [12:24:41.485996] handle_rtsp:392 [0x7fe52f904c50]: received TEARDOWN

[12:24:41.534657] CastStop:245 [0x10512e300]: Immediate STOP (id:18)

RTSP/1.0 200 OK Audio-Jack-Status: connected; type=analog CSeq: 16

[12:24:41.536934] rtsp_thread:366 RTSP close 13

philippe44 commented 4 years ago

Can you elaborate?

iksheth commented 4 years ago

Sure, I am running this library on Raspberry Pi Zero W. Each time I start playing some thing there is latency of around 2 seconds and even after I stop playing it takes around 2 seconds to stop playing on speakers (Google Mini). Above are the messages logged in my terminal.

philippe44 commented 4 years ago

The 2 sec start latency is normal and that’s the time for the CC to buffer enough data. Look at the README you maybe able to influence that but not much. The stop delay is more strange, unless your remote control does not explicitly stops the player

iksheth commented 4 years ago

yes I understand starting delay as it's filling buffer but stopping it weird. Do you know How I can increase buffer size ?

philippe44 commented 4 years ago

Stopping is also due to some weird iOS implementations. Ca you try with iTunes? Buffer sizes are described in the README session, I have written a lengthy § about HTTP and RTP delays

philippe44 commented 4 years ago

Closed for inactivity