void OnInitializedEncoder(object sender, PPError result) { if ((PPError)result != PPError.Ok) { LogError(result, "Encoder initialization failed"); return; } IsEncoding = true; Log("started"); if (videoEncoder.GetFrameCodedSize(out encoderSize) != PPError.Ok) { LogError(result, "Cannot get encoder coded frame size"); return; } var bitResult = videoEncoder.GetBitstreamBuffer(); if (encoderSize != frameSize) { ConfigureTrack(); } else { StartTrackFrames(); ScheduleNextEncode(); } }