Commit 955ecde5 by 夏楚 Committed by GitHub

Merge pull request #607 from alongL/master

Update HttpTSPlayer.cpp
parents 3f37ef61 71316497
......@@ -20,6 +20,7 @@ HttpTSPlayer::HttpTSPlayer(const EventPoller::Ptr &poller, bool split_ts){
HttpTSPlayer::~HttpTSPlayer() {}
int64_t HttpTSPlayer::onResponseHeader(const string &status, const HttpClient::HttpHeader &headers) {
_status = status;
if (status != "200" && status != "206") {
//http状态码不符合预期
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) {
if (_status != "200" && _status != "206") {
return;
}
if (recvedSize == size) {
//开始接收数据
if (buf[0] == TS_SYNC_BYTE) {
......@@ -78,4 +82,4 @@ void HttpTSPlayer::setOnPacket(const TSSegment::onSegment &cb) {
_on_segment = cb;
}
}//namespace mediakit
\ No newline at end of file
}//namespace mediakit
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论