解决单Track时,等待时间太长的问题

This commit is contained in:
xiongziliang
2020-11-29 09:38:04 +08:00
parent a5b4da7db5
commit a64ce68592
8 changed files with 112 additions and 74 deletions

View File

@@ -28,6 +28,16 @@ PSDecoder::PSDecoder() {
}
return 0;
},this);
ps_demuxer_notify_t notify = {
[](void *param, int stream, int codecid, const void *extra, int bytes, int finish) {
PSDecoder *thiz = (PSDecoder *) param;
if (thiz->_on_stream) {
thiz->_on_stream(stream, codecid, extra, bytes, finish);
}
}
};
ps_demuxer_set_notify((struct ps_demuxer_t *) _ps_demuxer, &notify, this);
}
PSDecoder::~PSDecoder() {
@@ -38,8 +48,12 @@ int PSDecoder::input(const uint8_t *data, int bytes) {
return ps_demuxer_input((struct ps_demuxer_t*)_ps_demuxer,data,bytes);
}
void PSDecoder::setOnDecode(const Decoder::onDecode &decode) {
_on_decode = decode;
void PSDecoder::setOnDecode(Decoder::onDecode cb) {
_on_decode = std::move(cb);
}
void PSDecoder::setOnStream(Decoder::onStream cb) {
_on_stream = std::move(cb);
}
}//namespace mediakit