     }
     
     fileprivate func disableSession() {
-        if session != nil {
-            VTCompressionSessionInvalidate(session!)
-            session = nil
+        if let session = self.session {
+            VTCompressionSessionInvalidate(session)
         }
+        self.session = nil
         formatDescription = nil // 必须置空，否则，再次推流的时候不会发送sps, pps，在某些服务器上不能播放
     }
     

            }
        }
    }
    var height: Int32 = 720 {
        didSet {
            if self.height == oldValue { return }

    }
    
    fileprivate func configureSession() {
        if let session = self.session {
            VTCompressionSessionInvalidate(session)
            self.session = nil
        }
        let attributes: [NSString: Any] = [
            kCVPixelBufferPixelFormatTypeKey: Int(kCVPixelFormatType_420YpCbCr8BiPlanarFullRange),
