2

I have OpenH264 working on my local network.

The code is something like.

send(server, frame)
recv(client, frame)
DecodeFrameNoDelay(frame, frame_buffer)

if(frame_buffer.iBufferStatus == 1)
//process frame

This works fine with a low latency connection on my local network. but fails on a high latency connection like a slow VPS.

I can receive the first frame but then the stream fails and DecodeFrameNoDelay does not return any frames.

If i set the bitrate and FPS very low i can get it to work. this leads me to believe its has to do with the timing?

Should I be putting the decoded frames in to a buffer and then have the decoder decode the frames from the buffer? as to maintain the required FPS?

I appreciate any feedback thanks!

TaW
  • 61
  • 6
  • 1
    I feel like having the send and recv functions delay the encode/decode queue's is what could be causing the issues. not sure yet. – TaW Jun 17 '19 at 14:37
  • on further testing, the video works fine when with adding a one second delay every 5 seconds. so i dont believe its the timing anymore. still looking in to my network code. – TaW Jun 19 '19 at 01:39

1 Answers1

0
h264_encoder->SetOption(ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod);
// or
h264_encoder->ForceIntraFrame(TRUE);

I am assuming that when streaming over the internet there needs to be a IDR frame sent over so often to keep the decoding in sync.

I feel this pretty hack but this gets the job done.

TaW
  • 61
  • 6