cdnbye / hlsjs-p2p-engine

Let your viewers become your unlimitedly scalable CDN.

Home Page:https://docs.swarmcloud.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

p2p experience is always better after restart.

shell1986 opened this issue · comments

Hi, I researched the work of p2p and found a strange pattern.

My details.
Vod 2 level
720 & 480
try connect 17 ~ 25 peers

chunk = 2.5mb ~ 5mb. (720p) 8 sec.

segmentId: function (level, sn, tsUrl) {
                id=tsUrl.split('?')[0];
                const formatedUrl =id.split('/')[id.split('/').length-1]+level+"&"+sn;
                return formatedUrl;
                }

Basically, all users are watching 720p.

A minute after the start, 4-7 peers remain. And in most cases it is being downloaded from a CDN. If i reboot p2pengine
p2p.disableP2P (); p2p.enableP2P (); (p2p = P2Pengine object)

That peers will be much more and start downloading via p2p. What is the logic for assigning peers? in p2p.tracker I found p2p.tracker.failedDCSet as I understood the black list of peers and requestMorePeers ()
Can this be used for better results?

And why in the documentation there are no dcTolerance and dcUploadTimeout settings?

It seems to me that sometimes an error occurs with the levels when the system finds a file of another level and therefore another segmentid.

debug

peers: 7 idle peers: 7
cdnbye@latest:1 found sn 69 from peer 86bf8f85bd4123a2
cdnbye@latest:1 request criticalSeg segId n_69_0_0.ts1&69 at 69
cdnbye@latest:1 loading frag 69
cdnbye@latest:1 DC_PIECE_NOT_FOUND
cdnbye@latest:1 critical request timeout
cdnbye@latest:1 datachannel timeout while downloading from 86bf8f85bd4123a2
cdnbye@latest:1 P2P timeout switched to HTTP load n_69_0_0.ts?nimblesessionid=516858&expires=1554572845&md5=KXQawexOQd9Ray8oJXrYQQ at 69
cdnbye@latest:1 segment pool add seg n_69_0_0.ts1&69 level 1

Hi, supersh86:

  1. In the p2p network, a peer may serve as a seed for other peers, you can listen to the stats event to get more info
  2. failedDCSet record those peers that can not establish connection. I don't think its useful for you
  3. It is suggested to play only one level to avoid requesting a segment with the same SN but in different level, which will cause DC_PIECE_NOT_FOUND

Thanks for your reply.
Is it possible that I request the first file in the list of the buffer, and it is deleted before I can download it?

Unlikely, maybe the SN requested is not in the same level as peer.

But then the segmentid would be different.

It seems I understood, my p2p.channel is not displayed correctly.

p2p.config.channelId()
"anivid.tk/s1/10137/1/101.mp4/ch854"
p2p.channel
"anivid.tk/s1/10137/1/101.mp4/ch720|signal.anidub.com[v2]"

It is suggested to use default channelId.