开发者

How much data was transmitted at a specific sink

开发者 https://www.devze.com 2023-03-24 08:28 出处:网络
Having implemented a strange framework, I have to know how many bytes will be delivered at a specific tcpsink, before actually transmitting the data. (A rather large amount of data, actually. Some 100

Having implemented a strange framework, I have to know how many bytes will be delivered at a specific tcpsink, before actually transmitting the data. (A rather large amount of data, actually. Some 100 megab开发者_C百科ytes.)

  • I have separated audio and video data files (say Vorbis, AAC, Theora and h.264) and my "daemon" acts as a webservice that muxes the data together as requested.

  • Unfortunately I need to deliver a correct Content-Length header and of cause there is no way of knowing the actual data amount that will be delivered unless you play the muxing process through at least once.

My question is: Can I e.g. put an fakesink at the end of the pipe at the first run and query it, how many bytes it received? How would I query that?

By now I use an fdsink and count the bytes I read, but I guess there is a better way. Is there a better way? :)


You can do it in many ways. One way that springs to mind is using fakesink, and connecting a buffer probe to the src pad feeding fakesink. You will then get a callback for each buffer, and can simply count bytes.

You could use appsink with a handoff callback for the same effect.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号