streamroot / clappr-p2phls-plugin

BemTV peer-to-peer plugin for Clappr Player (HTTP Live Streaming, HLS, WebRTC, P2P)
http://bem.tv
Apache License 2.0
299 stars 99 forks source link

Transfer/Store LZMA compressed video chunks #130

Closed flavioribeiro closed 9 years ago

flavioribeiro commented 9 years ago

https://github.com/nmrugg/LZMA-JS

flavioribeiro commented 9 years ago

had a promising result with https://github.com/pieroxy/lz-string:

>>> chunk.length
272728
>>> LZString.compress(chunk).length
104454
flavioribeiro commented 9 years ago

Segment bitrate: 1.2Mbps, size in seconds: 5

 [DEBUG] Without LZString: 1154072, with LZString: 484184 p2phls.min.js:3
 [DEBUG] Without LZString: 1124240, with LZString: 471442 p2phls.min.js:3
 [DEBUG] Without LZString: 1217488, with LZString: 511350 p2phls.min.js:3
 [DEBUG] Without LZString: 1048288, with LZString: 440291 p2phls.min.js:3
 [DEBUG] Without LZString: 1118224, with LZString: 470966 p2phls.min.js:3
 [DEBUG] Without LZString: 1220248, with LZString: 511604 p2phls.min.js:3
 [DEBUG] Without LZString: 1069344, with LZString: 449353 p2phls.min.js:3
 [DEBUG] Without LZString: 1131760, with LZString: 476222 p2phls.min.js:3
 [DEBUG] Without LZString: 1125996, with LZString: 473367 p2phls.min.js:3

Experiencing stucks, need to put compress/decompress functions in a separate web worker. :feelsgood:

flavioribeiro commented 9 years ago

I've minified the worker: https://gist.github.com/flavioribeiro/0a27a09ad9a836a2b241

flavioribeiro commented 9 years ago

Since char size calculation is needed, we come back with this issue: https://github.com/rtc-io/rtc-bufferedchannel/issues/4

I'll try to figure out an alternative to https://github.com/rtc-io/rtc-bufferedchannel/blob/master/index.js#L212

flavioribeiro commented 9 years ago

All this transcoding thing is adding a lot of complexity on the code. I think its better to edit cdn_requester in order to encode a compressed Base64 string instead of the current one. This way, a AS3 version of https://github.com/pieroxy/lz-string is needed. :sob::sob::sob::sob: