private function detectFrameHead()
    {
        $firstCrLf = strpos($this->buffer, self::HEADER_STOP_CR_LF, $this->offset);
        $firstLf = strpos($this->buffer, self::HEADER_STOP_LF, $this->offset);

        // we need to use the first available marker, so we need to make sure that cr lf don't overrule lf
        if ($firstCrLf !== false && ($firstLf === false || $firstLf > $firstCrLf)) {
            $this->extractFrameMeta(substr($this->buffer, $this->offset, $firstCrLf - $this->offset));
            $this->offset = $firstCrLf + strlen(self::HEADER_STOP_CR_LF);
            return true;
        }

        if ($firstLf !== false) {
            $this->extractFrameMeta(substr($this->buffer, $this->offset, $firstLf - $this->offset));
            $this->offset = $firstLf + strlen(self::HEADER_STOP_LF);
            return true;
        }
        return false;
    }