12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using System.Drawing;
- namespace Vinno.vCloud.FIS.CrossPlatform.Android.LiveVideo
- {
- internal abstract class ImageSenderBaseV2
- {
- protected int SendImageWidth;
- protected int SendImageHeight;
- protected byte[] PushFrameBuffer;
- protected byte[] YuvPushFrameBuffer;
- protected readonly int ChannelNumer = 4;
- protected Rectangle ImageRectangle;
- protected ImageSenderBaseV2()
- {
- }
- protected void ResizeBuffer(ref byte[] buffer, int size)
- {
- if (buffer == null)
- {
- buffer = new byte[size];
- }
- else if (buffer.Length != size)
- {
- Array.Resize(ref buffer, size);
- }
- }
- protected void ArgbToYuvI420(byte[] rgbData, int width, int height)
- {
- ResizeBuffer(ref YuvPushFrameBuffer, width * height * 3 / 2);
- YuvHelper.ConvertABGRToI420(rgbData, width, height, YuvPushFrameBuffer);
- }
- }
- }
|