diff --git a/Assets/RTMPPublisher.cs b/Assets/RTMPPublisher.cs index 8ca5645..1125963 100644 --- a/Assets/RTMPPublisher.cs +++ b/Assets/RTMPPublisher.cs @@ -30,8 +30,6 @@ namespace ZC [SerializeField] private Camera _camera; - private Texture2D _output; - private volatile int _sendData; private AsyncGPUReadbackRequest _asyncGPUReadbackRequest; @@ -188,7 +186,7 @@ namespace ZC $" -loglevel info " + $" -map 0:a:0 -map 1:v:0 " + $" -c:a aac " + - $" -c:v:0 libx264 -g 1 -bf 0 -speed 1x -max_delay 0 -vf scale={this._config.resolution} -preset:v ultrafast -tune:v zerolatency -crf 10 -pix_fmt yuv420p -strict -2 " + + $" -c:v:0 libx264 -g 1 -bf 0 -max_delay 0 -vf scale={this._config.resolution} -preset:v ultrafast -tune:v zerolatency -crf 10 -pix_fmt yuv420p -strict -2 " + $" -f flv {this._config.server}{this._config.appName} -bf 0 "; Debug.Log(processStartInfo.Arguments); @@ -223,7 +221,6 @@ namespace ZC _isRequesting = true; SetCamera(camera); _sendData = 0; - Object.Destroy(_output); this._targetTextureWidth = camera.targetTexture.width; this._targetTextureHeight = camera.targetTexture.height; var targetTextureByteCount = this._targetTextureWidth * this._targetTextureHeight * 3; @@ -233,8 +230,6 @@ namespace ZC _bitmapArray = new byte[Bitmap.FileHeaderSize + Bitmap.ImageHeaderSize + targetTextureByteCount]; } - _output = new Texture2D(this._targetTextureWidth, this._targetTextureHeight); - _frameIndex = _doneFrameIndex = 0; CreateCaptureThread(); @@ -250,21 +245,10 @@ namespace ZC public void Dispose() { - try - { - this._isRequesting = true; - _sendData = 0; - _camera = null; - Object.Destroy(_output); - this.DisposeCaptureThread(); - } - finally - { -#if UNITY_EDITOR -#else - _textureData.Dispose(); -#endif - } + this._isRequesting = true; + _sendData = 0; + _camera = null; + this.DisposeCaptureThread(); } [DllImport("kernel32.dll", SetLastError = true)]