I am developing a pepper api to stream audio/video upon network.
till now, I managed to integrate the libfdk_aac, profile AAC_LD, for the audio encoder and the X264 for the video encoder. Regarding the video encoder I have tried to encode frames of 640x480 pixels. The encoder takes an average of 300 msec to encode a frame, normally the same code outside the "pepper API" takes an average of 2 msec. Since this is unacceptable for my purposes, I thought the problem was due to the fact that inside the "pepper API", the X264 code, can not use the assembly. Then I decide to switch to VP9 encoder and using the internal implementation of the encoder, in this case it takes an average of 50 msec, and this is still to slow.
For the moment the work around was to throw away two frames on three and encode just this one. In this way, in my trace I have one frame and one encoded frame. At the end of the post, I put the trace before and after the work around.
Since is unbelievable that the internal implementation of the browser, takes so much time to encode a frame, I am wondering what am i doing wrong.
any suggestion?
Before the work around
encode-time=0.0251698;result=0;main-thread=0
track-get-frame-time=0.03757;result=0;main-thread=1
track-get-frame-time=0.00806999;result=0;main-thread=1
encode-time=0.0648999;result=0;main-thread=0
track-get-frame-time=0.03795;result=0;main-thread=1
track-get-frame-time=0.04443;result=0;main-thread=1
track-get-frame-time=0.0124302;result=0;main-thread=1
track-get-frame-time=0.0465901;result=0;main-thread=1
encode-time=0.11976;result=0;main-thread=0
track-get-frame-time=0.0398898;result=0;main-thread=1
encode-time=0.03618;result=0;main-thread=0
track-get-frame-time=0.06565;result=0;main-thread=1
track-get-frame-time=5.00679e-05;result=0;main-thread=1
encode-time=0.0392499;result=0;main-thread=0
After the work around
track-get-frame-time=0.14198;result=0;main-thread=1
encode-time=0.0337899;result=0;main-thread=0
track-get-frame-time=0.1703;result=0;main-thread=1
encode-time=0.0372999;result=0;main-thread=0
track-get-frame-time=0.0873299;result=0;main-thread=1
encode-time=0.0405202;result=0;main-thread=0
track-get-frame-time=0.14212;result=0;main-thread=1
encode-time=0.0253599;result=0;main-thread=0
track-get-frame-time=0.12925;result=0;main-thread=1
encode-time=0.0218101;result=0;main-thread=0
track-get-frame-time=0.13498;result=0;main-thread=1
encode-time=0.0368099;result=0;main-thread=0
track-get-frame-time=0.13621;result=0;main-thread=1
encode-time=0.0271699;result=0;main-thread=0
track-get-frame-time=0.12736;result=0;main-thread=1