Merge pull request #607 from alongL/master

Update HttpTSPlayer.cpp
This commit is contained in:
夏楚 2020-12-05 12:29:20 +08:00 committed by GitHub
commit 955ecde533
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ HttpTSPlayer::HttpTSPlayer(const EventPoller::Ptr &poller, bool split_ts){
HttpTSPlayer::~HttpTSPlayer() {} HttpTSPlayer::~HttpTSPlayer() {}
int64_t HttpTSPlayer::onResponseHeader(const string &status, const HttpClient::HttpHeader &headers) { int64_t HttpTSPlayer::onResponseHeader(const string &status, const HttpClient::HttpHeader &headers) {
_status = status;
if (status != "200" && status != "206") { if (status != "200" && status != "206") {
//http状态码不符合预期 //http状态码不符合预期
shutdown(SockException(Err_other, StrPrinter << "bad http status code:" + status)); shutdown(SockException(Err_other, StrPrinter << "bad http status code:" + status));
@ -35,6 +36,9 @@ int64_t HttpTSPlayer::onResponseHeader(const string &status, const HttpClient::H
} }
void HttpTSPlayer::onResponseBody(const char *buf, int64_t size, int64_t recvedSize, int64_t totalSize) { void HttpTSPlayer::onResponseBody(const char *buf, int64_t size, int64_t recvedSize, int64_t totalSize) {
if (_status != "200" && _status != "206") {
return;
}
if (recvedSize == size) { if (recvedSize == size) {
//开始接收数据 //开始接收数据
if (buf[0] == TS_SYNC_BYTE) { if (buf[0] == TS_SYNC_BYTE) {