张传峰 2024-07-14 09:27:14 +08:00 committed by GitHub
parent 9727e03c2e
commit 0eb38635ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -85,6 +85,9 @@ DecoderImp::DecoderImp(const Decoder::Ptr &decoder, MediaSinkInterface *sink){
#if defined(ENABLE_RTPPROXY) || defined(ENABLE_HLS)
void DecoderImp::onStream(int stream, int codecid, const void *extra, size_t bytes, int finish) {
if (_finished) {
return;
}
// G711传统只支持 8000/1/16的规格FFmpeg貌似做了扩展但是这里不管它了
auto track = Factory::getTrackByCodecId(getCodecByMpegId(codecid), 8000, 1, 16);
if (track) {
@ -92,6 +95,7 @@ void DecoderImp::onStream(int stream, int codecid, const void *extra, size_t byt
}
// 防止未获取视频track提前complete导致忽略后续视频的问题用于兼容一些不太规范的ps流
if (finish && _have_video) {
_finished = true;
_sink->addTrackCompleted();
InfoL << "Add track finished";
}

View File

@ -57,6 +57,7 @@ private:
void onStream(int stream, int codecid, const void *extra, size_t bytes, int finish);
private:
bool _finished = false;
bool _have_video = false;
Decoder::Ptr _decoder;
MediaSinkInterface *_sink;