internal void ReleaseOutputBuffer(MMALBufferImpl bufferImpl) { bufferImpl.Release(); bufferImpl.Dispose(); try { if (!this.Enabled) { MMALLog.Logger.Warn("Port not enabled."); } if (this.BufferPool == null) { MMALLog.Logger.Warn("Buffer pool null."); } if (this.Enabled && this.BufferPool != null) { var newBuffer = MMALQueueImpl.GetBuffer(this.BufferPool.Queue.Ptr); if (newBuffer != null) { this.SendBuffer(newBuffer); } else { MMALLog.Logger.Warn("Buffer null. Continuing."); } } } catch (Exception e) { MMALLog.Logger.Warn($"Unable to send buffer header. {e.Message}"); } }
internal void ReleaseInputBuffer(MMALBufferImpl bufferImpl) { bufferImpl.Release(); if (this.Enabled && this.BufferPool != null) { var newBuffer = MMALQueueImpl.GetBuffer(this.BufferPool.Queue.Ptr); //Populate the new input buffer with user provided image data. var result = this.ManagedInputCallback(newBuffer, this); bufferImpl.ReadIntoBuffer(result.BufferFeed, result.EOF); try { if (this.Trigger != null && this.Trigger.CurrentCount > 0 && result.EOF) { MMALLog.Logger.Debug("Received EOF. Releasing."); this.Trigger.Signal(); newBuffer.Release(); } if (newBuffer != null) { this.SendBuffer(newBuffer); } else { MMALLog.Logger.Warn("Buffer null. Continuing."); } } catch (Exception ex) { MMALLog.Logger.Warn($"Buffer handling failed. {ex.Message}"); } } }