public void CreateSession() { if (player != null) { return; } player = StreamPlayer.CreateSession(); player.SetOption(OptionType.DataCacheSize, bitStreamCacheSize); player.SetOption(OptionType.DemuxTimeout, demuxTimeout); player.SetOption(OptionType.PushFrameInterval, pushFrameInterval); player.SetOption(OptionType.AlwaysWaitBitStream, alwaysWaitBitStream ? 1 : 0); player.SetOption(OptionType.WaitBitStreamTimeout, waitBitStreamTimeout); player.SetOption(OptionType.AutoDecode, autoDecode ? 1 : 0); player.SetOption(OptionType.DecodeThreadCount, decodeThreadCount); player.SetOption(OptionType.UseCPUConvertYUV, useCPUConvertYUV ? 1 : 0); player.SetOption(OptionType.ConvertPixelFormat, (int)PixelFormat.RGBA); player.SetOption(OptionType.AsyncUpdate, 0); player.SetEventCallBack(OnEvent, OnDrawFrame, this); }