简体   繁体   English

android jpeg压缩已更改(通过提供程序或CDN)

[英]android jpeg compression changed (by provider or cdn)

this is most probably not really android related, but in my game users can download content via akamai cdn. 这很可能与android无关,但是在我的游戏中,用户可以通过akamai CDN下载内容。 this works nicely except for jpeg files which for some users are delivered with a different compression. 除了jpeg文件(对于某些用户以不同的压缩率提供)外,这非常有效。 this is somehow depending on the device / android build version / provider / location (and therefore actual akamai node). 这在某种程度上取决于设备/ android构建版本/提供程序/位置(以及实际的akamai节点)。

since i do a hash check after download to check if the file was delivered properly i get a different hash for a manipulated jpeg file and detect an error. 由于我在下载后进行了哈希检查,以检查文件是否正确交付,因此我为操纵的jpeg文件获取了不同的哈希并检测到错误。

i already changed the download process so that all files are named 我已经更改了下载过程,以便所有文件都被命名

filename_ext.bin

so that the mime type would be application/octet-stream instead of mage/jpeg, but still it seams that some node in the middle ( a proxy maybe? ) checks for the file content and recompresses the jpeg (to save 10-20% of jpeg size; after all, cpu power is cheap, bandwith is expensive). 这样,mime类型将是application / octet-stream而不是mage / jpeg,但是它仍然表明中间的某个节点(可能是代理?)检查文件内容并重新压缩jpeg(以节省10%至20% jpeg大小;毕竟,cpu功率便宜,bandband昂贵)。

does anyone have any experience with this kind of problem? 有没有人对这种问题有任何经验?

maybe a solution would be to zip every file and unzip on the device ( hoping that whatever is altering the file does not unzip / change jpeg / zip again). 可能的解决方案是将每个文件压缩并在设备上解压缩(希望更改文件不会再次解压缩/更改jpeg / zip)。

thanks in advance. 提前致谢。

ok, just got answer from akamai support: 好的,刚从akamai支持人员那里得到了答案:

"some providers have transparent proxies installed that dynamically re-compress image graphics (jpg and gif) - they also modify HTML pages. Images are recognized based on their file signature and not based on file extension." “一些提供商安装了​​透明代理,可以动态重新压缩图像图形(jpg和gif)-它们还修改HTML页面。图像是根据其文件签名而不是基于文件扩展名来识别的。”

so I actually have to encrypt / zip the files to circumvent that... 所以我实际上必须加密/压缩文件以规避该问题...

also: http header 还:http标头

Cache-Control no-transform

also did the trick. 也做到了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM