Coder Social home page Coder Social logo

smallchi / jt1078gateway Goto Github PK

View Code? Open in Web Editor NEW
61.0 7.0 54.0 3.92 MB

基于Pipeline实现的JT1078Gateway支持TCP/UDP,目前只支持http-flv、ws-flv、hls三种拉流方式

License: MIT License

C# 95.65% HTML 4.15% TypeScript 0.01% Batchfile 0.20%
jt1078 gb1078 jtt1078 csharp dotnetcore jt1078-gateway 1078 ws-flv http-flv pipeline net5 m3u8 hls

jt1078gateway's Issues

如何完整的实现流程。

你好,我最近正在研究学习这个代码。有一些疑问。还请帮忙解答一下。如何搭建这些服务,并打通整个流程。

使用Kafka队列,用的不是DotNetty
目标流程:

  1. 设备可以上报位置信息。(808)
  2. 通过客户端对设备下发推流指令
  3. 在网页上实时观看设备推流的信息。

我当前是这么理解的:
0. 用Simple Client来给设备下发指令。(目前有一个1078的设备)
1.用808Gateway Simple (QueueNotification/QueueServer/QueueService) 来接受消息
2. 在800Gateway SimpleQueueService中添加了1078扩展,添加了对例如0x9010 实时音视频传输请求 指令的处理,当前处理方式是直接返回原始数据 request.OriginData.ToArray() (byte[])
3. 用JT1078 Gateway 来接受视频服务。
4. 用代码中的index.html + flv.js 来观看实时视屏流。

但是整个流程一直调试不通,不知道上面的理解和环境的搭建是否有问题?
如果方便的话,是否可以我们线下交流一下,谢谢!

使用dotnetty获取jtt1078视频流时的一些疑问

大师,最近一直在学习你的代码,受益很多,有一些疑问想求教一下,望不吝赐教,多谢。
在这个项目开源出来之前,我一直在学习JT808DotNetty项目,然后延续你的思路学习编写了一个与这个项目类似的一个项目,在其中遇到一些问题。
其中显著的问题就是完成解码、推流操作后,使用VLC Media Player播放rtmp视频流的时候会出现花屏,并且黑屏时间大概要8s左右,比锐明等厂商的方案要明显的慢。
对于花屏,限于我对流媒体等相关技术的知识和经验不足,我只尝试从I帧开始推流,确实解决了花屏的问题,但是随之而来导致了更长的黑屏时间。
最开始的时候在推流过程中大量使用了异步方法,导致视频流出现了更多的异常,随后我检查出来并改用了同步方法。
我目前的困惑是使用dotnetty推送视频流时,需要对推送过程加锁吗?我的理解是如果推流过程足够慢,但客户端发包足够快,会不会造成多个包交错的推流,导致帧数据异常。
另外就是刚才提到的关于黑屏时间过长的问题,大师可以介绍一下下关的经验吗?

最新情况

  1. 音频转码可用 EasyAccEncoder.Net ,目前已在实际应用中完成G711A到AAC的转换,并成功实现使用flv.js播放。其它,G711U、G726、PCM到AAC未测试,应该也可转换。
  2. HttpListener 作为flv流服务器,有个需要注意的地方,一定要在写入流数据后使用OutputStream.Close() 或 Response.Close() 方法。
    推荐使用方法为 JT1078HttpContextExtensions.cs 中 HttpM3U8Async() 这种使用传入 Stream ,内部使用 await stream.CopyToAsync(context.Response.OutputStream,用Stream来阻塞http连接结束。

像 HttpSendFirstChunked()/HttpSendChunked() 这种,传入byte[]使用 Write()写入数据,在未使用Close()的情况下,就算使用 Flush 也无效,会导致发送到客户端的数据将非常缓慢。

具体表现就是,前端使用flv.js或VLC播放flv流时首屏展现时间基本都在10-20s以上,并且随着播放时间越长,延迟越严重,导致视频卡顿,服务器上堆积大量待发送到客户端消息。

关于 HttpListener OutputStream 使用 Write()写入数据后,Flush无效相关链接
https://stackoverflow.com/questions/794207/how-to-flush-httplistener-response-stream
https://stackoverflow.com/questions/5231291/httplistener-response-flushes-to-soon-for-large-buffers
https://stackoverflow.com/questions/13385633/serving-large-files-with-c-sharp-httplistener
https://stackoverflow.com/questions/794207/how-to-flush-httplistener-response-stream/794417#794417

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.