Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Piece 0 requested infinite times #535

Closed
DiegoRBaquero opened this issue Dec 26, 2015 · 6 comments
Closed

Piece 0 requested infinite times #535

DiegoRBaquero opened this issue Dec 26, 2015 · 6 comments
Labels

Comments

@DiegoRBaquero
Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Dec 26, 2015

Using a webseeded small MP4 video file it gets downloaded over and over again.

'Set complete' is logged. Piece is neither verified or rejected

if (!piece.set(reservation, chunk, wire)) return onUpdateTick()

    debug('Set complete')

    var buf = piece.flush()

    // TODO: might need to set self.pieces[index] = null here since sha1 is async

    sha1(buf, function (hash) {
      if (hash === self._hashes[index]) {
        if (!self.pieces[index]) return
        debug('piece verified %s', index)

        self.pieces[index] = null
        self._reservations[index] = null
        self.bitfield.set(index, true)

        self.store.put(index, buf)

        self.swarm.wires.forEach(function (wire) {
          wire.have(index)
        })

        self._checkDone()
      } else {
        self.pieces[index] = new Piece(piece.length)
        self.emit('warning', new Error('Piece ' + index + ' failed verification'))
      }
      onUpdateTick()
    })
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 27, 2015

That's odd.

  1. Is this in node or the browser? What version?
  2. Can you share a small code snippet that reproduces the issue?
@DiegoRBaquero

This comment has been minimized.

Copy link
Member Author

@DiegoRBaquero DiegoRBaquero commented Dec 28, 2015

@feross Latest version in the browser, now even using renderTo method.

The commented image does work fine.

html
    head
        title LiveTorrent
    body
        h1 Hello
        //img(bt-src="685dbb1b12f2d4ab747dd4e0f78e0bdf698aa112")
        video(bt-src="https://webseed.btorrent.xyz/small.mp4.torrent" controls autoplay)
        script(src="bundle2.js")
var client = require('webtorrent')()

elementList = document.querySelectorAll("[bt-src]")

//console.log(elementList)

for(var key in elementList) {
  var element = elementList[key]
  if(element && element.attributes && element.attributes['bt-src']) {
    var el = element
    var torrentId = element.attributes['bt-src'].nodeValue
    client.add(torrentId, function(torrent) {
      torrent.files[0].renderTo(el)
      /*torrent.files[0].getBlobURL(function(err, url) {
        el.src = url
      })*/
    })
  }

}
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 10, 2016

There's a 99% chance this a bug in videostream. I just spoke with @jhiesey and he agrees. He's in the process of rewriting that package from scratch right now. Right now, it's heavily based on mp4box.js which is full of bugs and required significant hacking. I expect his new solution will work much better!

@DiegoRBaquero

This comment has been minimized.

Copy link
Member Author

@DiegoRBaquero DiegoRBaquero commented Mar 30, 2016

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented May 1, 2016

@DiegoRBaquero Has this issue been fixed since the new videostream package came out? Does this also happen on instant.io? Can you email me the file, so I can try to reproduce this for myself?

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.