Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有些流具有多个 #269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexliyu7352
Copy link
Contributor

有些流
pmt->stream_count == sizeof(pmt->streams) / sizeof(pmt->streams[0]) 这时不应该直接报错, 而是可以继续播放下去的

有些流
pmt->stream_count == sizeof(pmt->streams) / sizeof(pmt->streams[0])
这时不应该直接报错, 而是可以继续播放下去的
@ireader
Copy link
Owner

ireader commented Apr 9, 2023

默认一个节目最多4个流(video + audio + subtitle + private stream)

  • 如果特定场景下需要多个流, 可以调整pmt中的stream_count数值;
  • 一般IPTV场景下, 建议使用多个节目, PAT的节目表是没有限制的, 可以有几百路节目;

@alexliyu7352
Copy link
Contributor Author

对, 所以这里是否直接断言终止了有点不合理吧?
因为有时候源方是无法控制的.

@alexliyu7352
Copy link
Contributor Author

还有假设一个节目4个流,
pmt->stream_count == 4
sizeof(pmt->streams) / sizeof(pmt->streams[0]) == 4

这时候就触发断言了阿

@ireader
Copy link
Owner

ireader commented Apr 9, 2023

还有假设一个节目4个流, pmt->stream_count == 4 sizeof(pmt->streams) / sizeof(pmt->streams[0]) == 4

这时候就触发断言了阿

    for(i = 0; i < pmt->stream_count; i++)
    {
        if(pmt->streams[i].pid == pid)
            return &pmt->streams[i];
    }
    
    if(pmt->stream_count >= sizeof(pmt->streams) / sizeof(pmt->streams[0]))
    {
        assert(0);
        return NULL;
    }

这里的逻辑是最多支持4个stream。

@ireader
Copy link
Owner

ireader commented Apr 9, 2023

对, 所以这里是否直接断言终止了有点不合理吧? 因为有时候源方是无法控制的.

这里要根据实际情况来处理, 大部分场景下,4个stream就够了;如果源流确实有超过4个stream,可以把streams数组调大一些。

假如实际源流的单个节目中超过了4个stream,直接覆盖最后一个stream不是最好的处理策略,因为覆盖实际上意味着丢失了一路stream。

@ireader
Copy link
Owner

ireader commented Apr 9, 2023

image

如果源流中音视频编码格式或者参数发生变化,可以考虑把135/136行注释放开。

按照TS规范,PMT中version number发生变化时应该需要更新流信息,pmt_clear可以清除之前的流信息。 但是国内有些厂商生成的TS流不太规范,version number一直变化,调用pmt_clear可能会造成组帧失败,所以默认把这行关闭了。

@ireader
Copy link
Owner

ireader commented Apr 9, 2023

image

当时做了个兼容策略如上

@alexliyu7352
Copy link
Contributor Author

streams数组调大的确可以解决, 但是有时候是不知道track数量的, 有些流可能一个视频track带5-6个不同语言的音频track.
所以总不好streams数组调整的很大.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants