PPAPI URLLoader fail to receive endless multipart response

31 views
Skip to first unread message

Arthur Dou

unread,
Feb 2, 2017, 12:56:17 AM2/2/17
to Native-Client-Discuss
Hi all,
I'm studying the URLLoader sample introduced  at official site, and trying to load multipart response of a server. While the 
response is an endless multipart content (without "--myBoundary--") which is actually a continuous video frames sent from 
an IP camera. 
While calling pp::URLLoader::ReadResponseBody, it keeps returning -1 (might stand for PP_OK_COMPLETIONPENDING) and 
the buffer remains empty. Is there anyway to access the endless multipart reponse from the server? To achieve my purpose, 
I just edit a bit of the original code, which post the received responses directly rather than store into a string variable: 

void URLLoaderHandler::ReadBody() {
  pp::CompletionCallback cc =
      cc_factory_.NewOptionalCallback(&URLLoaderHandler::OnRead);
  int32_t result = PP_OK;
  do {
    result = url_loader_.ReadResponseBody(buffer_, READ_BUFFER_SIZE, cc);

    if (result > 0) {
      AppendDataBytes(buffer_, result);
      ReportResult(url_, url_response_body_, true);
      url_response_body_.clear();
    }

  } while (result > 0);

  if (result != PP_OK_COMPLETIONPENDING) {
    cc.Run(result);
  }
}

Thanks for any of your replies,
Arthur

Ben Smith

unread,
Feb 21, 2017, 10:47:24 PM2/21/17
to Native-Client-Discuss
I'm not certain, but perhaps you can use SetStreamToFile?
Reply all
Reply to author
Forward
0 new messages