Here is an example of the request/response for one of the images from your log. As you see, resolution 3872x2592 is explicitly requested. The image doesn't need any conversion, so UMS replies (and thus starts the transfer of the image itself) after 865 milliseconds. The reason it takes that long is that a lot of checks of the properties of the image is checked first, because DLNA has a lot of requirements for what qualifies as a valid JPEG (like file format version, huffman tables, color depths etc.). The image is quite large (4.3 MB), so processing it will take some time although I must say I am a bit surprised that it takes this long. It should be said that UMS is doing several things in parallel here (there are other requests happening at the same time), but still it's a long time to only verify a JPEG. If your
There's no way to see in the log when the transfer is completed (it's handled by underlying Java components, not UMS' code) so we can't tell how much time the transfer itself takes. Assuming a "normal" Wifi transfer speed of
30-50 Mb/s which translates to ~4-6 MB/s, the transfer itself should take somewhere around 1 second. It all depends on what Wifi equipment you use and the signal strength though, it doesn't take much to make Wifi even much slower. Whatever wait time takes place in addition to 1.5 - 2 seconds should be the time the Chromecast use to convert the image.
If UMS were to downscale the image, it would still spend the time on analyzing it first, plus a probably significant conversion time. The transfer would be faster though.
There should be room for improvement in the time it takes to analyze it, but this is done by external libraries (not UMS code) so the improvements would have to take place there. I'd have to look at it further to see exactly which part spend how much time, but there's two different libraries used (metadata-extractor and ImageIO). ImageIO is known to be quite slow, especially since Java 8 as Oracle replaced a proprietary library they used in previous versions with an open source one that is much slower.
Your CPU is quite slow and you only "give" UMS 683 Mb of memory. It might help a bit to increase the amount of RAM UMS is able to use. This is set during the installation, but you can change it later by using regedit and changing "HeapMem" under "HKEY_CURRENT_USER\Software\Universal Media Server". The value is in MB. The speed of your E: harddrive probably has a lot to do with the time UMS spends on analyzing the image. Since your CPU is ~10 years old it might be that your harddrive is relatively slow as well?
Implementing a maximum size for images might be a worthwhile idea. Sending a higher resolution than what the renderer can display isn't that useful, unless you want to be able to zoom in on renderers that let you do that. The biggest potential for improvement here probably lies in the libraries we use to analyze the images though. Spending that much time indicates that the whole file is read at one point during the analysis. Reading the file header should be enough to analyze a JPEG as far as I can understand.
Code: Select all
TRACE 2017-12-31 16:50:32.003 [HTTPv2 Request Worker 4] net.pms.network.RequestHandlerV2 Received a request from Chromecast-f4c484be5b8392a99bb30ab80a9a1dd8 [Chromecast] (192.168.2.104:40670):
GET /get/177/JPEG_RES3872x2592_IMGP5887.JPG HTTP/1.1
TRACE 2017-12-31 16:50:32.819 [HTTPv2 Request Worker 4] net.pms.image.ImagesUtil Image conversion DLNA compliance check: The source image is compliant
TRACE 2017-12-31 16:50:32.868 [HTTPv2 Request Worker 4] net.pms.network.RequestV2 Transfer response sent to Chromecast-f4c484be5b8392a99bb30ab80a9a1dd8 [Chromecast]:
HEADER:
HTTP/1.1 200 OK (non-chunked)
Content-Type: image/jpeg
Expires: Thu, 26 Apr 2018 09:37:12 GMT
Accept-Ranges: bytes
Connection: keep-alive
Server: Windows_10-amd64-10.0, UPnP/1.0 DLNADOC/1.50, UMS/6.7.4
Content-Length: 4326563