http-ts直播减少一次内存拷贝

This commit is contained in:
ziyue
2021-07-07 16:15:42 +08:00
parent 6220db77e8
commit 4b694ccde8
5 changed files with 20 additions and 18 deletions

View File

@@ -73,8 +73,12 @@ public:
}
private:
void onTs(const void *packet, size_t bytes, uint32_t timestamp, bool is_idr_fast_packet) override {
_hls->inputData((char *) packet, bytes, timestamp, is_idr_fast_packet);
void onTs(std::shared_ptr<Buffer> buffer, uint32_t timestamp, bool is_idr_fast_packet) override {
if (!buffer) {
_hls->inputData(nullptr, 0, timestamp, is_idr_fast_packet);
} else {
_hls->inputData(buffer->data(), buffer->size(), timestamp, is_idr_fast_packet);
}
}
private: