SRS流媒体服务器之HTTP-FLV框架分析( 六 )


0 SrsHttpResponseWriter::writev (this=0x7ffff7f1ebd0, iov=0xaeaa80, iovcnt=240,pnwrite=0x0) at src/service/srs_service_http_conn.cpp:7841 0x00000000004fde62 in SrsBufferWriter::writev (this=0x7ffff7f1e860, iov=0xaeaa80,iovcnt=240, pnwrite=0x0) at src/app/srs_app_http_stream.cpp:5112 0x000000000040f109 in SrsFlvTransmuxer::write_tags (this=0xb92fb0, msgs=0xaea310,count=80) at src/kernel/srs_kernel_flv.cpp:5383 0x00000000004fd0b1 in SrsFlvStreamEncoder::write_tags (this=0xb51490, msgs=0xaea310,count=80) at src/app/srs_app_http_stream.cpp:3454 0x00000000004ff0dc in SrsLiveStream::do_serve_http (this=0xa3d9f0, w=0x7ffff7f1ebd0,r=0xb92840) at src/app/srs_app_http_stream.cpp:6775 0x00000000004fe108 in SrsLiveStream::serve_http (this=0xa3d9f0, w=0x7ffff7f1ebd0,r=0xb92840) at src/app/srs_app_http_stream.cpp:5446 0x000000000049c86f in SrsHttpServeMux::serve_http (this=0xa11fe0, w=0x7ffff7f1ebd0,r=0xb92840) at src/protocol/srs_http_stack.cpp:7117 0x0000000000562080 in SrsHttpServer::serve_http (this=0xa11e00, w=0x7ffff7f1ebd0,r=0xb92840) at src/app/srs_app_http_conn.cpp:3008 0x000000000049d6be in SrsHttpCorsMux::serve_http (this=0xb37440, w=0x7ffff7f1ebd0,r=0xb92840) at src/protocol/srs_http_stack.cpp:8599 0x0000000000561086 in SrsHttpConn::process_request (this=0xb93ff0, w=0x7ffff7f1ebd0,r=0xb92840) at src/app/srs_app_http_conn.cpp:16110 0x0000000000560ce8 in SrsHttpConn::do_cycle (this=0xb93ff0) at src/app/srs_app_http_conn.cpp:133 ---Type <return> to continue, or q <return> to quit---11 0x00000000004d10fb in SrsConnection::cycle (this=0xb93ff0) at src/app/srs_app_conn.cpp:17112 0x0000000000509c88 in SrsSTCoroutine::cycle (this=0xb93f10) at src/app/srs_app_st.cpp:19813 0x0000000000509cfd in SrsSTCoroutine::pfn (arg=0xb93f10) at src/app/srs_app_st.cpp:21314 0x00000000005bdd9d in _st_thread_main () at sched.c:33715 0x00000000005be515 in st_thread_create (start=0x5bd719 <_st_vp_schedule+170>,arg=0x900000001, joinable=1,stk_size=1) at sched.c:616 
(2)客户端拉取HTTP—FLV播放流程
当RTMP推流成功后,这里通过调试,跟踪客户端拉流时,SRS流媒体服务器的播放流程 。当拉取HTTP-FLV流时,每个播放的SrsFlvStreamEncoder是独?,互不影响 。调用关系是从下至上,即11到0 。如下:
0 SrsFlvStreamEncoder::SrsFlvStreamEncoder (this=0xa57820) at src/app/srs_app_http_stream.cpp:2501 0x00000000004fe2fd in SrsLiveStream::do_serve_http (this=0xa3da20, w=0x7ffff7eb5bd0,r=0xa5d7c0) at src/app/srs_app_http_stream.cpp:5622 0x00000000004fe108 in SrsLiveStream::serve_http (this=0xa3da20, w=0x7ffff7eb5bd0,r=0xa5d7c0) at src/app/srs_app_http_stream.cpp:5443 0x000000000049c86f in SrsHttpServeMux::serve_http (this=0xa11fe0, w=0x7ffff7eb5bd0,r=0xa5d7c0) at src/protocol/srs_http_stack.cpp:7114 0x0000000000562080 in SrsHttpServer::serve_http (this=0xa11e00, w=0x7ffff7eb5bd0,r=0xa5d7c0) at src/app/srs_app_http_conn.cpp:3005 0x000000000049d6be in SrsHttpCorsMux::serve_http (this=0xa52930, w=0x7ffff7eb5bd0,r=0xa5d7c0) at src/protocol/srs_http_stack.cpp:8596 0x0000000000561086 in SrsHttpConn::process_request (this=0xa5d120,w=0x7ffff7eb5bd0, r=0xa5d7c0) at src/app/srs_app_http_conn.cpp:1617 0x0000000000560ce8 in SrsHttpConn::do_cycle (this=0xa5d120) atsrc/app/srs_app_http_conn.cpp:1338 0x00000000004d10fb in SrsConnection::cycle (this=0xa5d120) atsrc/app/srs_app_conn.cpp:1719 0x0000000000509c88 in SrsSTCoroutine::cycle (this=0xa5d1c0) atsrc/app/srs_app_st.cpp:19810 0x0000000000509cfd in SrsSTCoroutine::pfn (arg=0xa5d1c0) atsrc/app/srs_app_st.cpp:21311 0x00000000005bdd9d in _st_thread_main () at sched.c:337 
(3)客户端拉取HTTP_FLV流过程中,部分日志如下:
[Trace][10457][554] HTTP client ip=175.0.54.116, request=0, to=15000ms[Trace][10457][554] HTTP GET http://111.229.231.225:8081/live/livestream.flv, content-length=-1[Trace][10457][554] http: mount flv stream for sid=/live/livestream, mount=/live/livestream.flv[Trace][10457][554] flv: source url=/live/livestream, is_edge=0, source_id=-1[-1][Trace][10457][554] create consumer, active=0, queue_size=0.00,jitter=30000000[Trace][10457][554] set fd=10, SO_SNDBUF=46080=>175000,buffer=350ms[Trace][10457][554] FLV /live/livestream.flv, encoder=FLV,nodelay=0, mw_sleep=350ms, cache=0, msgs=128 
9.总结
本篇文章在前面文章的基础上,讲解从客户端RTMP推流到SRS流媒体服务器,拉流端拉取HTTP_FLV数据的过程,并通过调试的方法,跟踪SRS流媒体服务器的函数调用流程 。能够帮助大家理清其中错综复杂的关系,对于源码分析非常有帮助 。
本篇文章就分析到这里,欢迎关注,转发,点赞,收藏,分享,评论区讨论 。




推荐阅读