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