删除多余ts split代码

This commit is contained in:
xiongziliang
2022-02-13 21:36:04 +08:00
parent 83c1f29253
commit 2e9d77e8e1
7 changed files with 11 additions and 48 deletions

View File

@@ -15,9 +15,7 @@ using namespace toolkit;
namespace mediakit {
HttpTSPlayer::HttpTSPlayer(const EventPoller::Ptr &poller, bool split_ts) {
_split_ts = split_ts;
_segment.setOnSegment([this](const char *data, size_t len) { onPacket(data, len); });
HttpTSPlayer::HttpTSPlayer(const EventPoller::Ptr &poller) {
setPoller(poller ? poller : EventPollerPool::Instance().getPoller());
}
@@ -34,17 +32,8 @@ void HttpTSPlayer::onResponseHeader(const string &status, const HttpClient::Http
}
void HttpTSPlayer::onResponseBody(const char *buf, size_t size) {
if (_split_ts) {
try {
_segment.input(buf, size);
} catch (std::exception &ex) {
WarnL << ex.what();
// ts解析失败清空缓存数据
_segment.reset();
throw;
}
} else {
onPacket(buf, size);
if (_on_segment) {
_on_segment(buf, size);
}
}
@@ -59,12 +48,6 @@ void HttpTSPlayer::emitOnComplete(const SockException &ex) {
}
}
void HttpTSPlayer::onPacket(const char *data, size_t len) {
if (_on_segment) {
_on_segment(data, len);
}
}
void HttpTSPlayer::setOnComplete(onComplete cb) {
_on_complete = std::move(cb);
}