Hi.
I'm using foobar2000 mobile on Samsung Galaxy S1 (i9000) with Cyanogenmod v10.2.1-galaxymtd (Android v4.3.1). This is a single-core CPU. I'm using this phone because of the good quality DAC.
I'm trying to playback music from a DLNA server. The server is foobar2000 desktop version with foo_upnp v0.99.49 running on Win2003, 3GHz CPU. Streaming format is uncompressed wave for all files except mp3.

MP3 plays back fine.
The rest of the files (streamed as wave) do not play back continuously. Music pauses for 1-3s every 10-30s while playing. Sometimes it pauses for more than 20s and then skips to the next track.

Console on foobar2000 server reports lots of this:
Code:
foo_upnp: 161710.161710249: PLT_HttpServerSocketTask::SendResponseBody(428)/3204: FINE: sending body stream, 11068208 bytes
foo_upnp: 161716.161716874: NPT_BsdSocketOutputStream::Write(1055)/3204: FINE: socket result = -20400
foo_upnp: 161716.161716874: PLT_HttpServerSocketTask::SendResponseBody(435)/3204: FINE: body stream only partially sent, 1664000 bytes (-20400:NPT_ERROR_CONNECTION_RESET)
foo_upnp: 161716.161716874: PLT_HttpServerSocketTask::Write(465)/3204: WARNING: NPT_CHECK failed, result=-20400 (NPT_ERROR_CONNECTION_RESET) [(SendResponseBody(response, *output_stream, abort))]
foo_upnp: 161716.161716874: PLT_HttpHelper::ToLog(432)/3260: FINE: PLT_HttpServer::SetupResponse GET request from 172.27.143.9:37727 for "http://172.27.143.2:56923/content/d5793a2957383a0c2018e39373028d24.ape"
GET /content/d5793a2957383a0c2018e39373028d24.ape HTTP/1.1
Host: 172.27.143.2:56923
Range: bytes=25010056-
Connection: close
User-Agent: foobar2000-mobile/1.x
Accept: */*
Icy-MetaData: 1
foo_upnp: 161716.161716874: FbMediaServer::CheckAuthentication(401)/3260: INFO: received LAN request: http://172.27.143.2:56923/content/d5793a2957383a0c2018e39373028d24.ape (User-Agent: foobar2000-mobile/1.x)
foo_upnp: 161716.161716874: PLT_HttpHelper::ToLog(432)/3260: INFO: FbMediaServer::ProcessFileRequest
GET /content/d5793a2957383a0c2018e39373028d24.ape HTTP/1.1
Host: 172.27.143.2:56923
Range: bytes=25010056-
Connection: close
User-Agent: foobar2000-mobile/1.x
Accept: */*
Icy-MetaData: 1
foo_upnp: opened 'file://<censored>.ape' for streaming
foo_upnp: 161716.161716874: PLT_HttpHelper::ToLog(530)/3260: FINE: PLT_HttpServerSocketTask::Write
HTTP/1.1 206 Partial Content
Accept-Ranges: bytes
TransferMode.DLNA.ORG: Streaming
Content-Range: bytes 25010056-35256543/35256544
Date: Sun, 18 Aug 2019 11:31:34 GMT
Content-Length: 10246488
Content-Type: application/octet-stream
Connection: close
Server: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.4.2-bb
foo_upnp: 161716.161716874: PLT_HttpServerSocketTask::SendResponseBody(428)/3260: FINE: sending body stream, 10246488 bytes
foo_upnp: 161730.161730311: NPT_BsdSocketOutputStream::Write(1055)/3260: FINE: socket result = -20401
foo_upnp: 161730.161730311: PLT_HttpServerSocketTask::SendResponseBody(435)/3260: FINE: body stream only partially sent, 3328000 bytes (-20401:NPT_ERROR_CONNECTION_ABORTED)
foo_upnp: 161730.161730311: PLT_HttpServerSocketTask::Write(465)/3260: WARNING: NPT_CHECK failed, result=-20401 (NPT_ERROR_CONNECTION_ABORTED) [(SendResponseBody(response, *output_stream, abort))]
foo_upnp: 161730.161730311: PLT_HttpHelper::ToLog(432)/3224: FINE: PLT_HttpServer::SetupResponse GET request from 172.27.143.9:37728 for "http://172.27.143.2:56923/content/d5793a2957383a0c2018e39373028d24.ape"
GET /content/d5793a2957383a0c2018e39373028d24.ape HTTP/1.1
Host: 172.27.143.2:56923
Range: bytes=26731992-
Connection: close
User-Agent: foobar2000-mobile/1.x
Accept: */*
Icy-MetaData: 1
foo_upnp: 161730.161730311: FbMediaServer::CheckAuthentication(401)/3224: INFO: received LAN request: http://172.27.143.2:56923/content/d5793a2957383a0c2018e39373028d24.ape (User-Agent: foobar2000-mobile/1.x)
foo_upnp: 161730.161730311: PLT_HttpHelper::ToLog(432)/3224: INFO: FbMediaServer::ProcessFileRequest
GET /content/d5793a2957383a0c2018e39373028d24.ape HTTP/1.1
Host: 172.27.143.2:56923
Range: bytes=26731992-
Connection: close
User-Agent: foobar2000-mobile/1.x
Accept: */*
Icy-MetaData: 1
foo_upnp: opened 'file://<censored>.ape' for streaming
foo_upnp: 161730.161730311: PLT_HttpHelper::ToLog(530)/3224: FINE: PLT_HttpServerSocketTask::Write
HTTP/1.1 206 Partial Content
Accept-Ranges: bytes
TransferMode.DLNA.ORG: Streaming
Content-Range: bytes 26731992-35256543/35256544
Date: Sun, 18 Aug 2019 11:31:47 GMT
Content-Length: 8524552
Content-Type: application/octet-stream
Connection: close
Server: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.4.2-bb
foo_upnp: 161730.161730311: PLT_HttpServerSocketTask::SendResponseBody(428)/3224: FINE: sending body stream, 8524552 bytes
This appears to be a phone CPU problem.
Phone CPU utilisation spikes at 100% every 3-4 seconds. Spikes on phone CPU match errors in server log - they appear at the same time - but music discontinuity doesn't happen every time.

I tried using a newer phone and everything was fine, but I don't want to use that phone because the sound quality doesn't match the Galaxy S.
I tried setting phone CPU to run at top frequency (1GHz) all the time. Didn't help.
I tried changing the CPU scheduler. Didn't help.
I tried changing output to OpenSL. Interruptions are a bit less frequent.

What causes these interruptions? A network timeout? (I saw no lost packets) A buffer underrun?
Is there any way to increase data buffer for network reads? Is there any way to increase the audio output buffer (decoded data)?

Thank you.