Code Monkey home page Code Monkey logo

Comments (3)

PHZ76 avatar PHZ76 commented on May 27, 2024

你好,这个可以同时推流H.264和AAC,可以参考这个 https://github.com/PHZ76/DesktopSharing

from rtmp.

wusopp avatar wusopp commented on May 27, 2024

你好,这个可以同时推流H.264和AAC,可以参考这个 https://github.com/PHZ76/DesktopSharing

感谢回复,我这边还有个语法上的问题向你请教下:
就是addTriggerEvent 触发事件的使用场景问题,比如rtmp publish中,使用handshake完成握手。如下所示:
m_taskScheduler->addTriggerEvent(this{
m_rtmpConn->handshake();
});
在rtsp server 代码中也使用此类触发事件完成channel 的增加和删除,但我看rtmp server代码中有的地方注释掉了addTriggerEvent,比如

  //m_taskScheduler->addTriggerEvent([=]() {
m_rtmpConn->sendAudioData(timestamp, payload, payloadSize);
    //});

   我实际注释掉了握手部分的addTriggerEvent,如下所示,也是可以运行的。并在源码中实现时是采用将回调函数压栈,然后通过lambda表达式的方式进行事件触发。貌似不压栈也可以?
    //m_taskScheduler->addTriggerEvent([this](){
	m_rtmpConn->handshake();
//});
 所以向你请教下,TriggerEvent使用场景是什么时候呢?为什么有的地方适合调用这个函数,有的地方不适用,需要注释掉呢?

from rtmp.

PHZ76 avatar PHZ76 commented on May 27, 2024

因为调用pushAudioFrame的线程 和 EventLoop的事件处理线程 不是同一个线程, addTriggerEvent 是为了线程安全,作用是投递事件到EventLoop的线程。这边改为在内部调用了,所以上面那里注释掉了。

from rtmp.

Related Issues (12)

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.