LiveVideo10ms icon indicating copy to clipboard operation
LiveVideo10ms copied to clipboard

feed decoder with End-of-Stream frame flag reduce latency

Open qiximenghu opened this issue 4 years ago • 1 comments

Hello. When I send IDR or P frame with frame flag End-of-Stream to the haerdware decoder and add vui information as your code, the MediaCodec decode H264 will not buffer frame, it will output frame immediately. Then after releaseOutputBuffer, flush the decoder, and queueInputBuffer make decoder Running again. I tested 720P@30fps h264 video on XiaoMi Mi8 device, the average decode time is about 7ms while without End-of-Stream flag is about 30ms. 
Howerver, when I render frame to surface and then flush decoder, it display little normal frame and lots of black frame.
Here is a test log. pts_times is  queueInputBuffer, pts_time_sb is dequeueOutputBuffer time, pts_time_sf is releaseOutputBuffer time.
Hope it helps you.

latency

qiximenghu avatar Aug 02 '21 11:08 qiximenghu

Hello, Interesting. So you are basically doing the following:

  1. feed frame (IDR or P) with EOS flag
  2. "get" the decoded frame with low latency, but due to EOS one has to restart the decoder
  3. repeat step 1 ?

Do you have a link to your code ?

Consti10 avatar Sep 13 '21 19:09 Consti10